win32u: Move NtUserShowScrollBar implementation from user32.

This commit is contained in:
Jacek Caban 2022-06-28 13:22:35 +02:00 committed by Alexandre Julliard
parent f3c36f7256
commit b4ba6de6e1
11 changed files with 95 additions and 30 deletions

View file

@ -395,7 +395,7 @@ static void LISTBOX_UpdateScroll( LB_DESCR *descr )
}
else
{
ShowScrollBar( descr->self, SB_HORZ, FALSE );
NtUserShowScrollBar( descr->self, SB_HORZ, FALSE );
}
}
}

View file

@ -1158,7 +1158,7 @@ LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_MDITILE:
ci->mdiFlags |= MDIF_NEEDUPDATE;
ShowScrollBar( hwnd, SB_BOTH, FALSE );
NtUserShowScrollBar( hwnd, SB_BOTH, FALSE );
MDITile( hwnd, ci, wParam );
ci->mdiFlags &= ~MDIF_NEEDUPDATE;
return 0;
@ -1701,7 +1701,7 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
if (style & WS_MAXIMIZE)
{
HeapFree( GetProcessHeap(), 0, list );
ShowScrollBar( hwnd, SB_BOTH, FALSE );
NtUserShowScrollBar( hwnd, SB_BOTH, FALSE );
return;
}
if (style & WS_VISIBLE)

View file

@ -2003,31 +2003,6 @@ static BOOL SCROLL_ShowScrollBar( HWND hwnd, INT nBar, BOOL fShowH, BOOL fShowV
}
/*************************************************************************
* ShowScrollBar (USER32.@)
*
* Shows or hides the scroll bar.
*
* PARAMS
* hwnd [I] Handle of window with scrollbar(s)
* nBar [I] One of SB_HORZ, SB_VERT, or SB_CTL
* fShow [I] TRUE = show, FALSE = hide
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI DECLSPEC_HOTPATCH ShowScrollBar(HWND hwnd, INT nBar, BOOL fShow)
{
if ( !hwnd )
return FALSE;
SCROLL_ShowScrollBar( hwnd, nBar, (nBar == SB_VERT) ? 0 : fShow,
(nBar == SB_HORZ) ? 0 : fShow );
return TRUE;
}
/*************************************************************************
* EnableScrollBar (USER32.@)
*

View file

@ -739,7 +739,7 @@
@ stdcall ShowCaret(long) NtUserShowCaret
@ stdcall -import ShowCursor(long) NtUserShowCursor
@ stdcall ShowOwnedPopups(long long)
@ stdcall ShowScrollBar(long long long)
@ stdcall ShowScrollBar(long long long) NtUserShowScrollBar
@ stub ShowStartGlass
@ stdcall ShowWindow(long long) NtUserShowWindow
@ stdcall ShowWindowAsync(long long) NtUserShowWindowAsync

View file

@ -45,6 +45,7 @@ C_SRCS = \
printdrv.c \
rawinput.c \
region.c \
scroll.c \
spy.c \
syscall.c \
sysparams.c \

View file

@ -1236,6 +1236,7 @@ static struct unix_funcs unix_funcs =
NtUserSetWindowWord,
NtUserShowCaret,
NtUserShowCursor,
NtUserShowScrollBar,
NtUserShowWindow,
NtUserShowWindowAsync,
NtUserSystemParametersInfo,

80
dlls/win32u/scroll.c Normal file
View file

@ -0,0 +1,80 @@
/*
* Scrollbar control
*
* Copyright 1993 Martin Ayotte
* Copyright 1994, 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#include "win32u_private.h"
#include "ntuser_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(scroll);
static BOOL show_scroll_bar( HWND hwnd, int bar, BOOL show_horz, BOOL show_vert )
{
ULONG old_style, set_bits = 0, clear_bits = 0;
TRACE( "hwnd=%p bar=%d horz=%d, vert=%d\n", hwnd, bar, show_horz, show_vert );
switch (bar)
{
case SB_CTL:
NtUserShowWindow( hwnd, show_horz ? SW_SHOW : SW_HIDE );
return TRUE;
case SB_BOTH:
case SB_HORZ:
if (show_horz) set_bits |= WS_HSCROLL;
else clear_bits |= WS_HSCROLL;
if (bar == SB_HORZ) break;
/* fall through */
case SB_VERT:
if (show_vert) set_bits |= WS_VSCROLL;
else clear_bits |= WS_VSCROLL;
break;
default:
return FALSE; /* Nothing to do! */
}
old_style = set_window_style( hwnd, set_bits, clear_bits );
if ((old_style & clear_bits) != 0 || (old_style & set_bits) != set_bits)
{
/* frame has been changed, let the window redraw itself */
NtUserSetWindowPos( hwnd, 0, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
return TRUE;
}
return FALSE; /* no frame changes */
}
/*************************************************************************
* NtUserShowScrollBar (win32u.@)
*/
BOOL WINAPI NtUserShowScrollBar( HWND hwnd, INT bar, BOOL show )
{
if (!hwnd) return FALSE;
show_scroll_bar( hwnd, bar, bar == SB_VERT ? 0 : show, bar == SB_HORZ ? 0 : show );
return TRUE;
}

View file

@ -1259,7 +1259,7 @@
@ stdcall -syscall NtUserSetWindowsHookEx(ptr ptr long long ptr long)
@ stdcall NtUserShowCaret(long)
@ stdcall NtUserShowCursor(long)
@ stub NtUserShowScrollBar
@ stdcall NtUserShowScrollBar(long long long)
@ stub NtUserShowSystemCursor
@ stdcall NtUserShowWindow(long long)
@ stdcall NtUserShowWindowAsync(long long)

View file

@ -310,6 +310,7 @@ struct unix_funcs
WORD (WINAPI *pNtUserSetWindowWord)( HWND hwnd, INT offset, WORD newval );
BOOL (WINAPI *pNtUserShowCaret)( HWND hwnd );
INT (WINAPI *pNtUserShowCursor)( BOOL show );
BOOL (WINAPI *pNtUserShowScrollBar)( HWND hwnd, INT bar, BOOL show );
BOOL (WINAPI *pNtUserShowWindow)( HWND hwnd, INT cmd );
BOOL (WINAPI *pNtUserShowWindowAsync)( HWND hwnd, INT cmd );
BOOL (WINAPI *pNtUserSystemParametersInfo)( UINT action, UINT val, PVOID ptr, UINT winini );

View file

@ -1334,6 +1334,12 @@ INT WINAPI NtUserShowCursor( BOOL show )
return unix_funcs->pNtUserShowCursor( show );
}
BOOL WINAPI NtUserShowScrollBar( HWND hwnd, INT bar, BOOL show )
{
if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserShowScrollBar( hwnd, bar, show );
}
BOOL WINAPI NtUserShowWindowAsync( HWND hwnd, INT cmd )
{
if (!unix_funcs) return FALSE;

View file

@ -718,6 +718,7 @@ HWINEVENTHOOK WINAPI NtUserSetWinEventHook( DWORD event_min, DWORD event_max, HM
DWORD pid, DWORD tid, DWORD flags );
BOOL WINAPI NtUserShowCaret( HWND hwnd );
INT WINAPI NtUserShowCursor( BOOL show );
BOOL WINAPI NtUserShowScrollBar( HWND hwnd, INT bar, BOOL show );
BOOL WINAPI NtUserShowWindow( HWND hwnd, INT cmd );
BOOL WINAPI NtUserShowWindowAsync( HWND hwnd, INT cmd );
BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT winini );