Commit 1a4f6e57 authored by Alexandre Julliard's avatar Alexandre Julliard

user: Launch explorer to manage the desktop window.

parent a93b6a59
......@@ -103,6 +103,16 @@ static WND *create_window_handle( HWND parent, HWND owner, ATOM atom,
return NULL;
}
if (!parent) /* if parent is 0 we don't have a desktop window yet */
{
struct user_thread_info *thread_info = get_user_thread_info();
assert( !thread_info->desktop );
thread_info->desktop = full_parent ? full_parent : handle;
if (full_parent && !USER_Driver->pCreateDesktopWindow( thread_info->desktop ))
ERR( "failed to create desktop window\n" );
}
USER_Lock();
index = USER_HANDLE_TO_INDEX(handle);
......@@ -946,7 +956,8 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
WARN("No parent for child window\n" );
return 0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
parent = GetDesktopWindow();
if (classAtom != LOWORD(DESKTOP_CLASS_ATOM)) /* are we creating the desktop itself? */
parent = GetDesktopWindow();
}
WIN_FixCoordinates(cs, &sw); /* fix default coordinates */
......@@ -1553,16 +1564,45 @@ HWND WINAPI GetDesktopWindow(void)
{
struct user_thread_info *thread_info = get_user_thread_info();
if (thread_info->desktop) return thread_info->desktop;
SERVER_START_REQ( get_desktop_window )
{
req->force = 0;
if (!wine_server_call( req )) thread_info->desktop = reply->handle;
}
SERVER_END_REQ;
if (!thread_info->desktop)
{
STARTUPINFOW si;
PROCESS_INFORMATION pi;
WCHAR command_line[] = {'e','x','p','l','o','r','e','r','.','e','x','e',' ','/','d','e','s','k','t','o','p',0};
memset( &si, 0, sizeof(si) );
si.cb = sizeof(si);
if (CreateProcessW( NULL, command_line, NULL, NULL, FALSE, DETACHED_PROCESS,
NULL, NULL, &si, &pi ))
{
TRACE( "started explorer pid %04lx tid %04lx\n", pi.dwProcessId, pi.dwThreadId );
WaitForInputIdle( pi.hProcess, 10000 );
CloseHandle( pi.hThread );
CloseHandle( pi.hProcess );
}
else WARN( "failed to start explorer, err %ld\n", GetLastError() );
SERVER_START_REQ( get_desktop_window )
{
req->force = 1;
if (!wine_server_call( req )) thread_info->desktop = reply->handle;
}
SERVER_END_REQ;
if (!thread_info->desktop || !USER_Driver->pCreateDesktopWindow( thread_info->desktop ))
ERR( "failed to create desktop window\n" );
}
if (!thread_info->desktop || !USER_Driver->pCreateDesktopWindow( thread_info->desktop ))
ERR( "failed to create desktop window\n" );
return thread_info->desktop;
}
......
......@@ -942,8 +942,6 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
RECT newPos = {0, 0, 0, 0};
UINT swp = 0;
if (hwnd == GetDesktopWindow()) return FALSE;
TRACE("hwnd=%p, cmd=%d, wasVisible %d\n", hwnd, cmd, wasVisible);
switch(cmd)
......
......@@ -2543,6 +2543,7 @@ struct destroy_window_reply
struct get_desktop_window_request
{
struct request_header __header;
int force;
};
struct get_desktop_window_reply
{
......@@ -4360,6 +4361,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
#define SERVER_PROTOCOL_VERSION 230
#define SERVER_PROTOCOL_VERSION 231
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -1804,6 +1804,7 @@ enum message_type
/* Retrieve the desktop window for the current thread */
@REQ(get_desktop_window)
int force; /* force creation if it doesn't exist */
@REPLY
user_handle_t handle; /* handle to the desktop window */
@END
......
......@@ -2280,6 +2280,7 @@ static void dump_destroy_window_request( const struct destroy_window_request *re
static void dump_get_desktop_window_request( const struct get_desktop_window_request *req )
{
fprintf( stderr, " force=%d", req->force );
}
static void dump_get_desktop_window_reply( const struct get_desktop_window_reply *req )
......
......@@ -1459,7 +1459,7 @@ DECL_HANDLER(destroy_window)
/* retrieve the desktop window for the current thread */
DECL_HANDLER(get_desktop_window)
{
struct window *win = get_desktop_window( current, 1 );
struct window *win = get_desktop_window( current, req->force );
if (win) reply->handle = win->handle;
}
......
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