From aa328c0bbd5f2afb888e2887eeed398b4901fe22 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Sun, 15 Jul 2012 16:48:39 +0200
Subject: [PATCH 1/6] Added support for GLX_MESA_swap_interval.
---
readme.html | 2 +-
src/x11_opengl.c | 18 ++++++++++++++++--
src/x11_platform.h | 6 ++++++
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/readme.html b/readme.html
index faf6a52e..b854a59c 100644
--- a/readme.html
+++ b/readme.html
@@ -335,7 +335,7 @@ version of GLFW.
[Cocoa] Bugfix: The cursor position incorrectly rounded during conversion
[Cocoa] Bugfix: Cursor positioning led to nonsensical results for fullscreen windows
[Cocoa] Bugfix: The GLFW window was flagged as restorable
- [X11] Added support for the GLX_EXT_swap_control
extension as an alternative to GLX_SGI_swap_control
+ [X11] Added support for the GLX_EXT_swap_control
and GLX_MESA_swap_control
extensions as alternatives to GLX_SGI_swap_control
[X11] Added the POSIX CLOCK_MONOTONIC
time source as the preferred method
[X11] Added dependency on libm, where present
[X11] Added support for the _NET_WM_NAME
and _NET_WM_ICON_NAME
EWMH window properties
diff --git a/src/x11_opengl.c b/src/x11_opengl.c
index dc2788c8..e39d858c 100644
--- a/src/x11_opengl.c
+++ b/src/x11_opengl.c
@@ -544,6 +544,15 @@ int _glfwInitOpenGL(void)
_glfwLibrary.GLX.SGI_swap_control = GL_TRUE;
}
+ if (_glfwPlatformExtensionSupported("GLX_MESA_swap_control"))
+ {
+ window->GLX.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
+ _glfwPlatformGetProcAddress("glXSwapIntervalMESA");
+
+ if (window->GLX.SwapIntervalMESA)
+ window->GLX.MESA_swap_control = GL_TRUE;
+ }
+
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
{
_glfwLibrary.GLX.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)
@@ -722,8 +731,13 @@ void _glfwPlatformSwapInterval(int interval)
window->X11.handle,
interval);
}
- else if (_glfwLibrary.GLX.SGI_swap_control)
- _glfwLibrary.GLX.SwapIntervalSGI(interval);
+ else if (window->GLX.MESA_swap_control)
+ window->GLX.SwapIntervalMESA(interval);
+ else if (window->GLX.SGI_swap_control)
+ {
+ if (interval > 0)
+ window->GLX.SwapIntervalSGI(interval);
+ }
}
diff --git a/src/x11_platform.h b/src/x11_platform.h
index f87287b1..39593655 100644
--- a/src/x11_platform.h
+++ b/src/x11_platform.h
@@ -97,6 +97,10 @@
#define _GLFW_CONVERSION_SUCCEEDED 1
#define _GLFW_CONVERSION_FAILED 2
+#ifndef GLX_MESA_swap_control
+typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
+#endif
+
//========================================================================
// GLFW platform specific types
@@ -242,6 +246,7 @@ typedef struct _GLFWlibraryGLX
// GLX extensions
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
+ PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA;
PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX;
PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX;
PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX;
@@ -250,6 +255,7 @@ typedef struct _GLFWlibraryGLX
GLboolean SGIX_fbconfig;
GLboolean SGI_swap_control;
GLboolean EXT_swap_control;
+ GLboolean MESA_swap_control;
GLboolean ARB_multisample;
GLboolean ARB_create_context;
GLboolean ARB_create_context_profile;
From ddc4d5e8a2e7b6af5b3df47ca8d2b33f3afaa0ce Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Sun, 15 Jul 2012 16:55:50 +0200
Subject: [PATCH 2/6] Removed OS name from MinGW files.
---
CMake/README.txt | 2 +-
.../{linux-amd64-mingw32msvc.cmake => amd64-mingw32msvc.cmake} | 0
CMake/{linux-i586-mingw32msvc.cmake => i586-mingw32msvc.cmake} | 0
CMake/{linux-i686-pc-mingw32.cmake => i686-pc-mingw32.cmake} | 0
CMake/{cygwin-i686-w64-mingw32.cmake => i686-w64-mingw32.cmake} | 0
...cygwin-x86_64-w64-mingw32.cmake => x86_64-w64-mingw32.cmake} | 0
6 files changed, 1 insertion(+), 1 deletion(-)
rename CMake/{linux-amd64-mingw32msvc.cmake => amd64-mingw32msvc.cmake} (100%)
rename CMake/{linux-i586-mingw32msvc.cmake => i586-mingw32msvc.cmake} (100%)
rename CMake/{linux-i686-pc-mingw32.cmake => i686-pc-mingw32.cmake} (100%)
rename CMake/{cygwin-i686-w64-mingw32.cmake => i686-w64-mingw32.cmake} (100%)
rename CMake/{cygwin-x86_64-w64-mingw32.cmake => x86_64-w64-mingw32.cmake} (100%)
diff --git a/CMake/README.txt b/CMake/README.txt
index 9581f832..96ac1905 100644
--- a/CMake/README.txt
+++ b/CMake/README.txt
@@ -11,7 +11,7 @@ To use these files you add a special parameter when configuring the source tree:
For example, to use the Debian GNU/Linux MinGW package, run CMake like this:
- cmake -DCMAKE_TOOLCHAIN_FILE=CMake/linux-i586-mingw32msvc.cmake .
+ cmake -DCMAKE_TOOLCHAIN_FILE=CMake/i586-mingw32msvc.cmake .
For more details see this article:
diff --git a/CMake/linux-amd64-mingw32msvc.cmake b/CMake/amd64-mingw32msvc.cmake
similarity index 100%
rename from CMake/linux-amd64-mingw32msvc.cmake
rename to CMake/amd64-mingw32msvc.cmake
diff --git a/CMake/linux-i586-mingw32msvc.cmake b/CMake/i586-mingw32msvc.cmake
similarity index 100%
rename from CMake/linux-i586-mingw32msvc.cmake
rename to CMake/i586-mingw32msvc.cmake
diff --git a/CMake/linux-i686-pc-mingw32.cmake b/CMake/i686-pc-mingw32.cmake
similarity index 100%
rename from CMake/linux-i686-pc-mingw32.cmake
rename to CMake/i686-pc-mingw32.cmake
diff --git a/CMake/cygwin-i686-w64-mingw32.cmake b/CMake/i686-w64-mingw32.cmake
similarity index 100%
rename from CMake/cygwin-i686-w64-mingw32.cmake
rename to CMake/i686-w64-mingw32.cmake
diff --git a/CMake/cygwin-x86_64-w64-mingw32.cmake b/CMake/x86_64-w64-mingw32.cmake
similarity index 100%
rename from CMake/cygwin-x86_64-w64-mingw32.cmake
rename to CMake/x86_64-w64-mingw32.cmake
From 173e321ea6dbd4b8b49f06c31b88f8751c1f1396 Mon Sep 17 00:00:00 2001
From: Simon Voordouw
Date: Tue, 17 Jul 2012 08:28:43 +0200
Subject: [PATCH 3/6] fix MESA_swap_control copy-pasta
---
src/x11_opengl.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/x11_opengl.c b/src/x11_opengl.c
index e39d858c..edcd69b6 100644
--- a/src/x11_opengl.c
+++ b/src/x11_opengl.c
@@ -546,11 +546,11 @@ int _glfwInitOpenGL(void)
if (_glfwPlatformExtensionSupported("GLX_MESA_swap_control"))
{
- window->GLX.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
+ _glfwLibrary.GLX.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
_glfwPlatformGetProcAddress("glXSwapIntervalMESA");
- if (window->GLX.SwapIntervalMESA)
- window->GLX.MESA_swap_control = GL_TRUE;
+ if (_glfwLibrary.GLX.SwapIntervalMESA)
+ _glfwLibrary.GLX.MESA_swap_control = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
@@ -731,12 +731,12 @@ void _glfwPlatformSwapInterval(int interval)
window->X11.handle,
interval);
}
- else if (window->GLX.MESA_swap_control)
- window->GLX.SwapIntervalMESA(interval);
- else if (window->GLX.SGI_swap_control)
+ else if (_glfwLibrary.GLX.MESA_swap_control)
+ _glfwLibrary.GLX.SwapIntervalMESA(interval);
+ else if (_glfwLibrary.GLX.SGI_swap_control)
{
if (interval > 0)
- window->GLX.SwapIntervalSGI(interval);
+ _glfwLibrary.GLX.SwapIntervalSGI(interval);
}
}
From 0627a2c2ebdc9949d7a6c27d15313048fe6f8e8c Mon Sep 17 00:00:00 2001
From: Jorge Rodriguez
Date: Thu, 19 Jul 2012 02:12:33 +0200
Subject: [PATCH 4/6] Added option for MSVC static runtime library.
---
CMakeLists.txt | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44dcb4d4..29263cc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,8 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
find_package(OpenGL REQUIRED)
+option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
+
#--------------------------------------------------------------------
# Enable all warnings on GCC, regardless of OS
#--------------------------------------------------------------------
@@ -54,6 +56,17 @@ if (_GLFW_WIN32_WGL)
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
+ if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
+ foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
+ if(${flag_var} MATCHES "/MD")
+ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MD")
+ if(${flag_var} MATCHES "/MDd")
+ string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MDd")
+ endforeach(flag_var)
+ endif(NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
+
set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS})
if (BUILD_SHARED_LIBS)
From c1931eda37f75f4176acd3d388b66f37eeb66840 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Thu, 19 Jul 2012 02:15:01 +0200
Subject: [PATCH 5/6] Formatting, limited to MSVC.
---
CMakeLists.txt | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29263cc9..016a8d31 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,6 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
find_package(OpenGL REQUIRED)
-option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
-
#--------------------------------------------------------------------
# Enable all warnings on GCC, regardless of OS
#--------------------------------------------------------------------
@@ -56,16 +54,20 @@ if (_GLFW_WIN32_WGL)
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
- if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
- foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
- if(${flag_var} MATCHES "/MD")
- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
- endif(${flag_var} MATCHES "/MD")
- if(${flag_var} MATCHES "/MDd")
- string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
- endif(${flag_var} MATCHES "/MDd")
- endforeach(flag_var)
- endif(NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
+ if (MSVC)
+ option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
+
+ if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
+ foreach (flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
+ if (${flag} MATCHES "/MD")
+ string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
+ endif()
+ if (${flag} MATCHES "/MDd")
+ string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
+ endif()
+ endforeach()
+ endif()
+ endif()
set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS})
From 5e36fb0e38ab4e4e8fe3a66defd76bff8f62d1fe Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Thu, 19 Jul 2012 02:35:34 +0200
Subject: [PATCH 6/6] Formatting.
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 016a8d31..b80ac24e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -193,7 +193,7 @@ if (_GLFW_COCOA_NSGL)
set(CMAKE_OSX_ARCHITECTURES ppc;i386;ppc64;x86_64)
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk)
set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5")
- else(GLFW_BUILD_UNIVERSAL)
+ else()
message(STATUS "Building GLFW only for the native architecture")
endif()