[PATCH 6/6] dinput: Use CALLWINDPROC hook to monitor focus loses away from acquired windows.

Vitaliy Margolen wine-patches at kievinfo.com
Sat Jul 7 00:36:52 CDT 2007

This is required for dinput to release mouse and keyboard when foreground
window becomes background. But do this only when coop level is DISCL_FOREGROUND.

To accomplish this set global CALLWINDPROC hook and monitor some messages
sent to windows, associated with acquired DI devices. Because message itself
is not a guarantee that window is not foreground anymore, check this

Also use PostMessage instead of SendMessage in check_dinput_hooks. This
prevents a deadlock, during un-acquire. It should be fine as we don't
have to react immediately to acquire / unacquire.

Window sub-classing won't work if app subclasses the window itself. Also it
makes it complicated to track multiple devices associated with one window
(which is the case most of the time - with keyboard and mouse).
 dlls/dinput/dinput_main.c |   61 ++++++++++++++++++++++++++++++++++++++++++--
 dlls/dinput/tests/mouse.c |    1 -
 2 files changed, 58 insertions(+), 4 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b60dc71c837b340b0565ca7fae3a537e3e82b704.diff
Type: text/x-patch
Size: 3256 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070706/2224ae9c/b60dc71c837b340b0565ca7fae3a537e3e82b704.bin

More information about the wine-patches mailing list