explorer: Create the driver desktop window after the window handle is created.

This commit is contained in:
Alexandre Julliard 2013-10-16 12:13:50 +02:00
parent 1f9c541b58
commit 13149b67d3
4 changed files with 28 additions and 27 deletions

View File

@ -171,6 +171,7 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height )
PropModeReplace, (unsigned char*)&x11drv_atom(_NET_WM_STATE_FULLSCREEN),
1);
}
if (!create_desktop_win_data( win )) return FALSE;
XFlush( display );
X11DRV_init_desktop( win, width, height );
return TRUE;

View File

@ -1651,16 +1651,19 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd )
/* initialize the desktop window id in the desktop manager process */
static BOOL create_desktop_win_data( Display *display, HWND hwnd )
BOOL create_desktop_win_data( Window win )
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
Display *display = thread_data->display;
struct x11drv_win_data *data;
if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
data->whole_window = root_window;
if (!(data = alloc_win_data( display, GetDesktopWindow() ))) return FALSE;
data->whole_window = win;
data->managed = TRUE;
SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window );
set_initial_wm_hints( display, root_window );
SetPropA( data->hwnd, whole_window_prop, (HANDLE)win );
set_initial_wm_hints( display, win );
release_win_data( data );
if (thread_data->clip_window) XReparentWindow( display, thread_data->clip_window, win, 0, 0 );
return TRUE;
}
@ -1719,12 +1722,6 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd )
struct x11drv_thread_data *data = x11drv_init_thread_data();
XSetWindowAttributes attr;
if (root_window != DefaultRootWindow( gdi_display ))
{
/* the desktop win data can't be created lazily */
if (!create_desktop_win_data( data->display, hwnd )) return FALSE;
}
/* create the cursor clipping window */
attr.override_redirect = TRUE;
attr.event_mask = StructureNotifyMask | FocusChangeMask;

View File

@ -639,7 +639,8 @@ struct x11drv_mode_info
extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) DECLSPEC_HIDDEN;
extern void X11DRV_resize_desktop(unsigned int width, unsigned int height) DECLSPEC_HIDDEN;
BOOL is_desktop_fullscreen(void) DECLSPEC_HIDDEN;
extern BOOL is_desktop_fullscreen(void) DECLSPEC_HIDDEN;
extern BOOL create_desktop_win_data( Window win ) DECLSPEC_HIDDEN;
extern void X11DRV_Settings_AddDepthModes(void) DECLSPEC_HIDDEN;
extern void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigned int bpp, unsigned int freq) DECLSPEC_HIDDEN;
unsigned int X11DRV_Settings_GetModeCount(void) DECLSPEC_HIDDEN;

View File

@ -552,23 +552,15 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
static BOOL create_desktop( const WCHAR *name, unsigned int width, unsigned int height )
{
static const WCHAR rootW[] = {'r','o','o','t',0};
HDESK desktop;
BOOL ret = FALSE;
BOOL (CDECL *create_desktop_func)(unsigned int, unsigned int);
desktop = CreateDesktopW( name, NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
if (!desktop)
{
WINE_ERR( "failed to create desktop %s error %d\n", wine_dbgstr_w(name), GetLastError() );
ExitProcess( 1 );
}
/* magic: desktop "root" means use the root window */
if (graphics_driver && strcmpiW( name, rootW ))
{
create_desktop_func = (void *)GetProcAddress( graphics_driver, "wine_create_desktop" );
if (create_desktop_func) ret = create_desktop_func( width, height );
}
SetThreadDesktop( desktop );
return ret;
}
@ -703,8 +695,8 @@ static void set_desktop_window_title( HWND hwnd, const WCHAR *name )
/* main desktop management function */
void manage_desktop( WCHAR *arg )
{
static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0};
HDESK desktop = 0;
MSG msg;
HDC hdc;
HWND hwnd, msg_hwnd;
@ -737,10 +729,15 @@ void manage_desktop( WCHAR *arg )
if (!get_default_desktop_size( name, &width, &height )) width = height = 0;
}
hdc = CreateDCW( displayW, NULL, NULL, NULL );
graphics_driver = __wine_get_driver_module( hdc );
if (name && width && height) using_root = !create_desktop( name, width, height );
if (name && width && height)
{
if (!(desktop = CreateDesktopW( name, NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL )))
{
WINE_ERR( "failed to create desktop %s error %d\n", wine_dbgstr_w(name), GetLastError() );
ExitProcess( 1 );
}
SetThreadDesktop( desktop );
}
/* create the desktop window */
hwnd = CreateWindowExW( 0, DESKTOP_CLASS_ATOM, NULL,
@ -750,13 +747,18 @@ void manage_desktop( WCHAR *arg )
msg_hwnd = CreateWindowExW( 0, messageW, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0, 0, 100, 100, 0, 0, 0, NULL );
DeleteDC( hdc );
if (hwnd == GetDesktopWindow())
{
HMODULE shell32;
void (WINAPI *pShellDDEInit)( BOOL );
if (desktop)
{
hdc = GetDC( hwnd );
graphics_driver = __wine_get_driver_module( hdc );
using_root = !create_desktop( name, width, height );
ReleaseDC( hwnd, hdc );
}
SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)desktop_wnd_proc );
SendMessageW( hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW( 0, MAKEINTRESOURCEW(OIC_WINLOGO)));
if (name) set_desktop_window_title( hwnd, name );