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

Vitaliy Margolen wine-patch at kievinfo.com
Sun Sep 17 16:13:11 CDT 2006


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

Per MSDN default coop level is background not exclusive. Also make sure
that we do something special when we need to (exclusive mode) and not
for default case.

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

-------------- next part --------------
f42755129d49fa5922211fc6655c86f816de0835
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index af76bd8..845e32f 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;
 }
@@ -544,14 +545,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-patches mailing list