mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Merge branch 'master' of git://213.114.174.105
This commit is contained in:
commit
41ff44d093
@ -130,7 +130,7 @@ add_subdirectory(tests)
|
||||
#--------------------------------------------------------------------
|
||||
# Create shared configuration header
|
||||
#--------------------------------------------------------------------
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/config.h.cmake
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/config.h.in
|
||||
${GLFW_BINARY_DIR}/src/config.h @ONLY)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -275,6 +275,7 @@ version of GLFW.</p>
|
||||
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
||||
<li>Added a parameter to <code>glfwOpenWindow</code> for specifying a context the new window's context will share objects with</li>
|
||||
<li>Added initial window title parameter to <code>glfwOpenWindow</code></li>
|
||||
<li>Added <code>glfwSetGammaFormula</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li>
|
||||
<li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li>
|
||||
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
|
||||
<li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li>
|
||||
|
@ -67,6 +67,7 @@ typedef const GLubyte* (APIENTRY *PFNGLGETSTRINGIPROC)(GLenum, GLuint);
|
||||
//------------------------------------------------------------------------
|
||||
typedef intptr_t GLFWintptr;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific OpenGL context structure
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -1,24 +0,0 @@
|
||||
/* Configure build time options of GLFW */
|
||||
|
||||
/* Define this to 1 if XRandR is available */
|
||||
#cmakedefine _GLFW_HAS_XRANDR 1
|
||||
/* Define this to 1 if Xf86VidMode is available */
|
||||
#cmakedefine _GLFW_HAS_XF86VIDMODE 1
|
||||
|
||||
/* Define this to 1 if glXGetProcAddress is available */
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS 1
|
||||
/* Define this to 1 if glXGetProcAddressARB is available */
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSARB 1
|
||||
/* Define this to 1 if glXGetProcAddressEXT is available */
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT 1
|
||||
|
||||
/* Define this to 1 if the Linux joystick API is available */
|
||||
#cmakedefine _GLFW_USE_LINUX_JOYSTICKS 1
|
||||
|
||||
/* Define this to 1 to not load gdi32.dll dynamically */
|
||||
#cmakedefine _GLFW_NO_DLOAD_GDI32 1
|
||||
/* Define this to 1 to not load winmm.dll dynamically */
|
||||
#cmakedefine _GLFW_NO_DLOAD_WINMM 1
|
||||
|
||||
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"
|
||||
|
60
src/config.h.in
Normal file
60
src/config.h.in
Normal file
@ -0,0 +1,60 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL framework
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 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.
|
||||
//
|
||||
//========================================================================
|
||||
// As config.h.in, this file is used by CMake to produce the config.h shared
|
||||
// configuration header file. If you are adding a feature requiring
|
||||
// conditional compilation, this is the proper place to add the macros.
|
||||
//========================================================================
|
||||
// As config.h, this file defines compile-time build options and macros for
|
||||
// all platforms supported by GLFW. As this is a generated file, don't modify
|
||||
// it. Instead, you should modify the config.h.in file.
|
||||
//========================================================================
|
||||
|
||||
// Define this to 1 if XRandR is available
|
||||
#cmakedefine _GLFW_HAS_XRANDR 1
|
||||
// Define this to 1 if Xf86VidMode is available
|
||||
#cmakedefine _GLFW_HAS_XF86VIDMODE 1
|
||||
|
||||
// Define this to 1 if glXGetProcAddress is available
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS 1
|
||||
// Define this to 1 if glXGetProcAddressARB is available
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSARB 1
|
||||
// Define this to 1 if glXGetProcAddressEXT is available
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT 1
|
||||
|
||||
// Define this to 1 if the Linux joystick API is available
|
||||
#cmakedefine _GLFW_USE_LINUX_JOYSTICKS 1
|
||||
|
||||
// Define this to 1 to not load gdi32.dll dynamically
|
||||
#cmakedefine _GLFW_NO_DLOAD_GDI32 1
|
||||
// Define this to 1 to not load winmm.dll dynamically
|
||||
#cmakedefine _GLFW_NO_DLOAD_WINMM 1
|
||||
|
||||
// The GLFW version as used by glfwGetVersionString
|
||||
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"
|
||||
|
@ -205,6 +205,7 @@ struct _GLFWwindow
|
||||
int glForward, glDebug, glProfile;
|
||||
PFNGLGETSTRINGIPROC GetStringi;
|
||||
|
||||
// These are defined in the current port's platform.h
|
||||
_GLFW_PLATFORM_WINDOW_STATE;
|
||||
_GLFW_PLATFORM_CONTEXT_STATE;
|
||||
};
|
||||
@ -226,6 +227,7 @@ struct _GLFWlibrary
|
||||
GLFWgammaramp originalRamp;
|
||||
int originalRampSize;
|
||||
|
||||
// This is defined in the current port's platform.h
|
||||
_GLFW_PLATFORM_LIBRARY_STATE;
|
||||
};
|
||||
|
||||
|
@ -66,10 +66,6 @@
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
// Pointer length integer
|
||||
// One day, this will most likely move into glfw.h
|
||||
typedef intptr_t GLFWintptr;
|
||||
|
||||
|
||||
#ifndef GL_VERSION_3_0
|
||||
|
||||
@ -83,10 +79,15 @@ typedef const GLubyte* (APIENTRY *PFNGLGETSTRINGIPROC)(GLenum, GLuint);
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
|
||||
|
||||
|
||||
//========================================================================
|
||||
// GLFW platform specific types
|
||||
//========================================================================
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Pointer length integer
|
||||
//------------------------------------------------------------------------
|
||||
typedef intptr_t GLFWintptr;
|
||||
|
||||
//========================================================================
|
||||
// Global variables (GLFW internals)
|
||||
//========================================================================
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific OpenGL context structure
|
||||
@ -168,25 +169,25 @@ typedef struct _GLFWlibraryX11
|
||||
|
||||
// Screensaver data
|
||||
struct {
|
||||
int changed;
|
||||
int timeout;
|
||||
int interval;
|
||||
int blanking;
|
||||
int exposure;
|
||||
GLboolean changed;
|
||||
int timeout;
|
||||
int interval;
|
||||
int blanking;
|
||||
int exposure;
|
||||
} saver;
|
||||
|
||||
// Fullscreen data
|
||||
struct {
|
||||
int modeChanged;
|
||||
GLboolean modeChanged;
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
SizeID oldSizeID;
|
||||
int oldWidth;
|
||||
int oldHeight;
|
||||
Rotation oldRotation;
|
||||
#endif
|
||||
SizeID oldSizeID;
|
||||
int oldWidth;
|
||||
int oldHeight;
|
||||
Rotation oldRotation;
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo oldMode;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
} FS;
|
||||
|
||||
// Timer data
|
||||
@ -196,7 +197,7 @@ typedef struct _GLFWlibraryX11
|
||||
} timer;
|
||||
|
||||
#if defined(_GLFW_DLOPEN_LIBGL)
|
||||
void* libGL; // dlopen handle for libGL.so
|
||||
void* libGL; // dlopen handle for libGL.so
|
||||
#endif
|
||||
} _GLFWlibraryX11;
|
||||
|
||||
|
@ -51,15 +51,15 @@ int _glfwGetClosestVideoMode(int screen, int* width, int* height, int* rate)
|
||||
short* ratelist;
|
||||
XRRScreenConfiguration* sc;
|
||||
XRRScreenSize* sizelist;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo** modelist;
|
||||
int bestmode, modecount;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display,
|
||||
RootWindow(_glfwLibrary.X11.display, screen));
|
||||
|
||||
@ -113,14 +113,11 @@ int _glfwGetClosestVideoMode(int screen, int* width, int* height, int* rate)
|
||||
|
||||
if (bestsize != -1)
|
||||
return bestsize;
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
// Use the XF86VidMode extension to control video resolution
|
||||
if (_glfwLibrary.X11.VidMode.available &&
|
||||
!_glfwLibrary.X11.RandR.available)
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
// Get a list of all available display modes
|
||||
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen,
|
||||
&modecount, &modelist);
|
||||
@ -153,8 +150,8 @@ int _glfwGetClosestVideoMode(int screen, int* width, int* height, int* rate)
|
||||
|
||||
if (bestmode != -1)
|
||||
return bestmode;
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
#endif
|
||||
|
||||
// Default: Simply use the screen resolution
|
||||
*width = DisplayWidth(_glfwLibrary.X11.display, screen);
|
||||
@ -173,15 +170,15 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
XRRScreenConfiguration* sc;
|
||||
Window root;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo **modelist;
|
||||
int modecount;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
root = RootWindow(_glfwLibrary.X11.display, screen);
|
||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, root);
|
||||
|
||||
@ -218,14 +215,11 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
|
||||
}
|
||||
|
||||
XRRFreeScreenConfigInfo(sc);
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
// Use the XF86VidMode extension to control video resolution
|
||||
if (_glfwLibrary.X11.VidMode.available &&
|
||||
!_glfwLibrary.X11.RandR.available)
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
// Get a list of all available display modes
|
||||
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen,
|
||||
&modecount, &modelist);
|
||||
@ -253,8 +247,8 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
|
||||
|
||||
// Free mode list
|
||||
XFree(modelist);
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -282,9 +276,9 @@ void _glfwRestoreVideoMode(int screen)
|
||||
{
|
||||
if (_glfwLibrary.X11.FS.modeChanged)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
XRRScreenConfiguration* sc;
|
||||
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
@ -301,12 +295,11 @@ void _glfwRestoreVideoMode(int screen)
|
||||
|
||||
XRRFreeScreenConfigInfo(sc);
|
||||
}
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
}
|
||||
#endif
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
if (_glfwLibrary.X11.VidMode.available &&
|
||||
!_glfwLibrary.X11.RandR.available)
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
// Unlock mode switch
|
||||
XF86VidModeLockModeSwitch(_glfwLibrary.X11.display, screen, 0);
|
||||
|
||||
@ -314,8 +307,8 @@ void _glfwRestoreVideoMode(int screen)
|
||||
XF86VidModeSwitchToMode(_glfwLibrary.X11.display,
|
||||
screen,
|
||||
&_glfwLibrary.X11.FS.oldMode);
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
#endif
|
||||
|
||||
_glfwLibrary.X11.FS.modeChanged = GL_FALSE;
|
||||
}
|
||||
@ -349,11 +342,11 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
||||
XRRScreenConfiguration* sc;
|
||||
XRRScreenSize* sizelist;
|
||||
int sizecount;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo** modelist;
|
||||
int modecount, width, height;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
|
||||
// Get list of visuals
|
||||
vislist = XGetVisualInfo(_glfwLibrary.X11.display, 0, &dummy, &viscount);
|
||||
@ -400,9 +393,10 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
||||
resarray = NULL;
|
||||
|
||||
// Build resolution array
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
||||
sizelist = XRRConfigSizes(sc, &sizecount);
|
||||
|
||||
@ -416,13 +410,11 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
||||
}
|
||||
|
||||
XRRFreeScreenConfigInfo(sc);
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
if (_glfwLibrary.X11.VidMode.available &&
|
||||
!_glfwLibrary.X11.RandR.available)
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen, &modecount, &modelist);
|
||||
|
||||
resarray = (struct _glfwResolution*) malloc(sizeof(struct _glfwResolution) * modecount);
|
||||
@ -448,8 +440,8 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
||||
}
|
||||
|
||||
XFree(modelist);
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!resarray)
|
||||
{
|
||||
@ -495,7 +487,7 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo** modelist;
|
||||
int modecount;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
|
||||
// Get display depth
|
||||
bpp = DefaultDepth(_glfwLibrary.X11.display, screen);
|
||||
@ -503,46 +495,27 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
||||
// Convert BPP to RGB bits
|
||||
_glfwSplitBPP(bpp, &mode->redBits, &mode->greenBits, &mode->blueBits);
|
||||
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
if (_glfwLibrary.X11.FS.modeChanged)
|
||||
{
|
||||
if (_glfwLibrary.X11.FS.modeChanged)
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
mode->width = _glfwLibrary.X11.FS.oldWidth;
|
||||
mode->height = _glfwLibrary.X11.FS.oldHeight;
|
||||
return;
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
if (_glfwLibrary.X11.VidMode.available &&
|
||||
!_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
if (_glfwLibrary.X11.FS.modeChanged)
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
// The old (desktop) mode is stored in _glfwWin.FS.oldMode
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
mode->width = _glfwLibrary.X11.FS.oldMode.hdisplay;
|
||||
mode->height = _glfwLibrary.X11.FS.oldMode.vdisplay;
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the XF86VidMode extension to get list of video modes
|
||||
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen, &modecount, &modelist);
|
||||
|
||||
// The first mode in the list is the current (desktio) mode
|
||||
mode->width = modelist[0]->hdisplay;
|
||||
mode->height = modelist[0]->vdisplay;
|
||||
|
||||
// Free list
|
||||
XFree(modelist);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get current display width and height
|
||||
mode->width = DisplayWidth(_glfwLibrary.X11.display, screen);
|
||||
mode->height = DisplayHeight(_glfwLibrary.X11.display, screen);
|
||||
else
|
||||
{
|
||||
mode->width = DisplayWidth(_glfwLibrary.X11.display, screen);
|
||||
mode->height = DisplayHeight(_glfwLibrary.X11.display, screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
||||
XRRFreeGamma(gamma);
|
||||
XRRFreeScreenResources(rr);
|
||||
}
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
#if defined (_GLFW_HAS_XF86VIDMODE)
|
||||
@ -72,7 +72,7 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
||||
ramp->red,
|
||||
ramp->green,
|
||||
ramp->blue);
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
|
||||
|
||||
XRRFreeScreenResources(rr);
|
||||
}
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
#if defined (_GLFW_HAS_XF86VIDMODE)
|
||||
@ -118,7 +118,7 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
|
||||
(unsigned short*) ramp->red,
|
||||
(unsigned short*) ramp->green,
|
||||
(unsigned short*) ramp->blue);
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ static GLboolean initDisplay(void)
|
||||
&_glfwLibrary.X11.VidMode.errorBase);
|
||||
#else
|
||||
_glfwLibrary.X11.VidMode.available = GL_FALSE;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
|
||||
// Check for XRandR extension
|
||||
#ifdef _GLFW_HAS_XRANDR
|
||||
@ -107,7 +107,7 @@ static GLboolean initDisplay(void)
|
||||
}
|
||||
#else
|
||||
_glfwLibrary.X11.RandR.available = GL_FALSE;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
|
||||
// Check if GLX is supported on this display
|
||||
if (!glXQueryExtension(_glfwLibrary.X11.display, NULL, NULL))
|
||||
@ -162,7 +162,7 @@ static void initGammaRamp(void)
|
||||
|
||||
XRRFreeScreenResources(rr);
|
||||
}
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
if (_glfwLibrary.X11.VidMode.available &&
|
||||
@ -173,7 +173,7 @@ static void initGammaRamp(void)
|
||||
_glfwLibrary.X11.screen,
|
||||
&_glfwLibrary.originalRampSize);
|
||||
}
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
|
||||
if (!_glfwLibrary.originalRampSize)
|
||||
fprintf(stderr, "Gamma ramp setting unsupported\n");
|
||||
|
@ -1252,7 +1252,7 @@ static void processSingleEvent(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Atom) event.xclient.data.l[ 0 ] == window->X11.wmDeleteWindow)
|
||||
if ((Atom) event.xclient.data.l[0] == window->X11.wmDeleteWindow)
|
||||
{
|
||||
// The window manager was asked to close the window, for example by
|
||||
// the user pressing a 'close' window decoration button
|
||||
@ -1260,7 +1260,7 @@ static void processSingleEvent(void)
|
||||
window->closeRequested = GL_TRUE;
|
||||
}
|
||||
else if (window->X11.wmPing != None &&
|
||||
(Atom) event.xclient.data.l[ 0 ] == window->X11.wmPing)
|
||||
(Atom) event.xclient.data.l[0] == window->X11.wmPing)
|
||||
{
|
||||
// The window manager is pinging us to make sure we are still
|
||||
// responding to events
|
||||
@ -1380,7 +1380,7 @@ static void processSingleEvent(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1444,7 +1444,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
||||
window->X11.handle,
|
||||
RRScreenChangeNotifyMask);
|
||||
}
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
|
||||
enterFullscreenMode(window);
|
||||
}
|
||||
|
||||
@ -1670,12 +1671,12 @@ void _glfwPlatformRefreshWindowParams(void)
|
||||
GLXFBConfig* fbconfig;
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
XRRScreenConfiguration* sc;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeLine modeline;
|
||||
int dotclock;
|
||||
float pixels_per_second, pixels_per_frame;
|
||||
#endif
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
_GLFWwindow* window = _glfwLibrary.currentWindow;
|
||||
|
||||
int attribs[] = { GLX_FBCONFIG_ID, window->GLX.fbconfigID, None };
|
||||
@ -1734,26 +1735,25 @@ void _glfwPlatformRefreshWindowParams(void)
|
||||
window->refreshRate = 0;
|
||||
|
||||
// Retrieve refresh rate if possible
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
if (_glfwLibrary.X11.RandR.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
||||
window->refreshRate = XRRConfigCurrentRate(sc);
|
||||
XRRFreeScreenConfigInfo(sc);
|
||||
#endif /*_GLFW_HAS_XRANDR*/
|
||||
}
|
||||
#endif
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
if (_glfwLibrary.X11.VidMode.available &&
|
||||
!_glfwLibrary.X11.RandR.available)
|
||||
else if (_glfwLibrary.X11.VidMode.available)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
// Use the XF86VidMode extension to get current video mode
|
||||
XF86VidModeGetModeLine(_glfwLibrary.X11.display, _glfwLibrary.X11.screen,
|
||||
&dotclock, &modeline);
|
||||
pixels_per_second = 1000.0f * (float) dotclock;
|
||||
pixels_per_frame = (float) modeline.htotal * modeline.vtotal;
|
||||
window->refreshRate = (int)(pixels_per_second/pixels_per_frame+0.5);
|
||||
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||
}
|
||||
#endif
|
||||
|
||||
XFree(fbconfig);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user