Commit 5df07a48 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Introduce get_desktop_window.

parent 51624900
...@@ -285,7 +285,7 @@ ATOM WINAPI NtUserRegisterClassExWOW( const WNDCLASSEXW *wc, UNICODE_STRING *nam ...@@ -285,7 +285,7 @@ ATOM WINAPI NtUserRegisterClassExWOW( const WNDCLASSEXW *wc, UNICODE_STRING *nam
BOOL ret; BOOL ret;
/* create the desktop window to trigger builtin class registration */ /* create the desktop window to trigger builtin class registration */
if (!is_builtin && user_callbacks) user_callbacks->pGetDesktopWindow(); if (!is_builtin) get_desktop_window();
if (wc->cbSize != sizeof(*wc) || wc->cbClsExtra < 0 || wc->cbWndExtra < 0 || if (wc->cbSize != sizeof(*wc) || wc->cbClsExtra < 0 || wc->cbWndExtra < 0 ||
(!is_builtin && wc->hInstance == user32_module)) /* we can't register a class for user32 */ (!is_builtin && wc->hInstance == user32_module)) /* we can't register a class for user32 */
...@@ -383,8 +383,8 @@ BOOL WINAPI NtUserUnregisterClass( UNICODE_STRING *name, HINSTANCE instance, ...@@ -383,8 +383,8 @@ BOOL WINAPI NtUserUnregisterClass( UNICODE_STRING *name, HINSTANCE instance,
{ {
CLASS *class = NULL; CLASS *class = NULL;
if (user_callbacks) /* create the desktop window to trigger builtin class registration */ /* create the desktop window to trigger builtin class registration */
user_callbacks->pGetDesktopWindow(); get_desktop_window();
SERVER_START_REQ( destroy_class ) SERVER_START_REQ( destroy_class )
{ {
...@@ -423,7 +423,7 @@ ATOM WINAPI NtUserGetClassInfoEx( HINSTANCE instance, UNICODE_STRING *name, WNDC ...@@ -423,7 +423,7 @@ ATOM WINAPI NtUserGetClassInfoEx( HINSTANCE instance, UNICODE_STRING *name, WNDC
if (name->Buffer != (const WCHAR *)DESKTOP_CLASS_ATOM && if (name->Buffer != (const WCHAR *)DESKTOP_CLASS_ATOM &&
(IS_INTRESOURCE(name->Buffer) || name->Length != sizeof(messageW) || (IS_INTRESOURCE(name->Buffer) || name->Length != sizeof(messageW) ||
wcsnicmp( name->Buffer, messageW, ARRAYSIZE(messageW) ))) wcsnicmp( name->Buffer, messageW, ARRAYSIZE(messageW) )))
user_callbacks->pGetDesktopWindow(); get_desktop_window();
if (!(class = find_class( instance, name ))) return 0; if (!(class = find_class( instance, name ))) return 0;
......
...@@ -64,8 +64,7 @@ const struct gdi_dc_funcs *get_display_driver(void) ...@@ -64,8 +64,7 @@ const struct gdi_dc_funcs *get_display_driver(void)
{ {
if (user_driver == &lazy_load_driver) if (user_driver == &lazy_load_driver)
{ {
if (!user_callbacks || !user_callbacks->pGetDesktopWindow() || if (!get_desktop_window() || user_driver == &lazy_load_driver)
user_driver == &lazy_load_driver)
{ {
static struct user_driver_funcs empty_funcs; static struct user_driver_funcs empty_funcs;
WARN( "failed to load the display driver, falling back to null driver\n" ); WARN( "failed to load the display driver, falling back to null driver\n" );
......
...@@ -298,6 +298,7 @@ extern void user_check_not_lock(void) DECLSPEC_HIDDEN; ...@@ -298,6 +298,7 @@ extern void user_check_not_lock(void) DECLSPEC_HIDDEN;
/* window.c */ /* window.c */
struct tagWND; struct tagWND;
extern HWND get_desktop_window(void) DECLSPEC_HIDDEN;
extern HWND is_current_thread_window( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND is_current_thread_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern void flush_window_surfaces( BOOL idle ) DECLSPEC_HIDDEN; extern void flush_window_surfaces( BOOL idle ) DECLSPEC_HIDDEN;
extern DWORD get_window_long( HWND hwnd, INT offset ) DECLSPEC_HIDDEN; extern DWORD get_window_long( HWND hwnd, INT offset ) DECLSPEC_HIDDEN;
......
...@@ -163,8 +163,7 @@ static HWND get_hwnd_message_parent(void) ...@@ -163,8 +163,7 @@ static HWND get_hwnd_message_parent(void)
{ {
struct user_thread_info *thread_info = get_user_thread_info(); struct user_thread_info *thread_info = get_user_thread_info();
if (!thread_info->msg_window && user_callbacks) if (!thread_info->msg_window) get_desktop_window(); /* trigger creation */
user_callbacks->pGetDesktopWindow(); /* trigger creation */
return thread_info->msg_window; return thread_info->msg_window;
} }
...@@ -186,8 +185,7 @@ static HWND get_full_window_handle( HWND hwnd ) ...@@ -186,8 +185,7 @@ static HWND get_full_window_handle( HWND hwnd )
if (win == WND_DESKTOP) if (win == WND_DESKTOP)
{ {
if (user_callbacks && LOWORD(hwnd) == LOWORD(user_callbacks->pGetDesktopWindow())) if (LOWORD(hwnd) == LOWORD(get_desktop_window())) return get_desktop_window();
return user_callbacks->pGetDesktopWindow();
else return get_hwnd_message_parent(); else return get_hwnd_message_parent();
} }
...@@ -619,7 +617,7 @@ static BOOL is_window_visible( HWND hwnd ) ...@@ -619,7 +617,7 @@ static BOOL is_window_visible( HWND hwnd )
{ {
for (i = 0; list[i+1]; i++) for (i = 0; list[i+1]; i++)
if (!(get_window_long( list[i], GWL_STYLE ) & WS_VISIBLE)) break; if (!(get_window_long( list[i], GWL_STYLE ) & WS_VISIBLE)) break;
retval = !list[i+1] && (list[i] == user_callbacks->pGetDesktopWindow()); /* top message window isn't visible */ retval = !list[i+1] && (list[i] == get_desktop_window()); /* top message window isn't visible */
} }
free( list ); free( list );
return retval; return retval;
...@@ -648,7 +646,7 @@ static BOOL is_window_drawable( HWND hwnd, BOOL icon ) ...@@ -648,7 +646,7 @@ static BOOL is_window_drawable( HWND hwnd, BOOL icon )
for (i = 0; list[i+1]; i++) for (i = 0; list[i+1]; i++)
if ((get_window_long( list[i], GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != WS_VISIBLE) if ((get_window_long( list[i], GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != WS_VISIBLE)
break; break;
retval = !list[i+1] && (list[i] == user_callbacks->pGetDesktopWindow()); /* top message window isn't visible */ retval = !list[i+1] && (list[i] == get_desktop_window()); /* top message window isn't visible */
} }
free( list ); free( list );
return retval; return retval;
...@@ -689,7 +687,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans ...@@ -689,7 +687,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans
if (offset == GWLP_HWNDPARENT) if (offset == GWLP_HWNDPARENT)
{ {
HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
if (user_callbacks && parent == user_callbacks->pGetDesktopWindow()) if (parent == get_desktop_window())
parent = get_window_relative( hwnd, GW_OWNER ); parent = get_window_relative( hwnd, GW_OWNER );
return (ULONG_PTR)parent; return (ULONG_PTR)parent;
} }
...@@ -706,7 +704,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans ...@@ -706,7 +704,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans
{ {
case GWL_STYLE: case GWL_STYLE:
retval = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; /* message parent is not visible */ retval = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; /* message parent is not visible */
if (user_callbacks && get_full_window_handle( hwnd ) == user_callbacks->pGetDesktopWindow()) if (get_full_window_handle( hwnd ) == get_desktop_window())
retval |= WS_VISIBLE; retval |= WS_VISIBLE;
return retval; return retval;
case GWL_EXSTYLE: case GWL_EXSTYLE:
......
...@@ -388,6 +388,15 @@ BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DW ...@@ -388,6 +388,15 @@ BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DW
return ret; return ret;
} }
HWND get_desktop_window(void)
{
struct user_thread_info *thread_info = get_user_thread_info();
if (thread_info->top_window) return thread_info->top_window;
if (!user_callbacks) return 0;
return user_callbacks->pGetDesktopWindow();
}
static HANDLE get_winstations_dir_handle(void) static HANDLE get_winstations_dir_handle(void)
{ {
char bufferA[64]; char bufferA[64];
......
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