xrandr: don't restore resolution if output was disconnected during game

This commit is contained in:
Deve 2014-08-20 19:30:28 +02:00
parent 5c4c54bf20
commit 56fa56a38f

View File

@ -253,9 +253,27 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
if (UseXRandR && CreationParams.Fullscreen && old_mode != BadRRMode) if (UseXRandR && CreationParams.Fullscreen && old_mode != BadRRMode)
{ {
XRRScreenResources* res = XRRGetScreenResources(display, DefaultRootWindow(display)); XRRScreenResources* res = XRRGetScreenResources(display, DefaultRootWindow(display));
if (!res)
return false;
XRROutputInfo* output = XRRGetOutputInfo(display, res, output_id); XRROutputInfo* output = XRRGetOutputInfo(display, res, output_id);
if (!output || !output->crtc || output->connection == RR_Disconnected)
{
XRRFreeOutputInfo(output);
return false;
}
XRRCrtcInfo* crtc = XRRGetCrtcInfo(display, res, output->crtc); XRRCrtcInfo* crtc = XRRGetCrtcInfo(display, res, output->crtc);
if (!crtc)
{
XRRFreeCrtcInfo(crtc);
XRRFreeOutputInfo(output);
return false;
}
Status s = XRRSetCrtcConfig(display, res, output->crtc, CurrentTime, Status s = XRRSetCrtcConfig(display, res, output->crtc, CurrentTime,
crtc->x, crtc->y, old_mode, crtc->x, crtc->y, old_mode,
crtc->rotation, &output_id, 1); crtc->rotation, &output_id, 1);