[PATCH 3/5] user32: Modify SCROLL_MovingThumb outside of SCROLL_DrawMovingThumb().

Zhiyi Zhang zzhang at codeweavers.com
Mon Jul 5 07:31:13 CDT 2021


SCROLL_MovingThumb is a global variable. Gradually move it out of scroll bar drawing functions so
that those drawing functions can be refactored in a way that doesn't need access to global variables.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/user32/scroll.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 85485eede57..9113d57263b 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -484,8 +484,6 @@ static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical,
 
   SCROLL_DrawInterior( SCROLL_TrackingWin, hdc, SCROLL_TrackingBar, rect, arrowSize, thumbSize, pos,
                        0, vertical, FALSE, FALSE );
-
-  SCROLL_MovingThumb = !SCROLL_MovingThumb;
 }
 
 /***********************************************************************
@@ -625,6 +623,7 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
         if (SCROLL_MovingThumb && SCROLL_TrackingWin == hwnd && SCROLL_TrackingBar == nBar)
         {
             SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize, thumbSize );
+            SCROLL_MovingThumb = FALSE;
         }
         else
         {
@@ -867,7 +866,10 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
                                                         vertical,
                                                         SCROLL_TrackingPos );
 	    if (!SCROLL_MovingThumb)
+            {
 		SCROLL_DrawMovingThumb(hdc, &rect, vertical, arrowSize, thumbSize);
+                SCROLL_MovingThumb = TRUE;
+            }
         }
         else if (msg == WM_LBUTTONUP)
         {
-- 
2.30.2




More information about the wine-devel mailing list