From a4626a43f5fdb16a07b5a7a719b547c98bc78aa6 Mon Sep 17 00:00:00 2001 From: Alex Pasadyn Date: Fri, 13 Feb 2004 03:58:21 +0000 Subject: [PATCH] Update the desktop window size and send WM_DISPLAYCHANGE on resolution changes. --- dlls/x11drv/desktop.c | 10 +--------- dlls/x11drv/winpos.c | 18 ++++++++++++++++++ dlls/x11drv/x11drv.h | 2 ++ dlls/x11drv/x11drv_main.c | 4 ++++ dlls/x11drv/xrandr.c | 16 +++++----------- dlls/x11drv/xvidmode.c | 17 ++++------------- 6 files changed, 34 insertions(+), 33 deletions(-) diff --git a/dlls/x11drv/desktop.c b/dlls/x11drv/desktop.c index be39dfd5d2e..ac141d62038 100644 --- a/dlls/x11drv/desktop.c +++ b/dlls/x11drv/desktop.c @@ -176,20 +176,12 @@ int X11DRV_resize_desktop( unsigned int width, unsigned int height ) /* do the work */ XSetWMNormalHints( display, w, size_hints ); XResizeWindow( display, w, width, height ); - screen_width = width; - screen_height = height; -#if 0 /* FIXME */ - SYSMETRICS_Set( SM_CXSCREEN, width ); - SYSMETRICS_Set( SM_CYSCREEN, height ); -#else - FIXME("Need to update SYSMETRICS after resizing display (now %dx%d)\n", - width, height); -#endif /* clean up */ XFree( size_hints ); XFlush( display ); wine_tsx11_unlock(); + X11DRV_handle_desktop_resize( width, height ); return 1; } diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c index b6b58862970..bd933023a0b 100644 --- a/dlls/x11drv/winpos.c +++ b/dlls/x11drv/winpos.c @@ -1551,6 +1551,24 @@ static HWND query_zorder( Display *display, HWND hWndCheck) } +/*********************************************************************** + * X11DRV_handle_desktop_resize + */ +void X11DRV_handle_desktop_resize( unsigned int width, unsigned int height ) +{ + RECT rect; + HWND hwnd = GetDesktopWindow(); + + screen_width = width; + screen_height = height; + TRACE("desktop %p change to (%dx%d)\n", hwnd, width, height); + SetRect( &rect, 0, 0, width, height ); + WIN_SetRectangles( hwnd, &rect, &rect ); + SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_depth, + MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL ); +} + + /*********************************************************************** * X11DRV_ConfigureNotify */ diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h index f36599e3b17..297564640f4 100644 --- a/dlls/x11drv/x11drv.h +++ b/dlls/x11drv/x11drv.h @@ -222,6 +222,7 @@ extern int client_side_with_render; extern int client_side_antialias_with_core; extern int client_side_antialias_with_render; extern int using_client_side_fonts; +extern int using_wine_desktop; extern void X11DRV_XRender_Init(void); extern void X11DRV_XRender_Finalize(void); extern BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE*, HFONT); @@ -551,6 +552,7 @@ extern int X11DRV_sync_whole_window_position( Display *display, WND *win, int zo extern int X11DRV_sync_client_window_position( Display *display, WND *win ); extern void X11DRV_set_wm_hints( Display *display, WND *win ); +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); extern int X11DRV_Settings_CreateDriver(LPDDHALINFO info); diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c index 25c02e570ed..f364ba82e34 100644 --- a/dlls/x11drv/x11drv_main.c +++ b/dlls/x11drv/x11drv_main.c @@ -90,6 +90,7 @@ int client_side_with_core = 1; int client_side_with_render = 1; int client_side_antialias_with_core = 1; int client_side_antialias_with_render = 1; +int using_wine_desktop = 0; unsigned int X11DRV_server_startticks; @@ -380,7 +381,10 @@ static void process_attach(void) X11DRV_Settings_Init(); if (desktop_geometry) + { root_window = X11DRV_create_desktop( desktop_vi, desktop_geometry ); + using_wine_desktop = 1; + } /* initialize GDI */ if(!X11DRV_GDI_Initialize( display )) diff --git a/dlls/x11drv/xrandr.c b/dlls/x11drv/xrandr.c index 81f3e274b61..53d351388ac 100644 --- a/dlls/x11drv/xrandr.c +++ b/dlls/x11drv/xrandr.c @@ -56,7 +56,6 @@ static int XRandRErrorHandler(Display *dpy, XErrorEvent *event, void *arg) return 1; } -static Bool in_desktop_mode; /* create the mode structures */ static void make_modes(void) @@ -154,8 +153,6 @@ static void X11DRV_XRandR_SetCurrentMode(int mode) dd_modes[mode].dwWidth, dd_modes[mode].dwHeight, rate); stat = XRRSetScreenConfigAndRate (gdi_display, sc, root, size, rot, rate, CurrentTime); - FIXME("Need to update SYSMETRICS after resizing display (now %ldx%ld)\n", - dd_modes[mode].dwWidth, dd_modes[mode].dwHeight); } } } @@ -165,17 +162,15 @@ static void X11DRV_XRandR_SetCurrentMode(int mode) dd_modes[mode].dwWidth, dd_modes[mode].dwHeight); stat = XRRSetScreenConfig (gdi_display, sc, root, size, rot, CurrentTime); - FIXME("Need to update SYSMETRICS after resizing display (now %ldx%ld)\n", - dd_modes[mode].dwWidth, dd_modes[mode].dwHeight); } } } - if (stat != RRSetConfigSuccess) - { - ERR("Resolution change not successful -- perhaps display has changed?\n"); - } XRRFreeScreenConfigInfo(sc); wine_tsx11_unlock(); + if (stat == RRSetConfigSuccess) + X11DRV_handle_desktop_resize( dd_modes[mode].dwWidth, dd_modes[mode].dwHeight ); + else + ERR("Resolution change not successful -- perhaps display has changed?\n"); } void X11DRV_XRandR_Init(void) @@ -183,11 +178,10 @@ void X11DRV_XRandR_Init(void) Bool ok; int nmodes = 0; int i; - in_desktop_mode = (root_window != DefaultRootWindow(gdi_display)); if (xrandr_major) return; /* already initialized? */ if (!usexrandr) return; /* disabled in config */ - if (in_desktop_mode) return; /* not compatible with desktop mode */ + if (using_wine_desktop) return; /* not compatible with desktop mode */ /* see if Xrandr is available */ wine_tsx11_lock(); diff --git a/dlls/x11drv/xvidmode.c b/dlls/x11drv/xvidmode.c index 19dfa9b5b68..13b48f7974a 100644 --- a/dlls/x11drv/xvidmode.c +++ b/dlls/x11drv/xvidmode.c @@ -92,8 +92,6 @@ static int XVidModeErrorHandler(Display *dpy, XErrorEvent *event, void *arg) return 1; } -static Bool in_desktop_mode; - int X11DRV_XF86VM_GetCurrentMode(void) { XF86VidModeModeLine line; @@ -131,13 +129,6 @@ void X11DRV_XF86VM_SetCurrentMode(int mode) TRACE("Resizing X display to %dx%d\n", real_xf86vm_modes[mode]->hdisplay, real_xf86vm_modes[mode]->vdisplay); XF86VidModeSwitchToMode(gdi_display, DefaultScreen(gdi_display), real_xf86vm_modes[mode]); -#if 0 /* FIXME */ - SYSMETRICS_Set( SM_CXSCREEN, real_xf86vm_modes[mode]->hdisplay ); - SYSMETRICS_Set( SM_CYSCREEN, real_xf86vm_modes[mode]->vdisplay ); -#else - FIXME("Need to update SYSMETRICS after resizing display (now %dx%d)\n", - real_xf86vm_modes[mode]->hdisplay, real_xf86vm_modes[mode]->vdisplay); -#endif #if 0 /* it is said that SetViewPort causes problems with some X servers */ XF86VidModeSetViewPort(gdi_display, DefaultScreen(gdi_display), 0, 0); #else @@ -145,6 +136,8 @@ void X11DRV_XF86VM_SetCurrentMode(int mode) #endif XSync(gdi_display, False); wine_tsx11_unlock(); + X11DRV_handle_desktop_resize( real_xf86vm_modes[mode]->hdisplay, + real_xf86vm_modes[mode]->vdisplay ); } void X11DRV_XF86VM_Init(void) @@ -154,8 +147,6 @@ void X11DRV_XF86VM_Init(void) DWORD dwBpp = screen_depth; if (dwBpp == 24) dwBpp = 32; - in_desktop_mode = (root_window != DefaultRootWindow(gdi_display)); - if (xf86vm_major) return; /* already initialized? */ if (!usexvidmode) return; @@ -182,13 +173,13 @@ void X11DRV_XF86VM_Init(void) #endif /* X_XF86VidModeSetGammaRamp */ /* retrieve modes */ - if (!in_desktop_mode) ok = XF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes, &real_xf86vm_modes); + if (!using_wine_desktop) ok = XF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes, &real_xf86vm_modes); } wine_tsx11_unlock(); if (!ok) return; /* In desktop mode, do not switch resolution... But still use the Gamma ramp stuff */ - if (in_desktop_mode) return; + if (using_wine_desktop) return; TRACE("XVidMode modes: count=%d\n", nmodes);