glfw/src/x11_fullscreen.c

535 lines
16 KiB
C
Raw Normal View History

2010-09-07 15:34:51 +00:00
//========================================================================
// GLFW - An OpenGL library
2010-09-07 15:34:51 +00:00
// Platform: X11/GLX
2010-09-07 15:41:26 +00:00
// API version: 3.0
2010-09-07 15:34:51 +00:00
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include "internal.h"
#include <limits.h>
#include <stdlib.h>
2012-08-02 16:03:43 +00:00
#include <string.h>
2010-09-07 15:34:51 +00:00
2010-09-15 14:44:43 +00:00
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
2010-09-07 15:34:51 +00:00
//========================================================================
// Finds the video mode closest in size to the specified desired size
//========================================================================
2012-04-05 14:14:01 +00:00
int _glfwGetClosestVideoMode(int* width, int* height, int* rate)
2010-09-07 15:34:51 +00:00
{
int i, match, bestmatch;
2010-10-13 21:05:17 +00:00
if (_glfwLibrary.X11.RandR.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XRANDR)
2011-09-26 13:38:11 +00:00
int sizecount, bestsize;
int ratecount, bestrate;
short* ratelist;
XRRScreenConfiguration* sc;
XRRScreenSize* sizelist;
2012-04-05 14:14:01 +00:00
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
2010-09-07 15:34:51 +00:00
2010-09-08 13:51:25 +00:00
sizelist = XRRConfigSizes(sc, &sizecount);
2010-09-07 15:34:51 +00:00
// Find the best matching mode
bestsize = -1;
bestmatch = INT_MAX;
2010-09-08 13:51:25 +00:00
for (i = 0; i < sizecount; i++)
2010-09-07 15:34:51 +00:00
{
match = (*width - sizelist[i].width) *
(*width - sizelist[i].width) +
(*height - sizelist[i].height) *
(*height - sizelist[i].height);
2010-09-08 13:51:25 +00:00
if (match < bestmatch)
2010-09-07 15:34:51 +00:00
{
bestmatch = match;
bestsize = i;
}
}
2010-09-08 13:51:25 +00:00
if (bestsize != -1)
2010-09-07 15:34:51 +00:00
{
// Report width & height of best matching mode
*width = sizelist[bestsize].width;
*height = sizelist[bestsize].height;
2010-09-08 13:51:25 +00:00
if (*rate > 0)
2010-09-07 15:34:51 +00:00
{
2010-09-08 13:51:25 +00:00
ratelist = XRRConfigRates(sc, bestsize, &ratecount);
2010-09-07 15:34:51 +00:00
bestrate = -1;
bestmatch = INT_MAX;
2010-09-08 13:51:25 +00:00
for (i = 0; i < ratecount; i++)
2010-09-07 15:34:51 +00:00
{
2010-09-08 13:51:25 +00:00
match = abs(ratelist[i] - *rate);
if (match < bestmatch)
2010-09-07 15:34:51 +00:00
{
bestmatch = match;
bestrate = ratelist[i];
}
}
2010-09-08 13:51:25 +00:00
if (bestrate != -1)
2010-09-07 15:34:51 +00:00
*rate = bestrate;
}
}
2010-09-08 13:51:25 +00:00
XRRFreeScreenConfigInfo(sc);
2010-09-07 15:34:51 +00:00
2010-09-08 13:51:25 +00:00
if (bestsize != -1)
2010-09-07 15:34:51 +00:00
return bestsize;
#endif /*_GLFW_HAS_XRANDR*/
2010-09-07 15:34:51 +00:00
}
else if (_glfwLibrary.X11.VidMode.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XF86VIDMODE)
2011-09-26 13:38:11 +00:00
XF86VidModeModeInfo** modelist;
int bestmode, modecount;
2010-09-07 15:34:51 +00:00
// Get a list of all available display modes
2012-04-05 14:14:01 +00:00
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
2010-09-08 13:51:25 +00:00
&modecount, &modelist);
2010-09-07 15:34:51 +00:00
// Find the best matching mode
bestmode = -1;
bestmatch = INT_MAX;
2010-09-08 13:51:25 +00:00
for (i = 0; i < modecount; i++)
2010-09-07 15:34:51 +00:00
{
match = (*width - modelist[i]->hdisplay) *
(*width - modelist[i]->hdisplay) +
(*height - modelist[i]->vdisplay) *
(*height - modelist[i]->vdisplay);
2010-09-08 13:51:25 +00:00
if (match < bestmatch)
2010-09-07 15:34:51 +00:00
{
bestmatch = match;
bestmode = i;
}
}
2010-09-08 13:51:25 +00:00
if (bestmode != -1)
2010-09-07 15:34:51 +00:00
{
// Report width & height of best matching mode
2010-09-08 13:51:25 +00:00
*width = modelist[bestmode]->hdisplay;
*height = modelist[bestmode]->vdisplay;
2010-09-07 15:34:51 +00:00
}
2010-09-08 13:51:25 +00:00
XFree(modelist);
2010-09-07 15:34:51 +00:00
2010-09-08 13:51:25 +00:00
if (bestmode != -1)
2010-09-07 15:34:51 +00:00
return bestmode;
#endif /*_GLFW_HAS_XF86VIDMODE*/
2010-09-07 15:34:51 +00:00
}
// Default: Simply use the screen resolution
2012-04-05 14:14:01 +00:00
*width = DisplayWidth(_glfwLibrary.X11.display, _glfwLibrary.X11.screen);
*height = DisplayHeight(_glfwLibrary.X11.display, _glfwLibrary.X11.screen);
2010-09-07 15:34:51 +00:00
return 0;
}
//========================================================================
// Change the current video mode
//========================================================================
2012-04-05 14:14:01 +00:00
void _glfwSetVideoModeMODE(int mode, int rate)
2010-09-07 15:34:51 +00:00
{
2010-10-13 21:05:17 +00:00
if (_glfwLibrary.X11.RandR.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XRANDR)
2011-09-26 13:38:11 +00:00
XRRScreenConfiguration* sc;
Window root;
2012-04-05 14:14:01 +00:00
root = _glfwLibrary.X11.root;
2010-09-09 16:15:32 +00:00
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, root);
2010-09-07 15:34:51 +00:00
// Remember old size and flag that we have changed the mode
2010-09-09 16:15:32 +00:00
if (!_glfwLibrary.X11.FS.modeChanged)
2010-09-07 15:34:51 +00:00
{
2010-09-09 16:15:32 +00:00
_glfwLibrary.X11.FS.oldSizeID = XRRConfigCurrentConfiguration(sc, &_glfwLibrary.X11.FS.oldRotation);
2012-04-05 14:14:01 +00:00
_glfwLibrary.X11.FS.oldWidth = DisplayWidth(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen);
_glfwLibrary.X11.FS.oldHeight = DisplayHeight(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen);
2010-09-07 15:34:51 +00:00
2010-09-09 16:15:32 +00:00
_glfwLibrary.X11.FS.modeChanged = GL_TRUE;
2010-09-07 15:34:51 +00:00
}
2010-09-08 13:51:25 +00:00
if (rate > 0)
2010-09-07 15:34:51 +00:00
{
// Set desired configuration
2010-09-09 16:15:32 +00:00
XRRSetScreenConfigAndRate(_glfwLibrary.X11.display,
2010-09-08 13:51:25 +00:00
sc,
root,
mode,
RR_Rotate_0,
(short) rate,
CurrentTime);
2010-09-07 15:34:51 +00:00
}
else
{
// Set desired configuration
2010-09-09 16:15:32 +00:00
XRRSetScreenConfig(_glfwLibrary.X11.display,
2010-09-08 13:51:25 +00:00
sc,
root,
mode,
RR_Rotate_0,
CurrentTime);
2010-09-07 15:34:51 +00:00
}
2010-09-08 13:51:25 +00:00
XRRFreeScreenConfigInfo(sc);
#endif /*_GLFW_HAS_XRANDR*/
2010-09-07 15:34:51 +00:00
}
else if (_glfwLibrary.X11.VidMode.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XF86VIDMODE)
2011-09-26 13:38:11 +00:00
XF86VidModeModeInfo **modelist;
int modecount;
2010-09-07 15:34:51 +00:00
// Get a list of all available display modes
2012-04-05 14:14:01 +00:00
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
2010-09-08 13:51:25 +00:00
&modecount, &modelist);
2010-09-07 15:34:51 +00:00
// Unlock mode switch if necessary
2010-09-09 16:15:32 +00:00
if (_glfwLibrary.X11.FS.modeChanged)
2012-04-05 14:14:01 +00:00
{
XF86VidModeLockModeSwitch(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
0);
}
2010-09-07 15:34:51 +00:00
// Change the video mode to the desired mode
2012-04-05 14:14:01 +00:00
XF86VidModeSwitchToMode(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
modelist[mode]);
2010-09-07 15:34:51 +00:00
// Set viewport to upper left corner (where our window will be)
2012-04-05 14:14:01 +00:00
XF86VidModeSetViewPort(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
0, 0);
2010-09-07 15:34:51 +00:00
// Lock mode switch
2012-04-05 14:14:01 +00:00
XF86VidModeLockModeSwitch(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
1);
2010-09-07 15:34:51 +00:00
// Remember old mode and flag that we have changed the mode
2010-09-09 16:15:32 +00:00
if (!_glfwLibrary.X11.FS.modeChanged)
2010-09-07 15:34:51 +00:00
{
2010-09-09 16:15:32 +00:00
_glfwLibrary.X11.FS.oldMode = *modelist[0];
_glfwLibrary.X11.FS.modeChanged = GL_TRUE;
2010-09-07 15:34:51 +00:00
}
2010-09-08 13:51:25 +00:00
XFree(modelist);
#endif /*_GLFW_HAS_XF86VIDMODE*/
2010-09-07 15:34:51 +00:00
}
}
//========================================================================
// Change the current video mode
//========================================================================
2012-04-05 14:14:01 +00:00
void _glfwSetVideoMode(int* width, int* height, int* rate)
2010-09-07 15:34:51 +00:00
{
int bestmode;
2010-09-07 15:34:51 +00:00
// Find a best match mode
2012-04-05 14:14:01 +00:00
bestmode = _glfwGetClosestVideoMode(width, height, rate);
2010-09-07 15:34:51 +00:00
// Change mode
2012-04-05 14:14:01 +00:00
_glfwSetVideoModeMODE(bestmode, *rate);
2010-09-07 15:34:51 +00:00
}
//========================================================================
// Restore the previously saved (original) video mode
//========================================================================
2012-04-05 14:14:01 +00:00
void _glfwRestoreVideoMode(void)
2010-09-07 15:34:51 +00:00
{
2010-09-09 16:15:32 +00:00
if (_glfwLibrary.X11.FS.modeChanged)
2010-09-07 15:34:51 +00:00
{
2010-10-13 21:05:17 +00:00
if (_glfwLibrary.X11.RandR.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XRANDR)
2010-09-08 13:58:43 +00:00
XRRScreenConfiguration* sc;
2010-09-07 15:34:51 +00:00
2010-10-13 21:05:17 +00:00
if (_glfwLibrary.X11.RandR.available)
2010-09-07 15:34:51 +00:00
{
sc = XRRGetScreenInfo(_glfwLibrary.X11.display,
_glfwLibrary.X11.root);
2010-09-07 15:34:51 +00:00
2010-09-09 16:15:32 +00:00
XRRSetScreenConfig(_glfwLibrary.X11.display,
2010-09-08 13:51:25 +00:00
sc,
_glfwLibrary.X11.root,
2010-09-09 16:15:32 +00:00
_glfwLibrary.X11.FS.oldSizeID,
_glfwLibrary.X11.FS.oldRotation,
2010-09-08 13:51:25 +00:00
CurrentTime);
2010-09-07 15:34:51 +00:00
2010-09-08 13:51:25 +00:00
XRRFreeScreenConfigInfo(sc);
2010-09-07 15:34:51 +00:00
}
#endif /*_GLFW_HAS_XRANDR*/
2010-09-07 15:34:51 +00:00
}
else if (_glfwLibrary.X11.VidMode.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XF86VIDMODE)
2010-09-07 15:34:51 +00:00
// Unlock mode switch
2012-04-05 14:14:01 +00:00
XF86VidModeLockModeSwitch(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
0);
2010-09-07 15:34:51 +00:00
// Change the video mode back to the old mode
2010-09-09 16:15:32 +00:00
XF86VidModeSwitchToMode(_glfwLibrary.X11.display,
2012-04-05 14:14:01 +00:00
_glfwLibrary.X11.screen,
2010-09-09 16:15:32 +00:00
&_glfwLibrary.X11.FS.oldMode);
#endif /*_GLFW_HAS_XF86VIDMODE*/
2010-09-07 15:34:51 +00:00
}
2010-09-09 16:15:32 +00:00
_glfwLibrary.X11.FS.modeChanged = GL_FALSE;
2010-09-07 15:34:51 +00:00
}
}
2010-09-15 14:44:43 +00:00
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
typedef struct
2010-09-07 15:34:51 +00:00
{
int width;
int height;
2012-08-02 16:03:43 +00:00
} _GLFWvidsize;
2010-09-07 15:34:51 +00:00
//========================================================================
// List available video modes
//========================================================================
2012-08-02 16:03:43 +00:00
GLFWvidmode* _glfwPlatformGetVideoModes(int* found)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
XVisualInfo* visuals;
2010-09-08 13:58:43 +00:00
XVisualInfo dummy;
2012-08-02 16:03:43 +00:00
int i, j, visualCount, sizeCount, rgbCount;
int* rgbs;
_GLFWvidsize* sizes;
GLFWvidmode* result;
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
visuals = XGetVisualInfo(_glfwLibrary.X11.display, 0, &dummy, &visualCount);
if (visuals == NULL)
{
2011-09-26 13:40:18 +00:00
_glfwSetError(GLFW_PLATFORM_ERROR,
"X11/GLX: Failed to retrieve the available visuals");
2010-09-07 15:34:51 +00:00
return 0;
}
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
// Build array of available RGB channel depths
rgbs = (int*) malloc(sizeof(int) * visualCount);
rgbCount = 0;
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
for (i = 0; i < visualCount; i++)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
int gl, rgba, rgb, r, g, b;
glXGetConfig(_glfwLibrary.X11.display, &visuals[i], GLX_USE_GL, &gl);
glXGetConfig(_glfwLibrary.X11.display, &visuals[i], GLX_RGBA, &rgba);
if (!gl || !rgba)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
// The visual lacks OpenGL or true color, so skip it
continue;
}
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
// Convert to RGB channel depths and encode
_glfwSplitBPP(visuals[i].depth, &r, &g, &b);
rgb = (r << 16) | (g << 8) | b;
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
for (j = 0; j < rgbCount; j++)
{
if (rgbs[j] == rgb)
break;
}
2012-08-02 16:03:43 +00:00
if (j < rgbCount)
{
// This channel depth is a duplicate, so skip it
continue;
2010-09-07 15:34:51 +00:00
}
2012-08-02 16:03:43 +00:00
rgbs[rgbCount] = rgb;
rgbCount++;
2010-09-07 15:34:51 +00:00
}
2012-08-02 16:03:43 +00:00
XFree(visuals);
2012-03-07 17:38:08 +00:00
2012-08-02 16:03:43 +00:00
sizeCount = 0;
sizes = NULL;
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
// Build array of available resolutions
2010-10-13 21:05:17 +00:00
if (_glfwLibrary.X11.RandR.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XRANDR)
2011-09-26 13:38:11 +00:00
XRRScreenConfiguration* sc;
2012-08-02 16:03:43 +00:00
XRRScreenSize* rrSizes;
2011-09-26 13:38:11 +00:00
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
2012-08-02 16:03:43 +00:00
rrSizes = XRRConfigSizes(sc, &sizeCount);
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
sizes = (_GLFWvidsize*) malloc(sizeof(_GLFWvidsize) * sizeCount);
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
for (i = 0; i < sizeCount; i++)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
sizes[i].width = rrSizes[i].width;
sizes[i].height = rrSizes[i].height;
2010-09-07 15:34:51 +00:00
}
2010-09-08 13:51:25 +00:00
XRRFreeScreenConfigInfo(sc);
#endif /*_GLFW_HAS_XRANDR*/
2010-09-07 15:34:51 +00:00
}
else if (_glfwLibrary.X11.VidMode.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XF86VIDMODE)
2012-08-02 16:03:43 +00:00
XF86VidModeModeInfo** modes;
int modeCount;
2011-09-26 13:38:11 +00:00
2012-04-05 14:14:01 +00:00
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen,
2012-08-02 16:03:43 +00:00
&modeCount, &modes);
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
sizes = (_GLFWvidsize*) malloc(sizeof(_GLFWvidsize) * modeCount);
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
for (i = 0; i < modeCount; i++)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
_GLFWvidsize size;
size.width = modes[i]->hdisplay;
size.height = modes[i]->vdisplay;
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
for (j = 0; j < sizeCount; j++)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
if (memcmp(sizes + j, &size, sizeof(_GLFWvidsize)) == 0)
2010-09-07 15:34:51 +00:00
break;
}
2012-08-02 16:03:43 +00:00
if (j < sizeCount)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
// This size is a duplicate, so skip it
continue;
2010-09-07 15:34:51 +00:00
}
2012-08-02 16:03:43 +00:00
sizes[sizeCount] = size;
sizeCount++;
2010-09-07 15:34:51 +00:00
}
2012-08-02 16:03:43 +00:00
XFree(modes);
#endif /*_GLFW_HAS_XF86VIDMODE*/
2010-09-07 15:34:51 +00:00
}
2012-08-02 16:03:43 +00:00
if (!sizeCount)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
sizeCount = 1;
sizes = (_GLFWvidsize*) malloc(sizeof(_GLFWvidsize));
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
sizes[0].width = DisplayWidth(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen);
sizes[0].height = DisplayHeight(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen);
2010-09-07 15:34:51 +00:00
}
2012-08-02 16:03:43 +00:00
// Build all permutations of channel depths and resolutions
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * rgbCount * sizeCount);
*found = 0;
for (i = 0; i < rgbCount; i++)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
for (j = 0; j < sizeCount; j++)
2010-09-07 15:34:51 +00:00
{
2012-08-02 16:03:43 +00:00
result[*found].width = sizes[j].width;
result[*found].height = sizes[j].height;
result[*found].redBits = (rgbs[i] >> 16) & 255;
result[*found].greenBits = (rgbs[i] >> 8) & 255;
result[*found].blueBits = rgbs[i] & 255;
(*found)++;
2010-09-07 15:34:51 +00:00
}
}
2012-08-02 16:03:43 +00:00
free(sizes);
free(rgbs);
2010-09-07 15:34:51 +00:00
2012-08-02 16:03:43 +00:00
return result;
2010-09-07 15:34:51 +00:00
}
//========================================================================
// Get the desktop video mode
//========================================================================
2010-09-08 13:58:43 +00:00
void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
2010-09-07 15:34:51 +00:00
{
2010-10-30 20:58:54 +00:00
int bpp;
2010-09-07 15:34:51 +00:00
2011-09-26 13:38:11 +00:00
// Get and split display depth
2010-10-30 20:58:54 +00:00
bpp = DefaultDepth(_glfwLibrary.X11.display, _glfwLibrary.X11.screen);
_glfwSplitBPP(bpp, &mode->redBits, &mode->greenBits, &mode->blueBits);
2010-09-07 15:34:51 +00:00
if (_glfwLibrary.X11.FS.modeChanged)
2010-09-07 15:34:51 +00:00
{
if (_glfwLibrary.X11.RandR.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XRANDR)
2010-09-09 16:15:32 +00:00
mode->width = _glfwLibrary.X11.FS.oldWidth;
mode->height = _glfwLibrary.X11.FS.oldHeight;
#endif /*_GLFW_HAS_XRANDR*/
2010-09-07 15:34:51 +00:00
}
else if (_glfwLibrary.X11.VidMode.available)
2010-09-07 15:34:51 +00:00
{
#if defined(_GLFW_HAS_XF86VIDMODE)
2010-09-09 16:15:32 +00:00
mode->width = _glfwLibrary.X11.FS.oldMode.hdisplay;
mode->height = _glfwLibrary.X11.FS.oldMode.vdisplay;
#endif /*_GLFW_HAS_XF86VIDMODE*/
2010-09-07 15:34:51 +00:00
}
}
else
{
2010-11-04 22:16:57 +00:00
mode->width = DisplayWidth(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen);
mode->height = DisplayHeight(_glfwLibrary.X11.display,
_glfwLibrary.X11.screen);
}
2010-09-07 15:34:51 +00:00
}