mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +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
|
# 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)
|
${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 <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 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 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>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.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>
|
<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;
|
typedef intptr_t GLFWintptr;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Platform-specific OpenGL context structure
|
// 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;
|
int glForward, glDebug, glProfile;
|
||||||
PFNGLGETSTRINGIPROC GetStringi;
|
PFNGLGETSTRINGIPROC GetStringi;
|
||||||
|
|
||||||
|
// These are defined in the current port's platform.h
|
||||||
_GLFW_PLATFORM_WINDOW_STATE;
|
_GLFW_PLATFORM_WINDOW_STATE;
|
||||||
_GLFW_PLATFORM_CONTEXT_STATE;
|
_GLFW_PLATFORM_CONTEXT_STATE;
|
||||||
};
|
};
|
||||||
@ -226,6 +227,7 @@ struct _GLFWlibrary
|
|||||||
GLFWgammaramp originalRamp;
|
GLFWgammaramp originalRamp;
|
||||||
int originalRampSize;
|
int originalRampSize;
|
||||||
|
|
||||||
|
// This is defined in the current port's platform.h
|
||||||
_GLFW_PLATFORM_LIBRARY_STATE;
|
_GLFW_PLATFORM_LIBRARY_STATE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,10 +66,6 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pointer length integer
|
|
||||||
// One day, this will most likely move into glfw.h
|
|
||||||
typedef intptr_t GLFWintptr;
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef GL_VERSION_3_0
|
#ifndef GL_VERSION_3_0
|
||||||
|
|
||||||
@ -83,10 +79,15 @@ typedef const GLubyte* (APIENTRY *PFNGLGETSTRINGIPROC)(GLenum, GLuint);
|
|||||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
|
#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
|
// Platform-specific OpenGL context structure
|
||||||
@ -168,25 +169,25 @@ typedef struct _GLFWlibraryX11
|
|||||||
|
|
||||||
// Screensaver data
|
// Screensaver data
|
||||||
struct {
|
struct {
|
||||||
int changed;
|
GLboolean changed;
|
||||||
int timeout;
|
int timeout;
|
||||||
int interval;
|
int interval;
|
||||||
int blanking;
|
int blanking;
|
||||||
int exposure;
|
int exposure;
|
||||||
} saver;
|
} saver;
|
||||||
|
|
||||||
// Fullscreen data
|
// Fullscreen data
|
||||||
struct {
|
struct {
|
||||||
int modeChanged;
|
GLboolean modeChanged;
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
SizeID oldSizeID;
|
SizeID oldSizeID;
|
||||||
int oldWidth;
|
int oldWidth;
|
||||||
int oldHeight;
|
int oldHeight;
|
||||||
Rotation oldRotation;
|
Rotation oldRotation;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
XF86VidModeModeInfo oldMode;
|
XF86VidModeModeInfo oldMode;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
} FS;
|
} FS;
|
||||||
|
|
||||||
// Timer data
|
// Timer data
|
||||||
@ -196,7 +197,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
} timer;
|
} timer;
|
||||||
|
|
||||||
#if defined(_GLFW_DLOPEN_LIBGL)
|
#if defined(_GLFW_DLOPEN_LIBGL)
|
||||||
void* libGL; // dlopen handle for libGL.so
|
void* libGL; // dlopen handle for libGL.so
|
||||||
#endif
|
#endif
|
||||||
} _GLFWlibraryX11;
|
} _GLFWlibraryX11;
|
||||||
|
|
||||||
|
@ -51,15 +51,15 @@ int _glfwGetClosestVideoMode(int screen, int* width, int* height, int* rate)
|
|||||||
short* ratelist;
|
short* ratelist;
|
||||||
XRRScreenConfiguration* sc;
|
XRRScreenConfiguration* sc;
|
||||||
XRRScreenSize* sizelist;
|
XRRScreenSize* sizelist;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
XF86VidModeModeInfo** modelist;
|
XF86VidModeModeInfo** modelist;
|
||||||
int bestmode, modecount;
|
int bestmode, modecount;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
|
||||||
if (_glfwLibrary.X11.RandR.available)
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display,
|
sc = XRRGetScreenInfo(_glfwLibrary.X11.display,
|
||||||
RootWindow(_glfwLibrary.X11.display, screen));
|
RootWindow(_glfwLibrary.X11.display, screen));
|
||||||
|
|
||||||
@ -113,14 +113,11 @@ int _glfwGetClosestVideoMode(int screen, int* width, int* height, int* rate)
|
|||||||
|
|
||||||
if (bestsize != -1)
|
if (bestsize != -1)
|
||||||
return bestsize;
|
return bestsize;
|
||||||
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
}
|
}
|
||||||
#endif
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
|
||||||
// Use the XF86VidMode extension to control video resolution
|
|
||||||
if (_glfwLibrary.X11.VidMode.available &&
|
|
||||||
!_glfwLibrary.X11.RandR.available)
|
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
// Get a list of all available display modes
|
// Get a list of all available display modes
|
||||||
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen,
|
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen,
|
||||||
&modecount, &modelist);
|
&modecount, &modelist);
|
||||||
@ -153,8 +150,8 @@ int _glfwGetClosestVideoMode(int screen, int* width, int* height, int* rate)
|
|||||||
|
|
||||||
if (bestmode != -1)
|
if (bestmode != -1)
|
||||||
return bestmode;
|
return bestmode;
|
||||||
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Default: Simply use the screen resolution
|
// Default: Simply use the screen resolution
|
||||||
*width = DisplayWidth(_glfwLibrary.X11.display, screen);
|
*width = DisplayWidth(_glfwLibrary.X11.display, screen);
|
||||||
@ -173,15 +170,15 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
|
|||||||
#if defined(_GLFW_HAS_XRANDR)
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
XRRScreenConfiguration* sc;
|
XRRScreenConfiguration* sc;
|
||||||
Window root;
|
Window root;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
XF86VidModeModeInfo **modelist;
|
XF86VidModeModeInfo **modelist;
|
||||||
int modecount;
|
int modecount;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
|
||||||
if (_glfwLibrary.X11.RandR.available)
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
root = RootWindow(_glfwLibrary.X11.display, screen);
|
root = RootWindow(_glfwLibrary.X11.display, screen);
|
||||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, root);
|
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, root);
|
||||||
|
|
||||||
@ -218,14 +215,11 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XRRFreeScreenConfigInfo(sc);
|
XRRFreeScreenConfigInfo(sc);
|
||||||
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
}
|
}
|
||||||
#endif
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
|
||||||
// Use the XF86VidMode extension to control video resolution
|
|
||||||
if (_glfwLibrary.X11.VidMode.available &&
|
|
||||||
!_glfwLibrary.X11.RandR.available)
|
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
// Get a list of all available display modes
|
// Get a list of all available display modes
|
||||||
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen,
|
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen,
|
||||||
&modecount, &modelist);
|
&modecount, &modelist);
|
||||||
@ -253,8 +247,8 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
|
|||||||
|
|
||||||
// Free mode list
|
// Free mode list
|
||||||
XFree(modelist);
|
XFree(modelist);
|
||||||
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -282,9 +276,9 @@ void _glfwRestoreVideoMode(int screen)
|
|||||||
{
|
{
|
||||||
if (_glfwLibrary.X11.FS.modeChanged)
|
if (_glfwLibrary.X11.FS.modeChanged)
|
||||||
{
|
{
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
|
||||||
if (_glfwLibrary.X11.RandR.available)
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
XRRScreenConfiguration* sc;
|
XRRScreenConfiguration* sc;
|
||||||
|
|
||||||
if (_glfwLibrary.X11.RandR.available)
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
@ -301,12 +295,11 @@ void _glfwRestoreVideoMode(int screen)
|
|||||||
|
|
||||||
XRRFreeScreenConfigInfo(sc);
|
XRRFreeScreenConfigInfo(sc);
|
||||||
}
|
}
|
||||||
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
}
|
}
|
||||||
#endif
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
|
||||||
if (_glfwLibrary.X11.VidMode.available &&
|
|
||||||
!_glfwLibrary.X11.RandR.available)
|
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
// Unlock mode switch
|
// Unlock mode switch
|
||||||
XF86VidModeLockModeSwitch(_glfwLibrary.X11.display, screen, 0);
|
XF86VidModeLockModeSwitch(_glfwLibrary.X11.display, screen, 0);
|
||||||
|
|
||||||
@ -314,8 +307,8 @@ void _glfwRestoreVideoMode(int screen)
|
|||||||
XF86VidModeSwitchToMode(_glfwLibrary.X11.display,
|
XF86VidModeSwitchToMode(_glfwLibrary.X11.display,
|
||||||
screen,
|
screen,
|
||||||
&_glfwLibrary.X11.FS.oldMode);
|
&_glfwLibrary.X11.FS.oldMode);
|
||||||
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
_glfwLibrary.X11.FS.modeChanged = GL_FALSE;
|
_glfwLibrary.X11.FS.modeChanged = GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -349,11 +342,11 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
|||||||
XRRScreenConfiguration* sc;
|
XRRScreenConfiguration* sc;
|
||||||
XRRScreenSize* sizelist;
|
XRRScreenSize* sizelist;
|
||||||
int sizecount;
|
int sizecount;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
XF86VidModeModeInfo** modelist;
|
XF86VidModeModeInfo** modelist;
|
||||||
int modecount, width, height;
|
int modecount, width, height;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
|
|
||||||
// Get list of visuals
|
// Get list of visuals
|
||||||
vislist = XGetVisualInfo(_glfwLibrary.X11.display, 0, &dummy, &viscount);
|
vislist = XGetVisualInfo(_glfwLibrary.X11.display, 0, &dummy, &viscount);
|
||||||
@ -400,9 +393,10 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
|||||||
resarray = NULL;
|
resarray = NULL;
|
||||||
|
|
||||||
// Build resolution array
|
// Build resolution array
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
|
||||||
if (_glfwLibrary.X11.RandR.available)
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
||||||
sizelist = XRRConfigSizes(sc, &sizecount);
|
sizelist = XRRConfigSizes(sc, &sizecount);
|
||||||
|
|
||||||
@ -416,13 +410,11 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XRRFreeScreenConfigInfo(sc);
|
XRRFreeScreenConfigInfo(sc);
|
||||||
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
}
|
}
|
||||||
#endif
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
|
||||||
if (_glfwLibrary.X11.VidMode.available &&
|
|
||||||
!_glfwLibrary.X11.RandR.available)
|
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen, &modecount, &modelist);
|
XF86VidModeGetAllModeLines(_glfwLibrary.X11.display, screen, &modecount, &modelist);
|
||||||
|
|
||||||
resarray = (struct _glfwResolution*) malloc(sizeof(struct _glfwResolution) * modecount);
|
resarray = (struct _glfwResolution*) malloc(sizeof(struct _glfwResolution) * modecount);
|
||||||
@ -448,8 +440,8 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XFree(modelist);
|
XFree(modelist);
|
||||||
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!resarray)
|
if (!resarray)
|
||||||
{
|
{
|
||||||
@ -495,7 +487,7 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
|||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
XF86VidModeModeInfo** modelist;
|
XF86VidModeModeInfo** modelist;
|
||||||
int modecount;
|
int modecount;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
|
|
||||||
// Get display depth
|
// Get display depth
|
||||||
bpp = DefaultDepth(_glfwLibrary.X11.display, screen);
|
bpp = DefaultDepth(_glfwLibrary.X11.display, screen);
|
||||||
@ -503,46 +495,27 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
|||||||
// Convert BPP to RGB bits
|
// Convert BPP to RGB bits
|
||||||
_glfwSplitBPP(bpp, &mode->redBits, &mode->greenBits, &mode->blueBits);
|
_glfwSplitBPP(bpp, &mode->redBits, &mode->greenBits, &mode->blueBits);
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
if (_glfwLibrary.X11.FS.modeChanged)
|
||||||
if (_glfwLibrary.X11.RandR.available)
|
|
||||||
{
|
{
|
||||||
if (_glfwLibrary.X11.FS.modeChanged)
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
mode->width = _glfwLibrary.X11.FS.oldWidth;
|
mode->width = _glfwLibrary.X11.FS.oldWidth;
|
||||||
mode->height = _glfwLibrary.X11.FS.oldHeight;
|
mode->height = _glfwLibrary.X11.FS.oldHeight;
|
||||||
return;
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
}
|
}
|
||||||
}
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
#endif
|
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
|
||||||
if (_glfwLibrary.X11.VidMode.available &&
|
|
||||||
!_glfwLibrary.X11.RandR.available)
|
|
||||||
{
|
|
||||||
if (_glfwLibrary.X11.FS.modeChanged)
|
|
||||||
{
|
{
|
||||||
// The old (desktop) mode is stored in _glfwWin.FS.oldMode
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
mode->width = _glfwLibrary.X11.FS.oldMode.hdisplay;
|
mode->width = _glfwLibrary.X11.FS.oldMode.hdisplay;
|
||||||
mode->height = _glfwLibrary.X11.FS.oldMode.vdisplay;
|
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
|
else
|
||||||
|
{
|
||||||
// Get current display width and height
|
mode->width = DisplayWidth(_glfwLibrary.X11.display, screen);
|
||||||
mode->width = DisplayWidth(_glfwLibrary.X11.display, screen);
|
mode->height = DisplayHeight(_glfwLibrary.X11.display, screen);
|
||||||
mode->height = DisplayHeight(_glfwLibrary.X11.display, screen);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
|||||||
XRRFreeGamma(gamma);
|
XRRFreeGamma(gamma);
|
||||||
XRRFreeScreenResources(rr);
|
XRRFreeScreenResources(rr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
else if (_glfwLibrary.X11.VidMode.available)
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
{
|
{
|
||||||
#if defined (_GLFW_HAS_XF86VIDMODE)
|
#if defined (_GLFW_HAS_XF86VIDMODE)
|
||||||
@ -72,7 +72,7 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
|
|||||||
ramp->red,
|
ramp->red,
|
||||||
ramp->green,
|
ramp->green,
|
||||||
ramp->blue);
|
ramp->blue);
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
|
|||||||
|
|
||||||
XRRFreeScreenResources(rr);
|
XRRFreeScreenResources(rr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
else if (_glfwLibrary.X11.VidMode.available)
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
{
|
{
|
||||||
#if defined (_GLFW_HAS_XF86VIDMODE)
|
#if defined (_GLFW_HAS_XF86VIDMODE)
|
||||||
@ -118,7 +118,7 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
|
|||||||
(unsigned short*) ramp->red,
|
(unsigned short*) ramp->red,
|
||||||
(unsigned short*) ramp->green,
|
(unsigned short*) ramp->green,
|
||||||
(unsigned short*) ramp->blue);
|
(unsigned short*) ramp->blue);
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ static GLboolean initDisplay(void)
|
|||||||
&_glfwLibrary.X11.VidMode.errorBase);
|
&_glfwLibrary.X11.VidMode.errorBase);
|
||||||
#else
|
#else
|
||||||
_glfwLibrary.X11.VidMode.available = GL_FALSE;
|
_glfwLibrary.X11.VidMode.available = GL_FALSE;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
|
|
||||||
// Check for XRandR extension
|
// Check for XRandR extension
|
||||||
#ifdef _GLFW_HAS_XRANDR
|
#ifdef _GLFW_HAS_XRANDR
|
||||||
@ -107,7 +107,7 @@ static GLboolean initDisplay(void)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
_glfwLibrary.X11.RandR.available = GL_FALSE;
|
_glfwLibrary.X11.RandR.available = GL_FALSE;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
|
|
||||||
// Check if GLX is supported on this display
|
// Check if GLX is supported on this display
|
||||||
if (!glXQueryExtension(_glfwLibrary.X11.display, NULL, NULL))
|
if (!glXQueryExtension(_glfwLibrary.X11.display, NULL, NULL))
|
||||||
@ -162,7 +162,7 @@ static void initGammaRamp(void)
|
|||||||
|
|
||||||
XRRFreeScreenResources(rr);
|
XRRFreeScreenResources(rr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
if (_glfwLibrary.X11.VidMode.available &&
|
if (_glfwLibrary.X11.VidMode.available &&
|
||||||
@ -173,7 +173,7 @@ static void initGammaRamp(void)
|
|||||||
_glfwLibrary.X11.screen,
|
_glfwLibrary.X11.screen,
|
||||||
&_glfwLibrary.originalRampSize);
|
&_glfwLibrary.originalRampSize);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
|
|
||||||
if (!_glfwLibrary.originalRampSize)
|
if (!_glfwLibrary.originalRampSize)
|
||||||
fprintf(stderr, "Gamma ramp setting unsupported\n");
|
fprintf(stderr, "Gamma ramp setting unsupported\n");
|
||||||
|
@ -1252,7 +1252,7 @@ static void processSingleEvent(void)
|
|||||||
return;
|
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 window manager was asked to close the window, for example by
|
||||||
// the user pressing a 'close' window decoration button
|
// the user pressing a 'close' window decoration button
|
||||||
@ -1260,7 +1260,7 @@ static void processSingleEvent(void)
|
|||||||
window->closeRequested = GL_TRUE;
|
window->closeRequested = GL_TRUE;
|
||||||
}
|
}
|
||||||
else if (window->X11.wmPing != None &&
|
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
|
// The window manager is pinging us to make sure we are still
|
||||||
// responding to events
|
// responding to events
|
||||||
@ -1380,7 +1380,7 @@ static void processSingleEvent(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1444,7 +1444,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
window->X11.handle,
|
window->X11.handle,
|
||||||
RRScreenChangeNotifyMask);
|
RRScreenChangeNotifyMask);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
|
|
||||||
enterFullscreenMode(window);
|
enterFullscreenMode(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1670,12 +1671,12 @@ void _glfwPlatformRefreshWindowParams(void)
|
|||||||
GLXFBConfig* fbconfig;
|
GLXFBConfig* fbconfig;
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
XRRScreenConfiguration* sc;
|
XRRScreenConfiguration* sc;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
XF86VidModeModeLine modeline;
|
XF86VidModeModeLine modeline;
|
||||||
int dotclock;
|
int dotclock;
|
||||||
float pixels_per_second, pixels_per_frame;
|
float pixels_per_second, pixels_per_frame;
|
||||||
#endif
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
_GLFWwindow* window = _glfwLibrary.currentWindow;
|
_GLFWwindow* window = _glfwLibrary.currentWindow;
|
||||||
|
|
||||||
int attribs[] = { GLX_FBCONFIG_ID, window->GLX.fbconfigID, None };
|
int attribs[] = { GLX_FBCONFIG_ID, window->GLX.fbconfigID, None };
|
||||||
@ -1734,26 +1735,25 @@ void _glfwPlatformRefreshWindowParams(void)
|
|||||||
window->refreshRate = 0;
|
window->refreshRate = 0;
|
||||||
|
|
||||||
// Retrieve refresh rate if possible
|
// Retrieve refresh rate if possible
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
|
||||||
if (_glfwLibrary.X11.RandR.available)
|
if (_glfwLibrary.X11.RandR.available)
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
||||||
window->refreshRate = XRRConfigCurrentRate(sc);
|
window->refreshRate = XRRConfigCurrentRate(sc);
|
||||||
XRRFreeScreenConfigInfo(sc);
|
XRRFreeScreenConfigInfo(sc);
|
||||||
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
}
|
}
|
||||||
#endif
|
else if (_glfwLibrary.X11.VidMode.available)
|
||||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
|
||||||
if (_glfwLibrary.X11.VidMode.available &&
|
|
||||||
!_glfwLibrary.X11.RandR.available)
|
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||||
// Use the XF86VidMode extension to get current video mode
|
// Use the XF86VidMode extension to get current video mode
|
||||||
XF86VidModeGetModeLine(_glfwLibrary.X11.display, _glfwLibrary.X11.screen,
|
XF86VidModeGetModeLine(_glfwLibrary.X11.display, _glfwLibrary.X11.screen,
|
||||||
&dotclock, &modeline);
|
&dotclock, &modeline);
|
||||||
pixels_per_second = 1000.0f * (float) dotclock;
|
pixels_per_second = 1000.0f * (float) dotclock;
|
||||||
pixels_per_frame = (float) modeline.htotal * modeline.vtotal;
|
pixels_per_frame = (float) modeline.htotal * modeline.vtotal;
|
||||||
window->refreshRate = (int)(pixels_per_second/pixels_per_frame+0.5);
|
window->refreshRate = (int)(pixels_per_second/pixels_per_frame+0.5);
|
||||||
|
#endif /*_GLFW_HAS_XF86VIDMODE*/
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
XFree(fbconfig);
|
XFree(fbconfig);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user