mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 04:00:00 +00:00
Fix an X11 error when getting the display mode of an offline display
This commit is contained in:
parent
b764b02d43
commit
27e492a773
@ -287,21 +287,26 @@ static NSDictionary* modeInfoToDictionary(const XRRModeInfo* mi, int depth) {
|
||||
}
|
||||
|
||||
XRROutputInfo* oinfo = XRRGetOutputInfo(_display, screen, screen->outputs[screenIndex]);
|
||||
XRRCrtcInfo *crtc = XRRGetCrtcInfo(_display, screen, oinfo->crtc);
|
||||
|
||||
for (int i = 0; i < screen->nmode; i++)
|
||||
|
||||
if (oinfo->crtc)
|
||||
{
|
||||
if (screen->modes[i].id == crtc->mode)
|
||||
{
|
||||
const int defaultDepth = XDefaultDepthOfScreen(XDefaultScreenOfDisplay(_display));
|
||||
dict = modeInfoToDictionary(&screen->modes[i], defaultDepth);
|
||||
XRRCrtcInfo *crtc = XRRGetCrtcInfo(_display, screen, oinfo->crtc);
|
||||
|
||||
break;
|
||||
for (int i = 0; i < screen->nmode; i++)
|
||||
{
|
||||
if (screen->modes[i].id == crtc->mode)
|
||||
{
|
||||
const int defaultDepth = XDefaultDepthOfScreen(XDefaultScreenOfDisplay(_display));
|
||||
dict = modeInfoToDictionary(&screen->modes[i], defaultDepth);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XRRFreeCrtcInfo(crtc);
|
||||
}
|
||||
|
||||
XRRFreeOutputInfo(oinfo);
|
||||
XRRFreeCrtcInfo(crtc);
|
||||
XRRFreeScreenResources(screen);
|
||||
}
|
||||
return dict;
|
||||
|
Loading…
Reference in New Issue
Block a user