Commit bed878dd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move ShowOwnedPopups implementation from user32.

parent a2dcfd1d
......@@ -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 );
}
......
......@@ -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 );
......
......@@ -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_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment