Jacek Caban : win32u: Move ShowOwnedPopups implementation from user32.
Alexandre Julliard
julliard at winehq.org
Fri Apr 15 15:23:16 CDT 2022
Module: wine
Branch: master
Commit: bed878dd2b88cff039b5659739e801606ee7df4b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bed878dd2b88cff039b5659739e801606ee7df4b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Apr 15 14:54:04 2022 +0200
win32u: Move ShowOwnedPopups implementation from user32.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/win.c | 33 ++-------------------------------
dlls/win32u/window.c | 39 +++++++++++++++++++++++++++++++++++++++
include/ntuser.h | 6 ++++++
3 files changed, 47 insertions(+), 31 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index d44f058d256..8640ad5a473 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1283,38 +1283,9 @@ HWND WINAPI GetWindow( HWND hwnd, UINT rel )
/*******************************************************************
* ShowOwnedPopups (USER32.@)
*/
-BOOL WINAPI ShowOwnedPopups( HWND owner, BOOL fShow )
+BOOL WINAPI ShowOwnedPopups( HWND owner, BOOL show )
{
- int count = 0;
- HWND *win_array = WIN_ListChildren( GetDesktopWindow() );
-
- if (!win_array) return TRUE;
-
- while (win_array[count]) count++;
- while (--count >= 0)
- {
- if (GetWindow( win_array[count], GW_OWNER ) != owner) continue;
- if (fShow)
- {
- if (win_get_flags( win_array[count] ) & WIN_NEEDS_SHOW_OWNEDPOPUP)
- /* In Windows, ShowOwnedPopups(TRUE) generates
- * WM_SHOWWINDOW messages with SW_PARENTOPENING,
- * regardless of the state of the owner
- */
- SendMessageW(win_array[count], WM_SHOWWINDOW, SW_SHOWNORMAL, SW_PARENTOPENING);
- }
- else
- {
- if (GetWindowLongW( win_array[count], GWL_STYLE ) & WS_VISIBLE)
- /* In Windows, ShowOwnedPopups(FALSE) generates
- * WM_SHOWWINDOW messages with SW_PARENTCLOSING,
- * regardless of the state of the owner
- */
- SendMessageW(win_array[count], WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING);
- }
- }
- HeapFree( GetProcessHeap(), 0, win_array );
- return TRUE;
+ return NtUserShowOwnedPopups( owner, show );
}
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 9e3b085ac32..49813aa2ad3 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -4237,6 +4237,42 @@ BOOL WINAPI NtUserShowWindow( HWND hwnd, INT cmd )
return send_message( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
}
+/* see ShowOwnedPopups */
+static BOOL show_owned_popups( HWND owner, BOOL show )
+{
+ int count = 0;
+ HWND *win_array = list_window_children( 0, get_desktop_window(), NULL, 0 );
+
+ if (!win_array) return TRUE;
+
+ while (win_array[count]) count++;
+ while (--count >= 0)
+ {
+ if (get_window_relative( win_array[count], GW_OWNER ) != owner) continue;
+ if (show)
+ {
+ if (win_get_flags( win_array[count] ) & WIN_NEEDS_SHOW_OWNEDPOPUP)
+ /* In Windows, ShowOwnedPopups(TRUE) generates
+ * WM_SHOWWINDOW messages with SW_PARENTOPENING,
+ * regardless of the state of the owner
+ */
+ send_message( win_array[count], WM_SHOWWINDOW, SW_SHOWNORMAL, SW_PARENTOPENING );
+ }
+ else
+ {
+ if (get_window_long( win_array[count], GWL_STYLE ) & WS_VISIBLE)
+ /* In Windows, ShowOwnedPopups(FALSE) generates
+ * WM_SHOWWINDOW messages with SW_PARENTCLOSING,
+ * regardless of the state of the owner
+ */
+ send_message( win_array[count], WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING );
+ }
+ }
+
+ free( win_array );
+ return TRUE;
+}
+
/*******************************************************************
* NtUserFlashWindowEx (win32u.@)
*/
@@ -5198,6 +5234,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
case NtUserCallHwndParam_SetWindowPixelFormat:
return set_window_pixel_format( hwnd, param );
+ case NtUserCallHwndParam_ShowOwnedPopups:
+ return show_owned_popups( hwnd, param );
+
/* temporary exports */
case NtUserIsWindowDrawable:
return is_window_drawable( hwnd, param );
diff --git a/include/ntuser.h b/include/ntuser.h
index 79ea57590bf..61ee94f7a5c 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -875,6 +875,7 @@ enum
NtUserCallHwndParam_ScreenToClient,
NtUserCallHwndParam_SetForegroundWindow,
NtUserCallHwndParam_SetWindowPixelFormat,
+ NtUserCallHwndParam_ShowOwnedPopups,
/* temporary exports */
NtUserIsWindowDrawable,
NtUserSetCaptureWindow,
@@ -1034,4 +1035,9 @@ static inline BOOL NtUserSetWindowPixelFormat( HWND hwnd, int format )
return NtUserCallHwndParam( hwnd, format, NtUserCallHwndParam_SetWindowPixelFormat );
}
+static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show )
+{
+ return NtUserCallHwndParam( hwnd, show, NtUserCallHwndParam_ShowOwnedPopups );
+}
+
#endif /* _NTUSER_ */
More information about the wine-cvs
mailing list