[PATCH] user32/scroll: Fix tracking for non-client scrollbars
Gabriel Ivăncescu
gabrielopcode at gmail.com
Tue Dec 11 06:00:06 CST 2018
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>
---
This fixes, for example, SB_VERT scrollbars that have a non-client area
above them (like a title bar) so that when moving the mouse after clicking
(hot-tracking), they won't jump by the size of the title bar (which is
annoying).
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
--
2.19.1
More information about the wine-devel
mailing list