Jacek Caban : win32u: Move NtUserShowScrollBar implementation from user32.
Alexandre Julliard
julliard at winehq.org
Mon Jul 4 16:42:26 CDT 2022
Module: wine
Branch: master
Commit: b4ba6de6e135ca5003926b424c616a9872bb5377
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b4ba6de6e135ca5003926b424c616a9872bb5377
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Jun 28 13:22:35 2022 +0200
win32u: Move NtUserShowScrollBar implementation from user32.
---
dlls/user32/listbox.c | 2 +-
dlls/user32/mdi.c | 4 +--
dlls/user32/scroll.c | 25 --------------
dlls/user32/user32.spec | 2 +-
dlls/win32u/Makefile.in | 1 +
dlls/win32u/gdiobj.c | 1 +
dlls/win32u/scroll.c | 80 ++++++++++++++++++++++++++++++++++++++++++++
dlls/win32u/win32u.spec | 2 +-
dlls/win32u/win32u_private.h | 1 +
dlls/win32u/wrappers.c | 6 ++++
include/ntuser.h | 1 +
11 files changed, 95 insertions(+), 30 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 1e7231b4c05..b8b683e6e3c 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -395,7 +395,7 @@ static void LISTBOX_UpdateScroll( LB_DESCR *descr )
}
else
{
- ShowScrollBar( descr->self, SB_HORZ, FALSE );
+ NtUserShowScrollBar( descr->self, SB_HORZ, FALSE );
}
}
}
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index 11c17a6dbd8..fbac63dd881 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -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)
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index b6f15b4a295..d7972e2c6e8 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -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.@)
*
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index e1cc18f7287..ce8365b1336 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -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
diff --git a/dlls/win32u/Makefile.in b/dlls/win32u/Makefile.in
index 13b329b0233..153f5f45d9f 100644
--- a/dlls/win32u/Makefile.in
+++ b/dlls/win32u/Makefile.in
@@ -45,6 +45,7 @@ C_SRCS = \
printdrv.c \
rawinput.c \
region.c \
+ scroll.c \
spy.c \
syscall.c \
sysparams.c \
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index 9d95d3cf94a..d843716e4c0 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -1236,6 +1236,7 @@ static struct unix_funcs unix_funcs =
NtUserSetWindowWord,
NtUserShowCaret,
NtUserShowCursor,
+ NtUserShowScrollBar,
NtUserShowWindow,
NtUserShowWindowAsync,
NtUserSystemParametersInfo,
diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c
new file mode 100644
index 00000000000..380ce5fc75b
--- /dev/null
+++ b/dlls/win32u/scroll.c
@@ -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;
+}
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 68201f763ab..428e8aadf1c 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -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)
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index d3f359fd4ee..00bc3e16828 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -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 );
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index b451e57e3b1..e7ab66cadcb 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -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;
diff --git a/include/ntuser.h b/include/ntuser.h
index 3862eb55054..2f6b8863228 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -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 );
More information about the wine-cvs
mailing list