39 return (mi->modeFlags & RR_Interlace) == 0;
46 if (mi->hTotal && mi->vTotal)
47 return (
int) ((double) mi->dotClock / ((
double) mi->hTotal * (double) mi->vTotal));
54 static const XRRModeInfo*
getModeInfo(
const XRRScreenResources* sr, RRMode
id)
58 for (i = 0; i < sr->nmode; i++)
60 if (sr->modes[i].id ==
id)
70 const XRRCrtcInfo* ci)
74 if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
76 mode.
width = mi->height;
81 mode.
width = mi->width;
104 int i, j, disconnectedCount, screenCount = 0;
106 XineramaScreenInfo* screens =
NULL;
116 if (disconnectedCount)
124 for (i = 0; i < sr->noutput; i++)
126 int type, widthMM, heightMM;
132 if (oi->connection != RR_Connected || oi->crtc ==
None)
138 for (j = 0; j < disconnectedCount; j++)
140 if (disconnected[j] &&
141 disconnected[j]->x11.output == sr->outputs[i])
143 disconnected[j] =
NULL;
148 if (j < disconnectedCount)
155 if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
157 widthMM = oi->mm_height;
158 heightMM = oi->mm_width;
162 widthMM = oi->mm_width;
163 heightMM = oi->mm_height;
167 monitor->x11.output = sr->outputs[i];
168 monitor->x11.crtc = oi->crtc;
170 for (j = 0; j < screenCount; j++)
172 if (screens[j].x_org == ci->x &&
173 screens[j].y_org == ci->y &&
174 screens[j].width == ci->width &&
175 screens[j].height == ci->height)
177 monitor->x11.index = j;
182 if (monitor->x11.output == primary)
198 for (i = 0; i < disconnectedCount; i++)
208 const int widthMM = DisplayWidthMM(
_glfw.x11.display,
_glfw.x11.screen);
209 const int heightMM = DisplayHeightMM(
_glfw.x11.display,
_glfw.x11.screen);
223 XRRScreenResources* sr;
228 RRMode native =
None;
240 for (i = 0; i < oi->nmode; i++)
242 const XRRModeInfo* mi =
getModeInfo(sr, oi->modes[i]);
256 if (monitor->x11.oldMode ==
None)
257 monitor->x11.oldMode = ci->mode;
260 sr, monitor->x11.crtc,
281 XRRScreenResources* sr;
284 if (monitor->x11.oldMode ==
None)
291 sr, monitor->x11.crtc,
294 monitor->x11.oldMode,
302 monitor->x11.oldMode =
None;
319 XRRScreenResources* sr;
336 float* xscale,
float* yscale)
339 *xscale =
_glfw.x11.contentScaleX;
341 *yscale =
_glfw.x11.contentScaleY;
353 XRRScreenResources* sr;
363 for (i = 0; i < oi->nmode; i++)
365 const XRRModeInfo* mi =
getModeInfo(sr, oi->modes[i]);
371 for (j = 0; j < *count; j++)
382 result[*count - 1] = mode;
403 XRRScreenResources* sr;
436 memcpy(ramp->
red, gamma->red, size *
sizeof(
unsigned short));
437 memcpy(ramp->
green, gamma->green, size *
sizeof(
unsigned short));
438 memcpy(ramp->
blue, gamma->blue, size *
sizeof(
unsigned short));
458 "X11: Gamma ramp access not supported by server");
470 "X11: Gamma ramp size must match current ramp size");
476 memcpy(gamma->red, ramp->
red, ramp->
size *
sizeof(
unsigned short));
477 memcpy(gamma->green, ramp->
green, ramp->
size *
sizeof(
unsigned short));
478 memcpy(gamma->blue, ramp->
blue, ramp->
size *
sizeof(
unsigned short));
488 (
unsigned short*) ramp->
red,
489 (
unsigned short*) ramp->
green,
490 (
unsigned short*) ramp->
blue);
495 "X11: Gamma ramp access not supported by server");
508 return monitor->x11.crtc;
515 return monitor->x11.output;