* Source/x11/XGServerWindow.m (boundsForScreen:): check for number of

XRandR's ouputs.
This commit is contained in:
Sergii Stoian 2020-01-31 18:59:49 +02:00
parent ae3510f385
commit 022a988e97
2 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2020-01-31 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m (boundsForScreen:): check for number of
XRandR's ouputs.
2010-01-31 Riccardo Mottola <rm@gnu.org>
* Source/x11/XGServerWindow.m (boundsForScreen:):

View file

@ -4524,17 +4524,20 @@ _computeDepth(int class, int bpp)
XRRScreenResources *screen_res;
XRROutputInfo *output_info;
screen_res = XRRGetScreenResources(dpy, RootWindow(dpy, screen));
output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[screen]);
if (NULL != output_info && 0 != output_info->crtc)
if (screen_res != NULL && screen_res->noutput > 0)
{
XRRCrtcInfo *crtc_info;
crtc_info = XRRGetCrtcInfo(dpy, screen_res, output_info->crtc);
boundsRect = NSMakeRect(crtc_info->x, crtc_info->y,
crtc_info->width, crtc_info->height);
output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[screen]);
if (NULL != output_info && 0 != output_info->crtc)
{
XRRCrtcInfo *crtc_info;
crtc_info = XRRGetCrtcInfo(dpy, screen_res, output_info->crtc);
boundsRect = NSMakeRect(crtc_info->x, crtc_info->y,
crtc_info->width, crtc_info->height);
}
}
XRRFreeScreenResources(screen_res);
#endif
// no XRandr available or XRR call failed
if (NSEqualRects(boundsRect, NSZeroRect))
{