1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-30 05:58:52 -05:00

Added flag for non-functional RandR monitor path.

This commit is contained in:
Camilla Berglund 2014-01-22 16:39:34 +01:00
parent 13156de8c3
commit dd02b96c94
3 changed files with 16 additions and 10 deletions

View File

@ -49,6 +49,7 @@ The following dependencies are needed by the examples and test programs:
- Added `glfwSetDropCallback` and `GLFWdropfun` for receiving dropped files - Added `glfwSetDropCallback` and `GLFWdropfun` for receiving dropped files
- [Cocoa] Bugfix: Using a 1x1 cursor for hidden mode caused some screen - [Cocoa] Bugfix: Using a 1x1 cursor for hidden mode caused some screen
recorders to fail recorders to fail
- [X11] Bugfix: The case of finding no usable CRTCs was not detected
## Contact ## Contact

View File

@ -62,7 +62,7 @@ static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id)
// //
void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{ {
if (_glfw.x11.randr.available) if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
{ {
int i, j; int i, j;
XRRScreenResources* sr; XRRScreenResources* sr;
@ -136,7 +136,7 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
// //
void _glfwRestoreVideoMode(_GLFWmonitor* monitor) void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
{ {
if (_glfw.x11.randr.available) if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
{ {
XRRScreenResources* sr; XRRScreenResources* sr;
XRRCrtcInfo* ci; XRRCrtcInfo* ci;
@ -170,13 +170,13 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
_GLFWmonitor** _glfwPlatformGetMonitors(int* count) _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
{ {
int i, found = 0;
_GLFWmonitor** monitors = NULL; _GLFWmonitor** monitors = NULL;
*count = 0; *count = 0;
if (_glfw.x11.randr.available) if (_glfw.x11.randr.available)
{ {
int i, found = 0;
RROutput primary; RROutput primary;
XRRScreenResources* sr; XRRScreenResources* sr;
@ -245,13 +245,16 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
if (found == 0) if (found == 0)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: RandR monitor support seems broken");
_glfw.x11.randr.monitorBroken = GL_TRUE;
free(monitors); free(monitors);
monitors = NULL; monitors = NULL;
} }
*count = found;
} }
else
if (!monitors)
{ {
monitors = calloc(1, sizeof(_GLFWmonitor*)); monitors = calloc(1, sizeof(_GLFWmonitor*));
monitors[0] = _glfwAllocMonitor("Display", monitors[0] = _glfwAllocMonitor("Display",
@ -259,9 +262,10 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
_glfw.x11.screen), _glfw.x11.screen),
DisplayHeightMM(_glfw.x11.display, DisplayHeightMM(_glfw.x11.display,
_glfw.x11.screen)); _glfw.x11.screen));
*count = 1; found = 1;
} }
*count = found;
return monitors; return monitors;
} }
@ -272,7 +276,7 @@ GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
{ {
if (_glfw.x11.randr.available) if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
{ {
XRRScreenResources* sr; XRRScreenResources* sr;
XRRCrtcInfo* ci; XRRCrtcInfo* ci;
@ -309,7 +313,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
// Build array of available resolutions // Build array of available resolutions
if (_glfw.x11.randr.available) if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
{ {
int i, j; int i, j;
XRRScreenResources* sr; XRRScreenResources* sr;
@ -375,7 +379,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
{ {
if (_glfw.x11.randr.available) if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
{ {
XRRScreenResources* sr; XRRScreenResources* sr;
XRRCrtcInfo* ci; XRRCrtcInfo* ci;

View File

@ -164,6 +164,7 @@ typedef struct _GLFWlibraryX11
int versionMajor; int versionMajor;
int versionMinor; int versionMinor;
GLboolean gammaBroken; GLboolean gammaBroken;
GLboolean monitorBroken;
} randr; } randr;
struct { struct {