From 4994acb7e15ab89f4fe7c71d06384a4cafb4504d Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Sat, 14 Apr 2012 23:01:35 +0200
Subject: [PATCH 1/7] Removed superfluous test.
---
src/opengl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/opengl.c b/src/opengl.c
index f4c6984c..b35f8694 100644
--- a/src/opengl.c
+++ b/src/opengl.c
@@ -517,8 +517,7 @@ GLFWAPI void glfwSwapBuffers(void)
return;
}
- if (_glfwLibrary.currentWindow)
- _glfwPlatformSwapBuffers();
+ _glfwPlatformSwapBuffers();
}
From a7d19ed77e15ad3a4c01a1bc8e47fa5b8cbf25c4 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Sun, 15 Apr 2012 00:40:50 +0200
Subject: [PATCH 2/7] Removed superfluous comment.
---
src/x11_window.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/x11_window.c b/src/x11_window.c
index a84e209a..6fc8c2fd 100644
--- a/src/x11_window.c
+++ b/src/x11_window.c
@@ -1287,7 +1287,6 @@ static void processSingleEvent(void)
break;
}
- // Was the window destroyed?
case DestroyNotify:
return;
From 141b56afc0e2852ae26deac2540c8f640c002df2 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Thu, 19 Apr 2012 16:57:44 +0200
Subject: [PATCH 3/7] Added libm as direct dependency for tests and examples.
---
examples/CMakeLists.txt | 2 +-
tests/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 76135a92..3e7065c6 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -3,7 +3,7 @@ link_libraries(glfw ${OPENGL_glu_LIBRARY})
if (BUILD_SHARED_LIBS)
add_definitions(-DGLFW_DLL)
- link_libraries(${OPENGL_gl_LIBRARY})
+ link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY})
else()
link_libraries(${glfw_LIBRARIES})
endif()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 9f2afa9f..c4db1a57 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -3,7 +3,7 @@ link_libraries(glfw ${OPENGL_glu_LIBRARY})
if (BUILD_SHARED_LIBS)
add_definitions(-DGLFW_DLL)
- link_libraries(${OPENGL_gl_LIBRARY})
+ link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY})
else()
link_libraries(${glfw_LIBRARIES})
endif()
From 7a5c2d5f75be699c450df42b10d76f90beffac28 Mon Sep 17 00:00:00 2001
From: Lambert Clara
Date: Sat, 21 Apr 2012 11:47:58 +0200
Subject: [PATCH 4/7] Fix clang warning : self-comparison always evaluates to
false
---
tests/modes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/modes.c b/tests/modes.c
index 9c558d47..07407e13 100644
--- a/tests/modes.c
+++ b/tests/modes.c
@@ -153,7 +153,7 @@ static void test_modes(GLFWvidmode* modes, int count)
glfwGetWindowSize(window, &width, &height);
- if (width != modes[i].width || height != height)
+ if (width != modes[i].width || height != modes[i].height)
{
printf("*** Size mismatch: %ix%i instead of %ix%i\n",
width, height,
From 97f7e60f8bd72bab706ddc10678d046065185803 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Sun, 22 Apr 2012 00:21:42 +0200
Subject: [PATCH 5/7] Added credits.
---
readme.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/readme.html b/readme.html
index 790e5ac7..413be001 100644
--- a/readme.html
+++ b/readme.html
@@ -838,6 +838,8 @@ their skills. Special thanks go out to:
Keith Bauer, for his invaluable help with porting and maintaining GLFW on
Mac OS X, and for his many ideas
+ Lambert Clara, for a bug fix for the modes test
+
Jarrod Davis, for the Delphi port of GLFW
Olivier Delannoy, for the initial implementation of FSAA support on
From 2ac8da74659005be130882318e5baa31c1f7b655 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Sun, 22 Apr 2012 12:58:05 +0200
Subject: [PATCH 6/7] Merged patch #3519669.
---
src/cocoa_window.m | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index 9e64b2d3..b5231ec9 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -1168,7 +1168,7 @@ void _glfwPlatformSetMouseCursorPos(_GLFWwindow* window, int x, int y)
// calculating the maximum y coordinate of all screens, since Cocoa's
// "global coordinates" are upside down from CG's...
- NSPoint localPoint = NSMakePoint(x, y);
+ NSPoint localPoint = NSMakePoint(x, window->height - y);
NSPoint globalPoint = [window->NS.object convertBaseToScreen:localPoint];
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;
From 21e77fe1a6a429558a6d50dcab376810078bd67b Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Sun, 22 Apr 2012 15:53:02 +0200
Subject: [PATCH 7/7] Split platform-specific global data.
---
src/cocoa_init.m | 4 ++--
src/cocoa_opengl.m | 2 +-
src/cocoa_platform.h | 17 +++++++++++++----
src/internal.h | 3 ++-
src/win32_platform.h | 15 +++++++++++++--
src/x11_init.c | 14 +++++++-------
src/x11_platform.h | 23 ++++++++++++++++-------
src/x11_window.c | 2 +-
8 files changed, 55 insertions(+), 25 deletions(-)
diff --git a/src/cocoa_init.m b/src/cocoa_init.m
index 63c09e8a..329bcfa4 100644
--- a/src/cocoa_init.m
+++ b/src/cocoa_init.m
@@ -81,9 +81,9 @@ int _glfwPlatformInit(void)
{
_glfwLibrary.NS.autoreleasePool = [[NSAutoreleasePool alloc] init];
- _glfwLibrary.NS.OpenGLFramework =
+ _glfwLibrary.NSGL.framework =
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
- if (_glfwLibrary.NS.OpenGLFramework == NULL)
+ if (_glfwLibrary.NSGL.framework == NULL)
{
_glfwSetError(GLFW_PLATFORM_ERROR,
"glfwInit: Failed to locate OpenGL framework");
diff --git a/src/cocoa_opengl.m b/src/cocoa_opengl.m
index 0ea39076..33bf4ab5 100644
--- a/src/cocoa_opengl.m
+++ b/src/cocoa_opengl.m
@@ -94,7 +94,7 @@ void* _glfwPlatformGetProcAddress(const char* procname)
procname,
kCFStringEncodingASCII);
- void* symbol = CFBundleGetFunctionPointerForName(_glfwLibrary.NS.OpenGLFramework,
+ void* symbol = CFBundleGetFunctionPointerForName(_glfwLibrary.NSGL.framework,
symbolName);
CFRelease(symbolName);
diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h
index 77aa3481..97e903d7 100644
--- a/src/cocoa_platform.h
+++ b/src/cocoa_platform.h
@@ -43,8 +43,9 @@ typedef void* id;
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS NS
-#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryNS NS
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL NSGL
+#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS NS
+#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryNSGL NSGL
//========================================================================
@@ -80,7 +81,7 @@ typedef struct _GLFWwindowNS
//------------------------------------------------------------------------
-// Platform-specific library global data
+// Platform-specific library global data for Cocoa
//------------------------------------------------------------------------
typedef struct _GLFWlibraryNS
{
@@ -89,8 +90,6 @@ typedef struct _GLFWlibraryNS
double resolution;
} timer;
- // dlopen handle for dynamically loading OpenGL extension entry points
- void* OpenGLFramework;
CGDisplayModeRef desktopMode;
CGEventSourceRef eventSource;
id delegate;
@@ -100,6 +99,16 @@ typedef struct _GLFWlibraryNS
} _GLFWlibraryNS;
+//------------------------------------------------------------------------
+// Platform-specific library global data for NSGL
+//------------------------------------------------------------------------
+typedef struct _GLFWlibraryNSGL
+{
+ // dlopen handle for dynamically loading OpenGL extension entry points
+ void* framework;
+} _GLFWlibraryNSGL;
+
+
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
diff --git a/src/internal.h b/src/internal.h
index 4e7bce1a..6398bdc5 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -247,7 +247,8 @@ struct _GLFWlibrary
int originalRampSize;
// This is defined in the current port's platform.h
- _GLFW_PLATFORM_LIBRARY_STATE;
+ _GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
+ _GLFW_PLATFORM_LIBRARY_OPENGL_STATE;
};
diff --git a/src/win32_platform.h b/src/win32_platform.h
index 7c369767..e7b7b165 100644
--- a/src/win32_platform.h
+++ b/src/win32_platform.h
@@ -111,8 +111,9 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 Win32
-#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryWin32 Win32
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL WGL
+#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 Win32
+#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryWGL WGL
//========================================================================
@@ -169,7 +170,7 @@ typedef struct _GLFWwindowWin32
//------------------------------------------------------------------------
-// Platform-specific library global data
+// Platform-specific library global data for Win32
//------------------------------------------------------------------------
typedef struct _GLFWlibraryWin32
{
@@ -210,6 +211,16 @@ typedef struct _GLFWlibraryWin32
} _GLFWlibraryWin32;
+//------------------------------------------------------------------------
+// Platform-specific library global data for WGL
+//------------------------------------------------------------------------
+typedef struct _GLFWlibraryWGL
+{
+ int dummy;
+
+} _GLFWlibraryWGL;
+
+
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
diff --git a/src/x11_init.c b/src/x11_init.c
index 3af08cf4..d59fbcc6 100644
--- a/src/x11_init.c
+++ b/src/x11_init.c
@@ -55,8 +55,8 @@ static void initLibraries(void)
for (i = 0; libGL_names[i] != NULL; i++)
{
- _glfwLibrary.X11.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
- if (_glfwLibrary.X11.libGL)
+ _glfwLibrary.GLX.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
+ if (_glfwLibrary.GLX.libGL)
break;
}
#endif
@@ -569,8 +569,8 @@ static GLboolean initDisplay(void)
}
if (!glXQueryVersion(_glfwLibrary.X11.display,
- &_glfwLibrary.X11.glxMajor,
- &_glfwLibrary.X11.glxMinor))
+ &_glfwLibrary.GLX.majorVersion,
+ &_glfwLibrary.GLX.minorVersion))
{
_glfwSetError(GLFW_OPENGL_UNAVAILABLE,
"X11/GLX: Failed to query GLX version");
@@ -775,10 +775,10 @@ int _glfwPlatformTerminate(void)
// Unload libGL.so if necessary
#ifdef _GLFW_DLOPEN_LIBGL
- if (_glfwLibrary.X11.libGL != NULL)
+ if (_glfwLibrary.GLX.libGL != NULL)
{
- dlclose(_glfwLibrary.X11.libGL);
- _glfwLibrary.X11.libGL = NULL;
+ dlclose(_glfwLibrary.GLX.libGL);
+ _glfwLibrary.GLX.libGL = NULL;
}
#endif
diff --git a/src/x11_platform.h b/src/x11_platform.h
index 2de3367e..013ca4e0 100644
--- a/src/x11_platform.h
+++ b/src/x11_platform.h
@@ -75,15 +75,16 @@
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSEXT)
#define _glfw_glXGetProcAddress(x) glXGetProcAddressEXT(x)
#elif defined(_GLFW_HAS_DLOPEN)
- #define _glfw_glXGetProcAddress(x) dlsym(_glfwLibrary.X11.libGL, x)
+ #define _glfw_glXGetProcAddress(x) dlsym(_glfwLibrary.GLX.libGL, x)
#define _GLFW_DLOPEN_LIBGL
#else
#error "No OpenGL entry point retrieval mechanism was enabled"
#endif
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 X11
-#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryX11 X11
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
+#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 X11
+#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryGLX GLX
// Clipboard format atom indices
#define _GLFW_CLIPBOARD_FORMAT_UTF8 0
@@ -157,7 +158,7 @@ typedef struct _GLFWwindowX11
//------------------------------------------------------------------------
-// Platform-specific library global data
+// Platform-specific library global data for X11
//------------------------------------------------------------------------
typedef struct _GLFWlibraryX11
{
@@ -177,9 +178,6 @@ typedef struct _GLFWlibraryX11
// True if window manager supports EWMH
GLboolean hasEWMH;
- // Server-side GLX version
- int glxMajor, glxMinor;
-
struct {
GLboolean available;
int eventBase;
@@ -248,10 +246,21 @@ typedef struct _GLFWlibraryX11
int status;
} selection;
+} _GLFWlibraryX11;
+
+
+//------------------------------------------------------------------------
+// Platform-specific library global data for GLX
+//------------------------------------------------------------------------
+typedef struct _GLFWlibraryGLX
+{
+ // Server-side GLX version
+ int majorVersion, minorVersion;
+
#if defined(_GLFW_DLOPEN_LIBGL)
void* libGL; // dlopen handle for libGL.so
#endif
-} _GLFWlibraryX11;
+} _GLFWlibraryGLX;
//------------------------------------------------------------------------
diff --git a/src/x11_window.c b/src/x11_window.c
index 6fc8c2fd..ccd99a60 100644
--- a/src/x11_window.c
+++ b/src/x11_window.c
@@ -131,7 +131,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
*found = 0;
- if (_glfwLibrary.X11.glxMajor == 1 && _glfwLibrary.X11.glxMinor < 3)
+ if (_glfwLibrary.GLX.majorVersion == 1 && _glfwLibrary.GLX.minorVersion < 3)
{
if (!window->GLX.SGIX_fbconfig)
{