dinput: Create single thread for mouse and keyboard hook procs. [try 3]

Vitaliy Margolen wine-devel at kievinfo.com
Thu Mar 9 20:46:11 CST 2006

Any problems with this patch?

I have not received any additional comments. And it does fix at least two
games in question (see bug reports). And I have not seen any side-affects
from it either.

Vitaliy Margolen

Wednesday, February 22, 2006, 8:10:16 AM, Vitaliy Margolen wrote:

> ChangeLog:
> dinput: Create single thread for mouse and keyboard hooks.

> Put keyboard & mouse hook callbacks into separate thread.
> Move few global variables into object. Delete no longer used crit section.

> For hooks to work properly hook callback have to be in a thread
> with message loop. Some games create separate threads just to handle
> mouse and/or keyboard  events that do not have message loop. This patch fixes
> such games (Bug 4264) - mouse and (Bug 2981) - keyboard.

> Try#2 (based on suggestions from Alexandre):
> Using a message window in a dedicated thread with normal message loop.
> Hooks are installed and removed using SendMessage to this window.
> Only one mouse and one keyboard hook is permitted.
> Hook handles are managed by dedicated thread and not given back to
> caller.

> Try#3 (with Robs suggestions)
> Use critical section.

>  dlls/dinput/device.c         |  132
> ++++++++++++++++++++++++++++++++++++++++++
>  dlls/dinput/device_private.h |    2 +
>  dlls/dinput/keyboard.c       |  130
> ++++++++++++++++-------------------------
>  dlls/dinput/mouse.c          |   33 ++++-------
>  4 files changed, 195 insertions(+), 102 deletions(-)

More information about the wine-devel mailing list