Having a SCROLL_DrawNCScrollBar() in scroll.c enables it to access global variables there. So that global variables access in SCROLL_DrawScrollBar() can be moved outside of it and SCROLL_DrawScrollBar() can then be refactored into a function without access to global variables.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/user32/controls.h | 1 + dlls/user32/nonclient.c | 6 +----- dlls/user32/scroll.c | 8 ++++++++ 3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index 0b0f1c28015..78b393fcddb 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -179,6 +179,7 @@ extern BOOL NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) DECLSPEC_HIDDEN; extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect ) DECLSPEC_HIDDEN;
/* scrollbar */ +extern void SCROLL_DrawNCScrollBar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ) DECLSPEC_HIDDEN; extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior ) DECLSPEC_HIDDEN; extern void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt ) DECLSPEC_HIDDEN;
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index e56c03deaf0..50ecb0c4e2e 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -1027,11 +1027,7 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip ) DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
/* Draw the scroll-bars */ - - if (dwStyle & WS_VSCROLL) - SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); - if (dwStyle & WS_HSCROLL) - SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); + SCROLL_DrawNCScrollBar( hwnd, hdc, dwStyle & WS_HSCROLL, dwStyle & WS_VSCROLL );
/* Draw the "size-box" */ if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL)) diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index 9113d57263b..5fc75ca42e7 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -646,6 +646,14 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, } }
+void SCROLL_DrawNCScrollBar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ) +{ + if (draw_horizontal) + SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); + if (draw_vertical) + SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); +} + /*********************************************************************** * SCROLL_DrawSizeGrip *
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=93633
Your paranoid android.
=== debiant2 (64 bit WoW report) ===
user32: win.c:10381: Test failed: Expected foreground window 0000000000150128, got 0000000000B500EA win.c:10383: Test failed: GetActiveWindow() = 0000000000000000 win.c:10383: Test failed: GetFocus() = 0000000000000000 win.c:10384: Test failed: Received WM_ACTIVATEAPP(1), did not expect it. win.c:10385: Test failed: Received WM_ACTIVATEAPP(0), did not expect it. win.c:10393: Test failed: Expected foreground window 0000000000150128, got 0000000000000000 win.c:10395: Test failed: GetActiveWindow() = 0000000000000000 win.c:10395: Test failed: GetFocus() = 0000000000000000 win.c:10403: Test failed: Received WM_ACTIVATEAPP(1), did not expect it.