From bec4990cab64f9deb72705656d4f83b2a79c41c9 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 28 Mar 2006 16:55:03 +0200 Subject: [PATCH] x11drv: Reinitialize the display settings when using a desktop window. --- dlls/x11drv/desktop.c | 42 ++++++++++++++++++++++++++---------------- dlls/x11drv/window.c | 13 +++++++------ dlls/x11drv/x11drv.h | 1 + 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/dlls/x11drv/desktop.c b/dlls/x11drv/desktop.c index ee7616859c5..75b21945797 100644 --- a/dlls/x11drv/desktop.c +++ b/dlls/x11drv/desktop.c @@ -130,6 +130,31 @@ static void X11DRV_desktop_SetCurrentMode(int mode) } } +/*********************************************************************** + * X11DRV_init_desktop + * + * Setup the desktop when not using the root window. + */ +void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) +{ + root_window = win; + max_width = screen_width; + max_height = screen_height; + screen_width = width; + screen_height = height; + + /* initialize the available resolutions */ + dd_modes = X11DRV_Settings_SetHandlers("desktop", + X11DRV_desktop_GetCurrentMode, + X11DRV_desktop_SetCurrentMode, + NUM_DESKTOP_MODES+2, 1); + make_modes(); + X11DRV_Settings_AddDepthModes(); + dd_mode_count = X11DRV_Settings_GetModeCount(); + X11DRV_Settings_SetDefaultMode(0); +} + + /*********************************************************************** * X11DRV_create_desktop * @@ -142,10 +167,6 @@ Window X11DRV_create_desktop( UINT width, UINT height ) Display *display = thread_display(); wine_tsx11_lock(); - max_width = screen_width; - max_height = screen_height; - screen_width = width; - screen_height = height; /* Create window */ win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | @@ -163,17 +184,6 @@ Window X11DRV_create_desktop( UINT width, UINT height ) CWEventMask | CWCursor | CWColormap, &win_attr ); XFlush( display ); wine_tsx11_unlock(); - if (win == None) return None; - - /* initialize the available resolutions */ - dd_modes = X11DRV_Settings_SetHandlers("desktop", - X11DRV_desktop_GetCurrentMode, - X11DRV_desktop_SetCurrentMode, - NUM_DESKTOP_MODES+2, 1); - make_modes(); - X11DRV_Settings_AddDepthModes(); - dd_mode_count = X11DRV_Settings_GetModeCount(); - X11DRV_Settings_SetDefaultMode(0); - root_window = win; + if (win != None) X11DRV_init_desktop( win, width, height ); return win; } diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c index 67be4351c85..592d874b574 100644 --- a/dlls/x11drv/window.c +++ b/dlls/x11drv/window.c @@ -858,18 +858,19 @@ static void get_desktop_xwin( Display *display, struct x11drv_win_data *data ) if (win) { + unsigned int width, height; + /* retrieve the real size of the desktop */ SERVER_START_REQ( get_window_rectangles ) { req->handle = data->hwnd; - if (!wine_server_call( req )) - { - screen_width = reply->window.right - reply->window.left; - screen_height = reply->window.bottom - reply->window.top; - } + wine_server_call( req ); + width = reply->window.right - reply->window.left; + height = reply->window.bottom - reply->window.top; } SERVER_END_REQ; - data->whole_window = root_window = win; + data->whole_window = win; + if (win != root_window) X11DRV_init_desktop( win, width, height ); } else { diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h index fea27218cec..c528c99559b 100644 --- a/dlls/x11drv/x11drv.h +++ b/dlls/x11drv/x11drv.h @@ -684,6 +684,7 @@ extern BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rec const RECT *rectClient, UINT swp_flags, const RECT *validRects ); extern void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data ); +extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ); extern void X11DRV_handle_desktop_resize(unsigned int width, unsigned int height); extern void X11DRV_Settings_AddDepthModes(void); extern void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigned int bpp, unsigned int freq);