=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: user32: Fix tracking position for non-client scrollbars.

Alexandre Julliard julliard at winehq.org
Wed Dec 12 15:16:20 CST 2018


Module: wine
Branch: master
Commit: d2cf3e976370723cd009acafdc842fdcd2cb4b9d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d2cf3e976370723cd009acafdc842fdcd2cb4b9d

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Tue Dec 11 14:00:06 2018 +0200

user32: Fix tracking position for non-client scrollbars.

Non-client scrollbars (SB_HORZ and SB_VERT) don't have their client origin at
(0,0) because they can have non-client borders. It is necessary to offset
by this origin just as it is done for LBUTTONDOWN.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/scroll.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 95d9761..d611cf0 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -1095,15 +1095,17 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
 void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
 {
     MSG msg;
+    RECT rect;
 
     if (scrollbar != SB_CTL)
     {
-        RECT rect;
         WIN_GetRectangles( hwnd, COORDS_CLIENT, &rect, NULL );
         ScreenToClient( hwnd, &pt );
         pt.x -= rect.left;
         pt.y -= rect.top;
     }
+    else
+        rect.left = rect.top = 0;
 
     SCROLL_HandleScrollEvent( hwnd, scrollbar, WM_LBUTTONDOWN, pt );
 
@@ -1115,8 +1117,8 @@ void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
             msg.message == WM_MOUSEMOVE ||
             (msg.message == WM_SYSTIMER && msg.wParam == SCROLL_TIMER))
         {
-            pt.x = (short)LOWORD(msg.lParam);
-            pt.y = (short)HIWORD(msg.lParam);
+            pt.x = (short)LOWORD(msg.lParam) - rect.left;
+            pt.y = (short)HIWORD(msg.lParam) - rect.top;
             SCROLL_HandleScrollEvent( hwnd, scrollbar, msg.message, pt );
         }
         else




More information about the wine-cvs mailing list