Vitaliy Margolen : dinput: Initialize default coop level. Invert logic in hook handler.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Sep 20 13:26:57 CDT 2006


Module: wine
Branch: master
Commit: 84b2d73d3813d655360fbc562900d52852e38338
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=84b2d73d3813d655360fbc562900d52852e38338

Author: Vitaliy Margolen <wine-patch at kievinfo.com>
Date:   Sun Sep 17 15:13:11 2006 -0600

dinput: Initialize default coop level. Invert logic in hook handler.

---

 dlls/dinput/mouse.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 5d4c04e..dff65df 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -264,6 +264,7 @@ static SysMouseImpl *alloc_device(REFGUI
     newDevice->wine_df->internal_format_size = Wine_InternalMouseFormat.dwDataSize;
     newDevice->wine_df->dt = NULL;
     newDevice->dinput = dinput;
+    newDevice->dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
 
     return newDevice;
 }
@@ -424,7 +425,6 @@ static HRESULT WINAPI SysMouseAImpl_SetD
 /* low-level mouse hook */
 static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lparam )
 {
-    LRESULT ret;
     MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
     SysMouseImpl* This = (SysMouseImpl*) current_lock;
     DWORD dwCoop;
@@ -544,14 +544,11 @@ static LRESULT CALLBACK dinput_mouse_hoo
     
     LeaveCriticalSection(&(This->crit));
     
-    if (dwCoop & DISCL_NONEXCLUSIVE) {
-	/* Pass the events down to previous handlers (e.g. win32 input) */
-	ret = CallNextHookEx( 0, code, wparam, lparam );
-    } else {
-	/* Ignore message */
-	ret = 1;
-    }
-    return ret;
+    /* Ignore message */
+    if (dwCoop & DISCL_EXCLUSIVE) return 1;
+
+    /* Pass the events down to previous handlers (e.g. win32 input) */
+    return CallNextHookEx( 0, code, wparam, lparam );
 }
 
 static void dinput_window_check(SysMouseImpl* This) {




More information about the wine-cvs mailing list