xrandr: update width and height params when wanted resolution was not found and we get the default one.

This commit is contained in:
Deve 2014-08-03 21:56:16 +02:00
parent b15c902aee
commit 15b316a9af

View File

@ -345,6 +345,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
XRROutputInfo* output = XRRGetOutputInfo(display, res, output_id);
XRRCrtcInfo* crtc = XRRGetCrtcInfo(display, res, output->crtc);
float refresh_rate, refresh_rate_new;
unsigned int mode0_width = -1, mode0_height = -1;
for (int i = 0; i < res->nmode; i++)
{
@ -362,6 +363,12 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
h = mode->height;
}
if (bestMode == -1 && mode->id == output->modes[0])
{
mode0_width = w;
mode0_height = h;
}
if (bestMode == -1 && w == Width && h == Height)
{
for (int j = 0; j < output->nmode; j++)
@ -397,6 +404,8 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
if (bestMode == -1)
{
bestMode = 0;
Width = mode0_width;
Height = mode0_height;
}
Status s = XRRSetCrtcConfig(display, res, output->crtc, CurrentTime,