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));
462 "X11: Gamma ramp size must match current ramp size");
468 memcpy(gamma->red, ramp->
red, ramp->
size *
sizeof(
unsigned short));
469 memcpy(gamma->green, ramp->
green, ramp->
size *
sizeof(
unsigned short));
470 memcpy(gamma->blue, ramp->
blue, ramp->
size *
sizeof(
unsigned short));
480 (
unsigned short*) ramp->
red,
481 (
unsigned short*) ramp->
green,
482 (
unsigned short*) ramp->
blue);
495 return monitor->x11.crtc;
502 return monitor->x11.output;
void _glfwPlatformSetGammaRamp(_GLFWmonitor *monitor, const GLFWgammaramp *ramp)
void _glfwAllocGammaArrays(GLFWgammaramp *ramp, unsigned int size)
GLuint64 GLenum void * handle
void _glfwSetVideoModeX11(_GLFWmonitor *monitor, const GLFWvidmode *desired)
void _glfwSplitBPP(int bpp, int *red, int *green, int *blue)
static GLFWbool modeIsGood(const XRRModeInfo *mi)
struct GLFWmonitor GLFWmonitor
_GLFWmonitor * _glfwAllocMonitor(const char *name, int widthMM, int heightMM)
void _glfwPlatformGetMonitorPos(_GLFWmonitor *monitor, int *xpos, int *ypos)
#define GLFW_DISCONNECTED
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor *handle)
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
static const XRRModeInfo * getModeInfo(const XRRScreenResources *sr, RRMode id)
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor *handle)
void _glfwPlatformGetMonitorContentScale(_GLFWmonitor *monitor, float *xscale, float *yscale)
void _glfwInputError(int code, const char *format,...)
void _glfwInputMonitor(_GLFWmonitor *monitor, int action, int placement)
void _glfwPollMonitorsX11(void)
void _glfwPlatformFreeMonitor(_GLFWmonitor *monitor)
int _glfwCompareVideoModes(const GLFWvidmode *first, const GLFWvidmode *second)
static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo *mi, const XRRCrtcInfo *ci)
#define _GLFW_INSERT_FIRST
void _glfwRestoreVideoModeX11(_GLFWmonitor *monitor)
void _glfwPlatformGetVideoMode(_GLFWmonitor *monitor, GLFWvidmode *mode)
static int calculateRefreshRate(const XRRModeInfo *mi)
void _glfwPlatformGetGammaRamp(_GLFWmonitor *monitor, GLFWgammaramp *ramp)
GLFWvidmode * _glfwPlatformGetVideoModes(_GLFWmonitor *monitor, int *count)
const GLFWvidmode * _glfwChooseVideoMode(_GLFWmonitor *monitor, const GLFWvidmode *desired)
#define _GLFW_INSERT_LAST