Fenris
2005.07.14, 07:30 AM
I'm trying to re-implement my mouse handling code, and I've stumbled upon a very strange kind of bug. I grab the mouse coordinates from [NSEvent mouseLocation] (but I've tried using the mouse position of just any event, and it exhibits the same glitch) and transform them to fit into my GL window. (The same problem appears even when I don't transform them, by the way)
Just to try it out, I'm drawing a little quad on the window that represents the mouse location, so I have a sort of "cursor". The problem is, when I drag the window (moving it onscreen) the little quad "drifts" - it moves too quickly. I've done a lot of research, and it isn't my drawing code at fault - just bumbling in with straight [NSEvent mouseLocation] still brings the same error. Now, what seems to be happening is that the window's screen coordinates aren't getting updated properly while dragging the window - only when the drag is completed, and sometimes not even then.
I guess my bottom line is: does anyone of you have some clever mouse location code for Cocoa that holds up even when dragging the window? (I suppose you have, or I would've heard about it, right?)
Just to try it out, I'm drawing a little quad on the window that represents the mouse location, so I have a sort of "cursor". The problem is, when I drag the window (moving it onscreen) the little quad "drifts" - it moves too quickly. I've done a lot of research, and it isn't my drawing code at fault - just bumbling in with straight [NSEvent mouseLocation] still brings the same error. Now, what seems to be happening is that the window's screen coordinates aren't getting updated properly while dragging the window - only when the drag is completed, and sometimes not even then.
I guess my bottom line is: does anyone of you have some clever mouse location code for Cocoa that holds up even when dragging the window? (I suppose you have, or I would've heard about it, right?)