Commit 3ba583fd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Introduce NtUserActivateOtherWindow.

And use it instead of WINPOS_ActivateOtherWindow.
parent 803a5f07
......@@ -949,7 +949,7 @@ BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval )
if (owner)
SetForegroundWindow( owner );
else
WINPOS_ActivateOtherWindow( hwnd );
NtUserActivateOtherWindow( hwnd );
}
/* unblock dialog loop */
......
......@@ -35,8 +35,6 @@ extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN;
extern void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ) DECLSPEC_HIDDEN;
extern HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK access ) DECLSPEC_HIDDEN;
extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN;
static inline void mirror_rect( const RECT *window_rect, RECT *rect )
{
int width = window_rect->right - window_rect->left;
......
......@@ -242,68 +242,6 @@ BOOL WINAPI AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags)
}
/*******************************************************************
* can_activate_window
*
* Check if we can activate the specified window.
*/
static BOOL can_activate_window( HWND hwnd )
{
LONG style;
if (!hwnd) return FALSE;
style = GetWindowLongW( hwnd, GWL_STYLE );
if (!(style & WS_VISIBLE)) return FALSE;
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
return !(style & WS_DISABLED);
}
/*******************************************************************
* WINPOS_ActivateOtherWindow
*
* Activates window other than pWnd.
*/
void WINPOS_ActivateOtherWindow(HWND hwnd)
{
HWND hwndTo, fg;
if ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo = GetWindow( hwnd, GW_OWNER )))
{
hwndTo = NtUserGetAncestor( hwndTo, GA_ROOT );
if (can_activate_window( hwndTo )) goto done;
}
hwndTo = hwnd;
for (;;)
{
if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
if (can_activate_window( hwndTo )) goto done;
}
hwndTo = GetTopWindow( 0 );
for (;;)
{
if (hwndTo == hwnd)
{
hwndTo = 0;
break;
}
if (can_activate_window( hwndTo )) goto done;
if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
}
done:
fg = NtUserGetForegroundWindow();
TRACE("win = %p fg = %p\n", hwndTo, fg);
if (!fg || (hwnd == fg))
{
if (SetForegroundWindow( hwndTo )) return;
}
if (!NtUserSetActiveWindow( hwndTo )) NtUserSetActiveWindow( 0 );
}
/***********************************************************************
* BeginDeferWindowPos (USER32.@)
*/
......
......@@ -5364,6 +5364,10 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
{
switch (code)
{
case NtUserCallHwnd_ActivateOtherWindow:
activate_other_window( hwnd );
return 0;
case NtUserCallHwnd_ArrangeIconicWindows:
return arrange_iconic_windows( hwnd );
......
......@@ -1126,6 +1126,7 @@ static inline BOOL NtUserUnhookWindowsHook( INT id, HOOKPROC proc )
/* NtUserCallHwnd codes, not compatible with Windows */
enum
{
NtUserCallHwnd_ActivateOtherWindow,
NtUserCallHwnd_ArrangeIconicWindows,
NtUserCallHwnd_DrawMenuBar,
NtUserCallHwnd_GetDefaultImeWindow,
......@@ -1149,6 +1150,11 @@ enum
NtUserIsCurrehtThreadWindow,
};
static inline void NtUserActivateOtherWindow( HWND hwnd )
{
NtUserCallHwnd( hwnd, NtUserCallHwnd_ActivateOtherWindow );
}
static inline UINT NtUserArrangeIconicWindows( HWND parent )
{
return NtUserCallHwnd( parent, NtUserCallHwnd_ArrangeIconicWindows );
......
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