Alexandre Julliard : server: Also return the top-level message window in the get_desktop_window request .
Alexandre Julliard
julliard at winehq.org
Wed Jun 25 16:43:38 CDT 2008
Module: wine
Branch: master
Commit: 6b36e2131df032809b1ecb6b90162d11edd43684
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b36e2131df032809b1ecb6b90162d11edd43684
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jun 25 14:26:14 2008 +0200
server: Also return the top-level message window in the get_desktop_window request.
---
dlls/user32/win.c | 12 +++++++++-
include/wine/server_protocol.h | 5 ++-
server/protocol.def | 3 +-
server/trace.c | 3 +-
server/window.c | 43 +++++++++++++++++++++++++++------------
5 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 5252cea..a924fe3 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -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;
}
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 810464c..5f5565a 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -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 */
diff --git a/server/protocol.def b/server/protocol.def
index 01d94d2..034bb1a 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -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
diff --git a/server/trace.c b/server/trace.c
index bbae524..777255c 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -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 )
diff --git a/server/window.c b/server/window.c
index cae5603..53ea59f 100644
--- a/server/window.c
+++ b/server/window.c
@@ -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 (!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 (win) reply->handle = win->handle;
+ 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 );
}
More information about the wine-cvs
mailing list