server: Also return the top-level message window in the get_desktop_window request.

This commit is contained in:
Alexandre Julliard 2008-06-25 14:26:14 +02:00
parent d71303e91c
commit 6b36e2131d
5 changed files with 47 additions and 19 deletions

View file

@ -1636,7 +1636,11 @@ HWND WINAPI GetDesktopWindow(void)
SERVER_START_REQ( get_desktop_window )
{
req->force = 0;
if (!wine_server_call( req )) thread_info->top_window = reply->handle;
if (!wine_server_call( req ))
{
thread_info->top_window = reply->top_window;
thread_info->msg_window = reply->msg_window;
}
}
SERVER_END_REQ;
@ -1675,7 +1679,11 @@ HWND WINAPI GetDesktopWindow(void)
SERVER_START_REQ( get_desktop_window )
{
req->force = 1;
if (!wine_server_call( req )) thread_info->top_window = reply->handle;
if (!wine_server_call( req ))
{
thread_info->top_window = reply->top_window;
thread_info->msg_window = reply->msg_window;
}
}
SERVER_END_REQ;
}

View file

@ -2796,7 +2796,8 @@ struct get_desktop_window_request
struct get_desktop_window_reply
{
struct reply_header __header;
user_handle_t handle;
user_handle_t top_window;
user_handle_t msg_window;
};
@ -4996,6 +4997,6 @@ union generic_reply
struct add_fd_completion_reply add_fd_completion_reply;
};
#define SERVER_PROTOCOL_VERSION 339
#define SERVER_PROTOCOL_VERSION 340
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View file

@ -2061,7 +2061,8 @@ enum message_type
@REQ(get_desktop_window)
int force; /* force creation if it doesn't exist */
@REPLY
user_handle_t handle; /* handle to the desktop window */
user_handle_t top_window; /* handle to the desktop window */
user_handle_t msg_window; /* handle to the top-level HWND_MESSAGE parent */
@END

View file

@ -2575,7 +2575,8 @@ static void dump_get_desktop_window_request( const struct get_desktop_window_req
static void dump_get_desktop_window_reply( const struct get_desktop_window_reply *req )
{
fprintf( stderr, " handle=%p", req->handle );
fprintf( stderr, " top_window=%p,", req->top_window );
fprintf( stderr, " msg_window=%p", req->msg_window );
}
static void dump_set_window_owner_request( const struct set_window_owner_request *req )

View file

@ -549,21 +549,13 @@ void destroy_thread_windows( struct thread *thread )
}
/* get the desktop window */
static struct window *get_desktop_window( struct thread *thread, int create )
static struct window *get_desktop_window( struct thread *thread )
{
struct window *top_window;
struct desktop *desktop = get_thread_desktop( thread, 0 );
if (!desktop) return NULL;
if (!(top_window = desktop->top_window) && create)
{
if ((top_window = create_window( NULL, NULL, DESKTOP_ATOM, 0 )))
{
detach_window_thread( top_window );
top_window->style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
}
}
top_window = desktop->top_window;
release_object( desktop );
return top_window;
}
@ -786,7 +778,7 @@ static struct window *find_child_to_repaint( struct window *parent, struct threa
/* find a window that needs to receive a WM_PAINT; also clear its internal paint flag */
user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread )
{
struct window *ptr, *win, *top_window = get_desktop_window( thread, 0 );
struct window *ptr, *win, *top_window = get_desktop_window( thread );
if (!top_window) return 0;
@ -1794,9 +1786,34 @@ DECL_HANDLER(destroy_window)
/* retrieve the desktop window for the current thread */
DECL_HANDLER(get_desktop_window)
{
struct window *win = get_desktop_window( current, req->force );
struct desktop *desktop = get_thread_desktop( current, 0 );
if (win) reply->handle = win->handle;
if (!desktop) return;
if (!desktop->top_window && req->force) /* create it */
{
if ((desktop->top_window = create_window( NULL, NULL, DESKTOP_ATOM, 0 )))
{
detach_window_thread( desktop->top_window );
desktop->top_window->style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
}
}
if (!desktop->msg_window && req->force) /* create it */
{
static const WCHAR messageW[] = {'M','e','s','s','a','g','e'};
static const struct unicode_str name = { messageW, sizeof(messageW) };
atom_t atom = add_global_atom( NULL, &name );
if (atom && (desktop->msg_window = create_window( NULL, NULL, atom, 0 )))
{
detach_window_thread( desktop->msg_window );
desktop->msg_window->style = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
}
}
reply->top_window = desktop->top_window ? desktop->top_window->handle : 0;
reply->msg_window = desktop->msg_window ? desktop->msg_window->handle : 0;
release_object( desktop );
}