winex11: Cache XRandR 1.0 display mode.
This commit is contained in:
parent
ce4b6451aa
commit
3fc2bccac2
|
@ -68,6 +68,7 @@ static int primary_crtc;
|
||||||
static struct x11drv_mode_info *dd_modes;
|
static struct x11drv_mode_info *dd_modes;
|
||||||
static SizeID *xrandr10_modes;
|
static SizeID *xrandr10_modes;
|
||||||
static unsigned int xrandr_mode_count;
|
static unsigned int xrandr_mode_count;
|
||||||
|
static int xrandr_current_mode = -1;
|
||||||
|
|
||||||
static int load_xrandr(void)
|
static int load_xrandr(void)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +126,9 @@ static int xrandr10_get_current_mode(void)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
|
if (xrandr_current_mode != -1)
|
||||||
|
return xrandr_current_mode;
|
||||||
|
|
||||||
sc = pXRRGetScreenInfo (gdi_display, DefaultRootWindow( gdi_display ));
|
sc = pXRRGetScreenInfo (gdi_display, DefaultRootWindow( gdi_display ));
|
||||||
size = pXRRConfigCurrentConfiguration (sc, &rot);
|
size = pXRRConfigCurrentConfiguration (sc, &rot);
|
||||||
rate = pXRRConfigCurrentRate (sc);
|
rate = pXRRConfigCurrentRate (sc);
|
||||||
|
@ -141,8 +145,10 @@ static int xrandr10_get_current_mode(void)
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
{
|
{
|
||||||
ERR("In unknown mode, returning default\n");
|
ERR("In unknown mode, returning default\n");
|
||||||
res = 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xrandr_current_mode = res;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +183,7 @@ static LONG xrandr10_set_current_mode( int mode )
|
||||||
|
|
||||||
if (stat == RRSetConfigSuccess)
|
if (stat == RRSetConfigSuccess)
|
||||||
{
|
{
|
||||||
|
xrandr_current_mode = mode;
|
||||||
X11DRV_resize_desktop( dd_modes[mode].width, dd_modes[mode].height );
|
X11DRV_resize_desktop( dd_modes[mode].width, dd_modes[mode].height );
|
||||||
return DISP_CHANGE_SUCCESSFUL;
|
return DISP_CHANGE_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue