[PATCH] user32: end scrollbar tracking if the mouse capture is lost (retry)

Sébastien Ramage sebastien.ramage at gmail.com
Thu Mar 25 03:56:32 CDT 2010


> You have DOS line endings in your patch. A simple dos2unix fixes this.
>
> Thank you
Attached the patch with unix line endings
Seb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20100325/9d2dbd62/attachment.htm>
-------------- next part --------------
From 44bf3ca4f53864d70d6ae89ec705db83e51e9796 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?S=C3=A9bastien=20Ramage?= <sebastien.ramage at gmail.com>
Date: Thu, 25 Mar 2010 09:00:29 +0100
Subject: [PATCH] user32: end scrollbar tracking if the mouse capture is lost
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.6.3.3"

This is a multi-part message in MIME format.
--------------1.6.3.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 dlls/user32/scroll.c       |    5 +----
 dlls/user32/tests/scroll.c |   16 +++++++++++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)


--------------1.6.3.3
Content-Type: text/x-patch; name="0001-PATCH-user32-end-scrollbar-tracking-if-the-mouse-captu.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-PATCH-user32-end-scrollbar-tracking-if-the-mouse-captu.txt"

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 423dea1..ab21489 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -1125,11 +1125,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 0695639..e3f6938 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -42,12 +42,25 @@ 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, MAKELPARAM( 1, 1));
+    /* 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)
 {
@@ -420,6 +433,7 @@ START_TEST ( scroll )
     scrollbar_test2();
     scrollbar_test3();
     scrollbar_test4();
+    scrollbar_test_track();
 
     /* Some test results vary depending of theming being active or not */
     hUxtheme = LoadLibraryA("uxtheme.dll");

--------------1.6.3.3--



More information about the wine-devel mailing list