Vitaliy Margolen wrote:
In short we have 3 major problems that needs to be fixed:
- GetCursorPos() have to return old (cached) cursor position inside
hook handler. 2. Any changes to the cursor position inside hook handler will be lost after all hooks are handled.
I do appreciate all the responses I got. Unfortunately this problems are still there. Here is the code in question: http://source.winehq.org/source/dlls/winex11.drv/mouse.c#L223 And the patch: http://winehq.org/pipermail/wine-patches/2006-October/031772.html
From what Alexandre explained: whole read-modify-write sequence (lines
263-271) should be under one enter-leave crit_section lock. Same as they are now. However, it is impossible to do here, because functions we call ( queue_raw_mouse_message line 283) will deadlock if we still holding the lock (see the patch).
So we have a test that shows we have to modify cursor_pos _after_ call to queue_raw_mouse_message(). And we have an "unbreakable" sequence that... well needs to be broken.
What should we do? As a side note, relative movement can come from injected event only (X delivers absolute coordinates). And AFAIK is not guaranteed to be placed in the event queue at the right time. So are we just making our life more complicated then it really is?
Vitaliy