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

Sébastien Ramage sebastien.ramage at gmail.com
Wed Mar 24 08:30:00 CDT 2010


Attached the new patch

2010/3/23 Paul Vriens <paul.vriens.wine at gmail.com>

On 03/23/2010 02:08 PM, Sébastien Ramage wrote:
>
>> Fixes bug #16595
>> ---
>> dlls/user32/scroll.c | 5 +----
>> dlls/user32/tests/scroll.c | 17 ++++++++++++++++-
>> 2 files changed, 17 insertions(+), 5 deletions(-)
>>
>
> Hi Sébastien
>
> Can comment too much on the patch but this patch doesn't apply cleanly to
> current Git. Please make sure that all patches are based on top of current.
>
>
>
>> 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);
>> }
>>
>
> While you're at it please add a space before the '&&'.
>
> --
> Cheers,
>
> Paul.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100324/72d89726/attachment.htm>
-------------- next part --------------
From 79b1203348ad93e8bc2b6b03ca548788b108a742 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?S=C3=A9bastien=20Ramage?= <sebastien.ramage at gmail.com>
Date: Wed, 24 Mar 2010 14:22:43 +0100
Subject: Fixe bug #16595

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

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..5e50dd0 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -43,12 +43,28 @@ static LRESULT CALLBACK MyWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
         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)
 {
     BOOL ret;
@@ -415,11 +431,12 @@ START_TEST ( scroll )
     if (!hMainWnd) return;
 
     assert( hScroll );
-
+  
     scrollbar_test1();
     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-patches mailing list