x11drv: Reinitialize the display settings when using a desktop window.

This commit is contained in:
Alexandre Julliard 2006-03-28 16:55:03 +02:00
parent 0bcc992162
commit bec4990cab
3 changed files with 34 additions and 22 deletions

View File

@ -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;
}

View File

@ -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
{

View File

@ -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);