Module: wine Branch: master Commit: c8f1d41183c38bb07518c6e79229a82ad89ffc51 URL: https://gitlab.winehq.org/wine/wine/-/commit/c8f1d41183c38bb07518c6e79229a82...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Dec 9 12:44:53 2022 +0100
win32u: Move NtUserSetShellWindowEx implementation from user32.
---
dlls/user32/focus.c | 47 ++--------------------------------------------- dlls/user32/user32.spec | 2 +- dlls/win32u/input.c | 42 ++++++++++++++++++++++++++++++++++++++++++ dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 8 ++++++++ include/ntuser.h | 3 ++- 8 files changed, 58 insertions(+), 48 deletions(-)
diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c index e79f6f68dc2..53802f98b1a 100644 --- a/dlls/user32/focus.c +++ b/dlls/user32/focus.c @@ -55,55 +55,12 @@ HWND WINAPI GetFocus(void) }
-/*********************************************************************** -* SetShellWindowEx (USER32.@) -* hwndShell = Progman[Program Manager] -* |-> SHELLDLL_DefView -* hwndListView = | |-> SysListView32 -* | | |-> tooltips_class32 -* | | -* | |-> SysHeader32 -* | -* |-> ProxyTarget -*/ -BOOL WINAPI SetShellWindowEx(HWND hwndShell, HWND hwndListView) -{ - BOOL ret; - - if (GetShellWindow()) - return FALSE; - - if (GetWindowLongW(hwndShell, GWL_EXSTYLE) & WS_EX_TOPMOST) - return FALSE; - - if (hwndListView != hwndShell) - if (GetWindowLongW(hwndListView, GWL_EXSTYLE) & WS_EX_TOPMOST) - return FALSE; - - if (hwndListView && hwndListView!=hwndShell) - NtUserSetWindowPos( hwndListView, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE ); - - NtUserSetWindowPos( hwndShell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE ); - - SERVER_START_REQ(set_global_windows) - { - req->flags = SET_GLOBAL_SHELL_WINDOWS; - req->shell_window = wine_server_user_handle( hwndShell ); - req->shell_listview = wine_server_user_handle( hwndListView ); - ret = !wine_server_call_err(req); - } - SERVER_END_REQ; - - return ret; -} - - /******************************************************************* * SetShellWindow (USER32.@) */ -BOOL WINAPI SetShellWindow(HWND hwndShell) +BOOL WINAPI SetShellWindow( HWND hwnd ) { - return SetShellWindowEx(hwndShell, hwndShell); + return NtUserSetShellWindowEx( hwnd, hwnd ); }
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index d9cf610b470..1628c7ca74a 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -708,7 +708,7 @@ @ stdcall SetScrollPos(long long long long) @ stdcall SetScrollRange(long long long long long) @ stdcall SetShellWindow(long) -@ stdcall SetShellWindowEx (long long) +@ stdcall SetShellWindowEx(long long) NtUserSetShellWindowEx @ stdcall SetSysColors(long ptr ptr) NtUserSetSysColors @ stdcall SetSysColorsTemp(ptr ptr long) @ stdcall SetSystemCursor(long long) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index fb87d6395d3..66fbd0746ae 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2165,3 +2165,45 @@ HWND get_shell_window(void)
return hwnd; } + +/*********************************************************************** +* NtUserSetShellWindowEx (win32u.@) +*/ +BOOL WINAPI NtUserSetShellWindowEx( HWND shell, HWND list_view ) +{ + BOOL ret; + + /* shell = Progman[Program Manager] + * |-> SHELLDLL_DefView + * list_view = | |-> SysListView32 + * | | |-> tooltips_class32 + * | | + * | |-> SysHeader32 + * | + * |-> ProxyTarget + */ + + if (get_shell_window()) + return FALSE; + + if (get_window_long( shell, GWL_EXSTYLE ) & WS_EX_TOPMOST) + return FALSE; + + if (list_view != shell && (get_window_long( list_view, GWL_EXSTYLE ) & WS_EX_TOPMOST)) + return FALSE; + + if (list_view && list_view != shell) + NtUserSetWindowPos( list_view, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); + + NtUserSetWindowPos( shell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); + + SERVER_START_REQ(set_global_windows) + { + req->flags = SET_GLOBAL_SHELL_WINDOWS; + req->shell_window = wine_server_user_handle( shell ); + req->shell_listview = wine_server_user_handle( list_view ); + ret = !wine_server_call_err(req); + } + SERVER_END_REQ; + return ret; +} diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index cfe2961c45d..32812a3d881 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -273,6 +273,7 @@ static void * const syscalls[] = NtUserSetProcessWindowStation, NtUserSetProp, NtUserSetScrollInfo, + NtUserSetShellWindowEx, NtUserSetSysColors, NtUserSetSystemMenu, NtUserSetSystemTimer, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index af70ad7d3e5..c3ed3c0559a 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1226,7 +1226,7 @@ @ stdcall -syscall NtUserSetScrollInfo(long long ptr long) @ stub NtUserSetSensorPresence @ stub NtUserSetSharedWindowData -@ stub NtUserSetShellWindowEx +@ stdcall -syscall NtUserSetShellWindowEx(long long) @ stdcall -syscall NtUserSetSysColors(long ptr ptr) @ stub NtUserSetSystemCursor @ stdcall -syscall NtUserSetSystemMenu(long long) diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index e84d4dd60c6..ecf79f69cce 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -259,6 +259,7 @@ SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \ SYSCALL_ENTRY( NtUserSetProp ) \ SYSCALL_ENTRY( NtUserSetScrollInfo ) \ + SYSCALL_ENTRY( NtUserSetShellWindowEx ) \ SYSCALL_ENTRY( NtUserSetSysColors ) \ SYSCALL_ENTRY( NtUserSetSystemMenu ) \ SYSCALL_ENTRY( NtUserSetSystemTimer ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 0841119c2d6..4ce8c94c1af 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3624,6 +3624,14 @@ NTSTATUS WINAPI wow64_NtUserSetScrollInfo( UINT *args ) return NtUserSetScrollInfo( hwnd, bar, info, redraw ); }
+NTSTATUS WINAPI wow64_NtUserSetShellWindowEx( UINT *args ) +{ + HWND shell = get_handle( &args ); + HWND list_view = get_handle( &args ); + + return NtUserSetShellWindowEx( shell, list_view ); +} + NTSTATUS WINAPI wow64_NtUserSetSysColors( UINT *args ) { INT count = get_ulong( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 94d5326fc6e..7a44f4b0b15 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -803,7 +803,6 @@ DWORD WINAPI NtUserMsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *han DWORD timeout, DWORD mask, DWORD flags ); void WINAPI NtUserNotifyWinEvent( DWORD event, HWND hwnd, LONG object_id, LONG child_id ); HWINSTA WINAPI NtUserOpenWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK access ); -BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DWORD len ); BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk ); HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access ); HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access ); @@ -849,11 +848,13 @@ BOOL WINAPI NtUserSetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE a BOOL WINAPI NtUserSetMenu( HWND hwnd, HMENU menu ); BOOL WINAPI NtUserSetMenuContextHelpId( HMENU handle, DWORD id ); BOOL WINAPI NtUserSetMenuDefaultItem( HMENU handle, UINT item, UINT bypos ); +BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DWORD len ); HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ); BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown ); BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle ); BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle ); INT WINAPI NtUserSetScrollInfo( HWND hwnd, INT bar, const SCROLLINFO *info, BOOL redraw ); +BOOL WINAPI NtUserSetShellWindowEx( HWND shell, HWND list_view ); BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values ); BOOL WINAPI NtUserSetSystemMenu( HWND hwnd, HMENU menu ); UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout );