PATCH: ReleaseCapture - always TRUE

Marcus Meissner marcus at jet.franken.de
Sat Oct 1 10:51:33 CDT 2005


Hi,

Crosschecking against Windows shows that 
ReleaseCapture() should return TRUE in almost all
cases.

MSDN says it should fail sometimes but I guess this
is for true errors and just not "capture not set".

Fixes Bug #1847.

Ciao, Marcus

Changelog:
	ReleaseCapture should return TRUE.

Index: dlls/user/input.c
===================================================================
RCS file: /home/wine/wine/dlls/user/input.c,v
retrieving revision 1.6
diff -u -r1.6 input.c
--- dlls/user/input.c	18 Jul 2005 15:14:56 -0000	1.6
+++ dlls/user/input.c	1 Oct 2005 15:47:57 -0000
@@ -183,7 +183,11 @@
  */
 BOOL WINAPI ReleaseCapture(void)
 {
-    return (SetCapture(0) != 0);
+    SetCapture(0);
+    /* FIXME: it is not clear when to return FALSE here.
+     * I guess it is reserved for when release capture really fails.
+     */
+    return TRUE;
 }
 
 
Index: dlls/user/tests/win.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/win.c,v
retrieving revision 1.71
diff -u -r1.71 win.c
--- dlls/user/tests/win.c	29 Sep 2005 13:36:14 -0000	1.71
+++ dlls/user/tests/win.c	1 Oct 2005 15:47:58 -0000
@@ -2173,6 +2173,8 @@
 
 static void test_capture_3(HWND hwnd1, HWND hwnd2)
 {
+    BOOL ret;
+
     ShowWindow(hwnd1, SW_HIDE);
     ShowWindow(hwnd2, SW_HIDE);
 
@@ -2188,7 +2190,10 @@
     ShowWindow(hwnd1, SW_SHOW);
     check_wnd_state(hwnd1, hwnd1, hwnd1, hwnd2);
 
-    ReleaseCapture();
+    ret = ReleaseCapture();
+    ok (ret, "releasecapture did not return TRUE.\n");
+    ret = ReleaseCapture();
+    ok (ret, "releasecapture did not return TRUE after second try.\n");
 }
 
 static void test_keyboard_input(HWND hwnd)



More information about the wine-patches mailing list