user32: Separate scroll bar window checks from actual drawing.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-07-06 15:07:55 +08:00 committed by Alexandre Julliard
parent cead75ad56
commit 09f43e0491
1 changed files with 14 additions and 8 deletions

View File

@ -562,15 +562,10 @@ static void SCROLL_DoDrawScrollBar( HWND hwnd, HDC hdc, INT nBar, enum SCROLL_HI
BOOL interior, RECT *rect, INT arrowSize, INT thumbPos, BOOL interior, RECT *rect, INT arrowSize, INT thumbPos,
INT thumbSize, BOOL vertical ) INT thumbSize, BOOL vertical )
{ {
SCROLLBAR_INFO *infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, TRUE ); SCROLLBAR_INFO *infoPtr;
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
if (!(hwnd = WIN_GetFullHandle( hwnd ))) return; if (!(infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, TRUE )))
return;
if (!infoPtr ||
((nBar == SB_VERT) && !(style & WS_VSCROLL)) ||
((nBar == SB_HORZ) && !(style & WS_HSCROLL))) return;
if (!WIN_IsWindowDrawable( hwnd, FALSE )) return;
/* Draw the arrows */ /* Draw the arrows */
@ -625,8 +620,19 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT bar, enum SCROLL_HITTEST hit_
{ {
INT arrow_size, thumb_size, thumb_pos; INT arrow_size, thumb_size, thumb_pos;
BOOL vertical; BOOL vertical;
DWORD style;
RECT rect; RECT rect;
if (!(hwnd = WIN_GetFullHandle( hwnd )))
return;
style = GetWindowLongW( hwnd, GWL_STYLE );
if ((bar == SB_VERT && !(style & WS_VSCROLL)) || (bar == SB_HORZ && !(style & WS_HSCROLL)))
return;
if (!WIN_IsWindowDrawable( hwnd, FALSE ))
return;
SCROLL_GetScrollBarDrawInfo( hwnd, bar, tracking_info, &rect, &arrow_size, &thumb_size, SCROLL_GetScrollBarDrawInfo( hwnd, bar, tracking_info, &rect, &arrow_size, &thumb_size,
&thumb_pos, &vertical ); &thumb_pos, &vertical );
/* do not draw if the scrollbar rectangle is empty */ /* do not draw if the scrollbar rectangle is empty */