Update the desktop window size and send WM_DISPLAYCHANGE on resolution

changes.
oldstable
Alex Pasadyn 2004-02-13 03:58:21 +00:00 committed by Alexandre Julliard
parent 79692a3fe8
commit a4626a43f5
6 changed files with 34 additions and 33 deletions

View File

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

View File

@ -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
*/

View File

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

View File

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

View File

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

View File

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