static LONG xrandr10_set_current_mode( int mode ) { SizeID size; Rotation rot; Window root; XRRScreenConfiguration *sc; Status stat; short rate; root = DefaultRootWindow( gdi_display ); sc = pXRRGetScreenInfo (gdi_display, root); pXRRConfigCurrentConfiguration (sc, &rot); mode = mode % xrandr_mode_count; TRACE("Changing Resolution to %dx%d @%d Hz\n", dd_modes[mode].width, dd_modes[mode].height, dd_modes[mode].refresh_rate); size = xrandr10_modes[mode]; rate = dd_modes[mode].refresh_rate; if (rate) stat = pXRRSetScreenConfigAndRate( gdi_display, sc, root, size, rot, rate, CurrentTime ); else stat = pXRRSetScreenConfig( gdi_display, sc, root, size, rot, CurrentTime ); pXRRFreeScreenConfigInfo(sc); if (stat == RRSetConfigSuccess) { xrandr_current_mode = mode; X11DRV_resize_desktop( dd_modes[mode].width, dd_modes[mode].height ); return DISP_CHANGE_SUCCESSFUL; } ERR("Resolution change not successful -- perhaps display has changed?\n"); return DISP_CHANGE_FAILED; }
static LONG X11DRV_XRandR_SetCurrentMode(int mode) { SizeID size; Rotation rot; Window root; XRRScreenConfiguration *sc; Status stat = RRSetConfigSuccess; short rate; unsigned int i; int j; wine_tsx11_lock(); root = RootWindow (gdi_display, DefaultScreen(gdi_display)); sc = pXRRGetScreenInfo (gdi_display, root); size = pXRRConfigCurrentConfiguration (sc, &rot); mode = mode%real_xrandr_modes_count; TRACE("Changing Resolution to %dx%d @%d Hz\n", dd_modes[mode].dwWidth, dd_modes[mode].dwHeight, dd_modes[mode].wRefreshRate); for (i = 0; i < real_xrandr_sizes_count; i++) { if ( (dd_modes[mode].dwWidth == real_xrandr_sizes[i].width ) && (dd_modes[mode].dwHeight == real_xrandr_sizes[i].height) ) { size = i; if (real_xrandr_rates_count[i]) { for (j=0; j < real_xrandr_rates_count[i]; j++) { if (dd_modes[mode].wRefreshRate == real_xrandr_rates[i][j]) { rate = real_xrandr_rates[i][j]; TRACE("Resizing X display to %dx%d @%d Hz\n", dd_modes[mode].dwWidth, dd_modes[mode].dwHeight, rate); stat = pXRRSetScreenConfigAndRate (gdi_display, sc, root, size, rot, rate, CurrentTime); break; } } } else { TRACE("Resizing X display to %dx%d <default Hz>\n", dd_modes[mode].dwWidth, dd_modes[mode].dwHeight); stat = pXRRSetScreenConfig (gdi_display, sc, root, size, rot, CurrentTime); } break; } } pXRRFreeScreenConfigInfo(sc); wine_tsx11_unlock(); if (stat == RRSetConfigSuccess) { X11DRV_resize_desktop( dd_modes[mode].dwWidth, dd_modes[mode].dwHeight ); return DISP_CHANGE_SUCCESSFUL; } ERR("Resolution change not successful -- perhaps display has changed?\n"); return DISP_CHANGE_FAILED; }