This fixes a regression from bb496ea8. Also closer mimics windows behavior, moving the mouse should not reset the scrolling timer.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56582
-- v2: win32u: Only set scroll timer if it's not running win32u: Refactor out scroll timer handling
From: Fabian Maurer dark.shadow4@web.de
--- dlls/win32u/scroll.c | 65 +++++++++++++------------------------------- 1 file changed, 19 insertions(+), 46 deletions(-)
diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index f72ef0c2929..7297e18e17d 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -512,6 +512,21 @@ static POINT clip_scroll_pos( RECT *rect, POINT pt ) return pt; }
+void update_scroll_timer(HWND hwnd, HWND owner_hwnd, HWND ctl_hwnd, enum SCROLL_HITTEST hittest, UINT msg, UINT msg_send, BOOL vertical ) +{ + if (hittest == g_tracking_info.hit_test) + { + if (msg == WM_LBUTTONDOWN || msg == WM_SYSTIMER) + { + send_message( owner_hwnd, vertical ? WM_VSCROLL : WM_HSCROLL, msg_send, (LPARAM)ctl_hwnd ); + } + + NtUserSetSystemTimer( hwnd, SCROLL_TIMER, + msg == WM_LBUTTONDOWN ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); + } + else NtUserKillSystemTimer( hwnd, SCROLL_TIMER ); +} + /*********************************************************************** * handle_scroll_event * @@ -681,33 +696,12 @@ void handle_scroll_event( HWND hwnd, int bar, UINT msg, POINT pt )
case SCROLL_TOP_ARROW: draw_scroll_bar( hwnd, hdc, bar, hittest, &g_tracking_info, TRUE, FALSE ); - if (hittest == g_tracking_info.hit_test) - { - if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER)) - { - send_message( owner_hwnd, vertical ? WM_VSCROLL : WM_HSCROLL, - SB_LINEUP, (LPARAM)ctl_hwnd ); - } - - NtUserSetSystemTimer( hwnd, SCROLL_TIMER, - msg == WM_LBUTTONDOWN ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); - } - else NtUserKillSystemTimer( hwnd, SCROLL_TIMER ); + update_scroll_timer( hwnd, owner_hwnd, ctl_hwnd, hittest, msg, SB_LINEUP, vertical); break;
case SCROLL_TOP_RECT: draw_scroll_bar( hwnd, hdc, bar, hittest, &g_tracking_info, FALSE, TRUE ); - if (hittest == g_tracking_info.hit_test) - { - if (msg == WM_LBUTTONDOWN || msg == WM_SYSTIMER) - { - send_message( owner_hwnd, vertical ? WM_VSCROLL : WM_HSCROLL, - SB_PAGEUP, (LPARAM)ctl_hwnd ); - } - NtUserSetSystemTimer( hwnd, SCROLL_TIMER, - msg == WM_LBUTTONDOWN ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); - } - else NtUserKillSystemTimer( hwnd, SCROLL_TIMER ); + update_scroll_timer( hwnd, owner_hwnd, ctl_hwnd, hittest, msg, SB_PAGEUP, vertical); break;
case SCROLL_THUMB: @@ -755,33 +749,12 @@ void handle_scroll_event( HWND hwnd, int bar, UINT msg, POINT pt )
case SCROLL_BOTTOM_RECT: draw_scroll_bar( hwnd, hdc, bar, hittest, &g_tracking_info, FALSE, TRUE ); - if (hittest == g_tracking_info.hit_test) - { - if (msg == WM_LBUTTONDOWN || msg == WM_SYSTIMER) - { - send_message( owner_hwnd, vertical ? WM_VSCROLL : WM_HSCROLL, - SB_PAGEDOWN, (LPARAM)ctl_hwnd ); - } - NtUserSetSystemTimer( hwnd, SCROLL_TIMER, - msg == WM_LBUTTONDOWN ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); - } - else NtUserKillSystemTimer( hwnd, SCROLL_TIMER ); + update_scroll_timer( hwnd, owner_hwnd, ctl_hwnd, hittest, msg, SB_PAGEDOWN, vertical); break;
case SCROLL_BOTTOM_ARROW: draw_scroll_bar( hwnd, hdc, bar, hittest, &g_tracking_info, TRUE, FALSE ); - if (hittest == g_tracking_info.hit_test) - { - if (msg == WM_LBUTTONDOWN || msg == WM_SYSTIMER) - { - send_message( owner_hwnd, vertical ? WM_VSCROLL : WM_HSCROLL, - SB_LINEDOWN, (LPARAM)ctl_hwnd ); - } - - NtUserSetSystemTimer( hwnd, SCROLL_TIMER, - msg == WM_LBUTTONDOWN ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); - } - else NtUserKillSystemTimer( hwnd, SCROLL_TIMER ); + update_scroll_timer( hwnd, owner_hwnd, ctl_hwnd, hittest, msg, SB_LINEDOWN, vertical); break; }
From: Fabian Maurer dark.shadow4@web.de
This fixes a regression from bb496ea8 where we got a WM_MOUSEMOVE and this leads to skipping the initial scroll delay. Also closer mimics windows behavior, moving the mouse should not reset the scrolling timer.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56582 --- dlls/win32u/scroll.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index 7297e18e17d..ed07ec74557 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -62,6 +62,9 @@ static struct SCROLL_TRACKING_INFO g_tracking_info; /* Is the moving thumb being displayed? */ static BOOL scroll_moving_thumb = FALSE;
+/* is there currently a running timer for scrolling delay ?*/ +static BOOL scroll_timer_running = FALSE; + /* data for window that has (one or two) scroll bars */ struct win_scroll_bar_info { @@ -519,12 +522,21 @@ void update_scroll_timer(HWND hwnd, HWND owner_hwnd, HWND ctl_hwnd, enum SCROLL_ if (msg == WM_LBUTTONDOWN || msg == WM_SYSTIMER) { send_message( owner_hwnd, vertical ? WM_VSCROLL : WM_HSCROLL, msg_send, (LPARAM)ctl_hwnd ); + scroll_timer_running = FALSE; }
- NtUserSetSystemTimer( hwnd, SCROLL_TIMER, - msg == WM_LBUTTONDOWN ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); + if (!scroll_timer_running) + { + scroll_timer_running = TRUE; + NtUserSetSystemTimer( hwnd, SCROLL_TIMER, + msg == WM_LBUTTONDOWN ? SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); + } + } + else + { + scroll_timer_running = FALSE; + NtUserKillSystemTimer( hwnd, SCROLL_TIMER ); } - else NtUserKillSystemTimer( hwnd, SCROLL_TIMER ); }
/*********************************************************************** @@ -789,6 +801,7 @@ void handle_scroll_event( HWND hwnd, int bar, UINT msg, POINT pt ) /* Terminate tracking */ g_tracking_info.win = 0; scroll_moving_thumb = FALSE; + scroll_timer_running = FALSE; hittest = SCROLL_NOWHERE; draw_scroll_bar( hwnd, hdc, bar, hittest, &g_tracking_info, TRUE, TRUE ); }
On Wed May 15 19:37:07 2024 +0000, Fabian Maurer wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/5634/diffs?diff_id=113859&start_sha=67fe6eda0d146138a6aadb17543b91b455a72cc2#1309fd48153be56cdd4228d6e4bc8022a837b2de_695_711)
What MOUSEENTER message do you mean? I'm not aware of such a message.
I pushed an update that should address the issue, using a static variable analog to scroll_moving_thumb.