Subject: user32: end scrollbar tracking if the mouse capture is lost (try 2).

Rein Klazes wijn at online.nl
Thu Apr 30 01:06:51 CDT 2009


try 2: fix a typo in the test.

Fixes bug #16595
---
 dlls/user32/scroll.c       |    5 +----
 dlls/user32/tests/scroll.c |   17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 93f85f2..91adb74 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -1105,11 +1105,8 @@ void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
             DispatchMessageW( &msg );
         }
         if (!IsWindow( hwnd ))
-        {
             ReleaseCapture();
-            break;
-        }
-    } while (msg.message != WM_LBUTTONUP);
+    } while (msg.message != WM_LBUTTONUP && GetCapture() == hwnd);
 }
 
 
diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c
index 0c36ff8..dee57a1 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -41,13 +41,27 @@ static LRESULT CALLBACK MyWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
     case WM_DESTROY:
         PostQuitMessage(0);
         break;
-
+    case WM_HSCROLL:
+    case WM_VSCROLL:
+        /* stop tracking */
+        ReleaseCapture();
+        return 0;
     default:
         return DefWindowProcA(hWnd, msg, wParam, lParam);
     }
     return 0;
 }
 
+static void scrollbar_test_track(void)
+{
+    /* test that scrollbar tracking is terminated when
+     * the control looses mouse capture */
+    SendMessage( hScroll, WM_LBUTTONDOWN, 0, 0x10001);
+    /* a normal return from the sendmessage */
+    /* not normal for instance by closing the windws */
+    ok( IsWindow( hScroll), "Scrollbar has gone!\n");
+}
+
 static void scrollbar_test1(void)
 {
     BOOL ret;
@@ -353,6 +367,7 @@ START_TEST ( scroll )
 
     assert( hScroll );
 
+    scrollbar_test_track();
     scrollbar_test1();
     scrollbar_test2();
     scrollbar_test3();
-- 
1.6.2.1




More information about the wine-patches mailing list