user32: Treat the top-level message window as a desktop window.
This commit is contained in:
parent
1abbe0dfe3
commit
782403085f
|
@ -1085,7 +1085,7 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
|
|||
if (CallMsgFilterW( msg, MSGF_DIALOGBOX )) return TRUE;
|
||||
|
||||
hwndDlg = WIN_GetFullHandle( hwndDlg );
|
||||
if (hwndDlg == GetDesktopWindow()) return FALSE;
|
||||
if (is_desktop_window(hwndDlg)) return FALSE;
|
||||
if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd )) return FALSE;
|
||||
|
||||
hwndDlg = DIALOG_FindMsgDestination(hwndDlg);
|
||||
|
|
|
@ -264,6 +264,7 @@ HWND WINAPI SetFocus( HWND hwnd )
|
|||
if (style & (WS_MINIMIZE | WS_DISABLED)) return 0;
|
||||
parent = GetAncestor( hwndTop, GA_PARENT );
|
||||
if (!parent || parent == GetDesktopWindow()) break;
|
||||
if (parent == get_hwnd_message_parent()) return 0;
|
||||
hwndTop = parent;
|
||||
}
|
||||
|
||||
|
|
|
@ -1281,21 +1281,21 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
|
|||
case WM_WINE_DESTROYWINDOW:
|
||||
return WIN_DestroyWindow( hwnd );
|
||||
case WM_WINE_SETWINDOWPOS:
|
||||
if (hwnd == GetDesktopWindow()) return 0;
|
||||
if (is_desktop_window( hwnd )) return 0;
|
||||
return USER_SetWindowPos( (WINDOWPOS *)lparam );
|
||||
case WM_WINE_SHOWWINDOW:
|
||||
if (hwnd == GetDesktopWindow()) return 0;
|
||||
if (is_desktop_window( hwnd )) return 0;
|
||||
return ShowWindow( hwnd, wparam );
|
||||
case WM_WINE_SETPARENT:
|
||||
if (hwnd == GetDesktopWindow()) return 0;
|
||||
if (is_desktop_window( hwnd )) return 0;
|
||||
return (LRESULT)SetParent( hwnd, (HWND)wparam );
|
||||
case WM_WINE_SETWINDOWLONG:
|
||||
return WIN_SetWindowLong( hwnd, (short)LOWORD(wparam), HIWORD(wparam), lparam, TRUE );
|
||||
case WM_WINE_ENABLEWINDOW:
|
||||
if (hwnd == GetDesktopWindow()) return 0;
|
||||
if (is_desktop_window( hwnd )) return 0;
|
||||
return EnableWindow( hwnd, wparam );
|
||||
case WM_WINE_SETACTIVEWINDOW:
|
||||
if (hwnd == GetDesktopWindow()) return 0;
|
||||
if (is_desktop_window( hwnd )) return 0;
|
||||
return (LRESULT)SetActiveWindow( (HWND)wparam );
|
||||
case WM_WINE_KEYBOARD_LL_HOOK:
|
||||
case WM_WINE_MOUSE_LL_HOOK:
|
||||
|
|
|
@ -362,7 +362,7 @@ static void get_server_window_text( HWND hwnd, LPWSTR text, INT count )
|
|||
*
|
||||
* Return the parent for HWND_MESSAGE windows.
|
||||
*/
|
||||
static HWND get_hwnd_message_parent(void)
|
||||
HWND get_hwnd_message_parent(void)
|
||||
{
|
||||
struct user_thread_info *thread_info = get_user_thread_info();
|
||||
|
||||
|
@ -371,6 +371,28 @@ static HWND get_hwnd_message_parent(void)
|
|||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* is_desktop_window
|
||||
*
|
||||
* Check if window is the desktop or the HWND_MESSAGE top parent.
|
||||
*/
|
||||
BOOL is_desktop_window( HWND hwnd )
|
||||
{
|
||||
struct user_thread_info *thread_info = get_user_thread_info();
|
||||
|
||||
if (!hwnd) return FALSE;
|
||||
if (hwnd == thread_info->top_window) return TRUE;
|
||||
if (hwnd == thread_info->msg_window) return TRUE;
|
||||
|
||||
if (!HIWORD(hwnd) || HIWORD(hwnd) == 0xffff)
|
||||
{
|
||||
if (LOWORD(thread_info->top_window) == LOWORD(hwnd)) return TRUE;
|
||||
if (LOWORD(thread_info->msg_window) == LOWORD(hwnd)) return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIN_GetPtr
|
||||
*
|
||||
|
@ -393,11 +415,7 @@ WND *WIN_GetPtr( HWND hwnd )
|
|||
return ptr;
|
||||
ptr = NULL;
|
||||
}
|
||||
else if (index == USER_HANDLE_TO_INDEX(GetDesktopWindow()))
|
||||
{
|
||||
if (hwnd == GetDesktopWindow() || !HIWORD(hwnd) || HIWORD(hwnd) == 0xffff) ptr = WND_DESKTOP;
|
||||
else ptr = NULL;
|
||||
}
|
||||
else if (is_desktop_window( hwnd )) ptr = WND_DESKTOP;
|
||||
else ptr = WND_OTHER_PROCESS;
|
||||
USER_Unlock();
|
||||
return ptr;
|
||||
|
@ -454,7 +472,11 @@ HWND WIN_Handle32( HWND16 hwnd16 )
|
|||
|
||||
if (!(ptr = WIN_GetPtr( hwnd ))) return hwnd;
|
||||
|
||||
if (ptr == WND_DESKTOP) return GetDesktopWindow();
|
||||
if (ptr == WND_DESKTOP)
|
||||
{
|
||||
if (LOWORD(hwnd) == LOWORD(GetDesktopWindow())) return GetDesktopWindow();
|
||||
else return get_hwnd_message_parent();
|
||||
}
|
||||
|
||||
if (ptr != WND_OTHER_PROCESS)
|
||||
{
|
||||
|
@ -569,8 +591,16 @@ BOOL WIN_GetRectangles( HWND hwnd, RECT *rectWindow, RECT *rectClient )
|
|||
{
|
||||
RECT rect;
|
||||
rect.left = rect.top = 0;
|
||||
rect.right = GetSystemMetrics(SM_CXSCREEN);
|
||||
rect.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||
if (hwnd == get_hwnd_message_parent())
|
||||
{
|
||||
rect.right = 100;
|
||||
rect.bottom = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.right = GetSystemMetrics(SM_CXSCREEN);
|
||||
rect.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||
}
|
||||
if (rectWindow) *rectWindow = rect;
|
||||
if (rectClient) *rectClient = rect;
|
||||
}
|
||||
|
@ -1431,7 +1461,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
|
|||
{
|
||||
BOOL is_child;
|
||||
|
||||
if (!(hwnd = WIN_IsCurrentThread( hwnd )) || (hwnd == GetDesktopWindow()))
|
||||
if (!(hwnd = WIN_IsCurrentThread( hwnd )) || is_desktop_window( hwnd ))
|
||||
{
|
||||
SetLastError( ERROR_ACCESS_DENIED );
|
||||
return FALSE;
|
||||
|
@ -2609,7 +2639,8 @@ HWND WINAPI GetAncestor( HWND hwnd, UINT type )
|
|||
break;
|
||||
|
||||
case GA_ROOTOWNER:
|
||||
if ((ret = WIN_GetFullHandle( hwnd )) == GetDesktopWindow()) return 0;
|
||||
if (is_desktop_window( hwnd )) return 0;
|
||||
ret = WIN_GetFullHandle( hwnd );
|
||||
for (;;)
|
||||
{
|
||||
HWND parent = GetParent( ret );
|
||||
|
|
|
@ -76,6 +76,8 @@ typedef struct tagWND
|
|||
#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0080 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
|
||||
|
||||
/* Window functions */
|
||||
extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||
extern WND *WIN_GetPtr( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||
extern HWND WIN_Handle32( HWND16 hwnd16 ) DECLSPEC_HIDDEN;
|
||||
extern HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -2100,7 +2100,7 @@ HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
|
|||
hdwp, hwnd, hwndAfter, x, y, cx, cy, flags);
|
||||
|
||||
hwnd = WIN_GetFullHandle( hwnd );
|
||||
if (hwnd == GetDesktopWindow()) return 0;
|
||||
if (is_desktop_window( hwnd )) return 0;
|
||||
|
||||
if (!(pDWP = USER_HEAP_LIN_ADDR( hdwp ))) return 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue