Commit b6cc7f9b authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Don't create a win_data structure for the root window in non-desktop mode.

parent 4a753f90
...@@ -875,7 +875,6 @@ void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data ) ...@@ -875,7 +875,6 @@ void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data )
if (data->hwnd == GetDesktopWindow()) if (data->hwnd == GetDesktopWindow())
{ {
if (data->whole_window == DefaultRootWindow(display)) return;
/* force some styles for the desktop to get the correct decorations */ /* force some styles for the desktop to get the correct decorations */
style |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; style |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
owner = 0; owner = 0;
...@@ -947,7 +946,7 @@ void X11DRV_set_iconic_state( HWND hwnd ) ...@@ -947,7 +946,7 @@ void X11DRV_set_iconic_state( HWND hwnd )
BOOL iconic = (style & WS_MINIMIZE) != 0; BOOL iconic = (style & WS_MINIMIZE) != 0;
if (!(data = X11DRV_get_win_data( hwnd ))) return; if (!(data = X11DRV_get_win_data( hwnd ))) return;
if (!data->whole_window || data->whole_window == DefaultRootWindow(display)) return; if (!data->whole_window) return;
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
...@@ -1155,7 +1154,6 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data ...@@ -1155,7 +1154,6 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data
if (thread_data->cursor_window == data->whole_window) thread_data->cursor_window = None; if (thread_data->cursor_window == data->whole_window) thread_data->cursor_window = None;
wine_tsx11_lock(); wine_tsx11_lock();
XDeleteContext( display, data->whole_window, winContext ); XDeleteContext( display, data->whole_window, winContext );
if (data->whole_window != DefaultRootWindow(display))
XDestroyWindow( display, data->whole_window ); XDestroyWindow( display, data->whole_window );
data->whole_window = 0; data->whole_window = 0;
if (data->xic) if (data->xic)
...@@ -1242,22 +1240,22 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd ) ...@@ -1242,22 +1240,22 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd )
/* initialize the desktop window id in the desktop manager process */ /* initialize the desktop window id in the desktop manager process */
static void get_desktop_xwin( Display *display, struct x11drv_win_data *data ) static struct x11drv_win_data *create_desktop_win_data( Display *display, HWND hwnd )
{ {
data->whole_window = root_window; struct x11drv_win_data *data;
if (root_window != DefaultRootWindow( display ))
{
VisualID visualid; VisualID visualid;
if (!(data = alloc_win_data( display, hwnd ))) return NULL;
wine_tsx11_lock(); wine_tsx11_lock();
visualid = XVisualIDFromVisual(visual); visualid = XVisualIDFromVisual(visual);
wine_tsx11_unlock(); wine_tsx11_unlock();
data->whole_window = root_window;
data->managed = TRUE; data->managed = TRUE;
SetPropA( data->hwnd, managed_prop, (HANDLE)1 ); SetPropA( data->hwnd, managed_prop, (HANDLE)1 );
SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window ); SetPropA( data->hwnd, whole_window_prop, (HANDLE)root_window );
SetPropA( data->hwnd, visual_id_prop, (HANDLE)visualid ); SetPropA( data->hwnd, visual_id_prop, (HANDLE)visualid );
set_initial_wm_hints( display, data ); set_initial_wm_hints( display, data );
} return data;
} }
/********************************************************************** /**********************************************************************
...@@ -1309,7 +1307,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -1309,7 +1307,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{ {
Display *display = thread_display(); Display *display = thread_display();
WND *wndPtr; WND *wndPtr;
struct x11drv_win_data *data;
HWND insert_after; HWND insert_after;
RECT rect; RECT rect;
DWORD style; DWORD style;
...@@ -1318,20 +1315,27 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -1318,20 +1315,27 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
BOOL ret = FALSE; BOOL ret = FALSE;
INT cx = cs->cx, cy = cs->cy; INT cx = cs->cx, cy = cs->cy;
if (!(data = alloc_win_data( display, hwnd ))) return FALSE; if (hwnd == GetDesktopWindow())
{
if (hwnd == GetDesktopWindow()) get_desktop_xwin( display, data ); if (root_window != DefaultRootWindow( display ))
{
if (!create_desktop_win_data( display, hwnd )) return FALSE;
}
}
else else
{ {
struct x11drv_win_data *data;
if (!(data = alloc_win_data( display, hwnd ))) return FALSE;
/* create an X window if it's a top level window */ /* create an X window if it's a top level window */
if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow()) if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow())
{ {
if (!create_whole_window( display, data )) goto failed; if (!create_whole_window( display, data )) goto failed;
} }
}
/* get class or window DC if needed */ /* get class or window DC if needed */
alloc_window_dce( data ); alloc_window_dce( data );
}
/* Call the WH_CBT hook */ /* Call the WH_CBT hook */
...@@ -1379,11 +1383,11 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -1379,11 +1383,11 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
} }
/* make sure the window is still valid */ /* make sure the window is still valid */
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE; if (!(wndPtr = WIN_GetPtr(hwnd))) return FALSE;
if (data->whole_window) X11DRV_sync_window_style( display, data );
/* send WM_NCCALCSIZE */ /* send WM_NCCALCSIZE */
rect = data->window_rect; rect = wndPtr->rectWindow;
WIN_ReleasePtr( wndPtr );
SendMessageW( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rect ); SendMessageW( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rect );
if (!(wndPtr = WIN_GetPtr(hwnd))) return FALSE; if (!(wndPtr = WIN_GetPtr(hwnd))) return FALSE;
...@@ -1393,17 +1397,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -1393,17 +1397,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
X11DRV_SetWindowPos( hwnd, insert_after, &wndPtr->rectWindow, &rect, SWP_NOACTIVATE, NULL ); X11DRV_SetWindowPos( hwnd, insert_after, &wndPtr->rectWindow, &rect, SWP_NOACTIVATE, NULL );
TRACE( "win %p window %d,%d,%d,%d client %d,%d,%d,%d whole %d,%d,%d,%d X client %d,%d,%d,%d xwin %x\n",
hwnd, wndPtr->rectWindow.left, wndPtr->rectWindow.top,
wndPtr->rectWindow.right, wndPtr->rectWindow.bottom,
wndPtr->rectClient.left, wndPtr->rectClient.top,
wndPtr->rectClient.right, wndPtr->rectClient.bottom,
data->whole_rect.left, data->whole_rect.top,
data->whole_rect.right, data->whole_rect.bottom,
data->client_rect.left, data->client_rect.top,
data->client_rect.right, data->client_rect.bottom,
(unsigned int)data->whole_window );
WIN_ReleasePtr( wndPtr ); WIN_ReleasePtr( wndPtr );
if (unicode) if (unicode)
......
...@@ -353,17 +353,11 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, ...@@ -353,17 +353,11 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
RECT old_window_rect, old_whole_rect, old_client_rect, visible_rect; RECT old_window_rect, old_whole_rect, old_client_rect, visible_rect;
DWORD new_style; DWORD new_style;
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
if (!set_server_window_pos( hwnd, insert_after, rectWindow, rectClient, swp_flags, if (!set_server_window_pos( hwnd, insert_after, rectWindow, rectClient, swp_flags,
valid_rects, &visible_rect )) valid_rects, &visible_rect ))
return FALSE; return FALSE;
if (data->whole_window == DefaultRootWindow(gdi_display)) if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
{
data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
return TRUE;
}
/* check if we need to switch the window to managed */ /* check if we need to switch the window to managed */
if (!data->managed && data->whole_window && managed_mode && if (!data->managed && data->whole_window && managed_mode &&
...@@ -933,7 +927,6 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam ...@@ -933,7 +927,6 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam
void X11DRV_resize_desktop( unsigned int width, unsigned int height ) void X11DRV_resize_desktop( unsigned int width, unsigned int height )
{ {
HWND hwnd = GetDesktopWindow(); HWND hwnd = GetDesktopWindow();
struct x11drv_win_data *data;
struct desktop_resize_data resize_data; struct desktop_resize_data resize_data;
SetRect( &resize_data.old_screen_rect, 0, 0, screen_width, screen_height ); SetRect( &resize_data.old_screen_rect, 0, 0, screen_width, screen_height );
...@@ -941,7 +934,7 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height ) ...@@ -941,7 +934,7 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height )
xinerama_init( width, height ); xinerama_init( width, height );
if (!(data = X11DRV_get_win_data( hwnd ))) if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId())
{ {
SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, MAKELPARAM( width, height ) ); SendMessageW( hwnd, WM_X11DRV_RESIZE_DESKTOP, 0, MAKELPARAM( width, height ) );
} }
......
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