From e81b2decac76d072874c571e4fbedb2d4c2e7ffc Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 18 Dec 2011 17:22:58 +0100 Subject: [PATCH 01/12] Removed NULL already defined by stddef.h header. --- include/GL/glfw3.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 88729631..89dfc26c 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -39,16 +39,6 @@ extern "C" { * Global definitions *************************************************************************/ -/* We need a NULL pointer from time to time */ -#ifndef NULL - #ifdef __cplusplus - #define NULL 0 - #else - #define NULL ((void*) 0) - #endif -#endif /* NULL */ - - /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ /* Please report any probles that you find with your compiler, which may From 87f713a5e261912be4f4061abda1401ba0425479 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 10 Jan 2012 21:35:13 +0100 Subject: [PATCH 02/12] Added glfwInit exception comment. --- src/error.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/error.c b/src/error.c index 574f84cd..2b46a72c 100644 --- a/src/error.c +++ b/src/error.c @@ -117,6 +117,7 @@ GLFWAPI const char* glfwErrorString(int error) //======================================================================== // Sets the callback function for GLFW errors +// This function may be called without GLFW having been initialized //======================================================================== GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun) From 2b106336aeb6ba554f63388ab0fdd6280d100c50 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 10 Jan 2012 21:39:16 +0100 Subject: [PATCH 03/12] Updated .gitignore. --- .gitignore | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index bccab087..c2098743 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,28 @@ CMakeCache.txt Makefile cmake_uninstall.cmake src/config.h -src/x11/libglfw.pc -src/win32/libglfw.pc -src/cocoa/libglfw.pc -*.so -*.a +src/libglfw.pc +src/libglfw.so +src/libglfw.a +examples/boing +examples/gears +examples/heightmap +examples/splitview +examples/triangle +examples/wave +tests/accuracy +tests/defaults +tests/dynamic +tests/events +tests/fsaa +tests/fsfocus +tests/gamma +tests/glfwinfo +tests/iconify +tests/joysticks +tests/listmodes +tests/peter +tests/reopen +tests/sharing +tests/tearing +tests/windows From d0ae6cbe8a0296cc4fe23e460d7fe049894dd266 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 17:50:51 +0100 Subject: [PATCH 04/12] Keep APIENTRY public (used by GL_ARB_debug_output). --- include/GL/glfw3.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 89dfc26c..e49654d1 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -65,7 +65,6 @@ extern "C" { #else #define APIENTRY #endif - #define GLFW_APIENTRY_DEFINED #endif /* APIENTRY */ @@ -605,11 +604,6 @@ GLFWAPI void glfwDisable(GLFWwindow window, int token); /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ -#ifdef GLFW_APIENTRY_DEFINED - #undef APIENTRY - #undef GLFW_APIENTRY_DEFINED -#endif - #ifdef GLFW_WINGDIAPI_DEFINED #undef WINGDIAPI #undef GLFW_WINGDIAPI_DEFINED From 129ef3f72ab978b471b460eaa8cea2f697b4c707 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 17:51:46 +0100 Subject: [PATCH 05/12] Added Xkb presence to version string. --- src/x11_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/x11_init.c b/src/x11_init.c index cceaa174..4ec8d1be 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -641,6 +641,9 @@ const char* _glfwPlatformGetVersionString(void) #else " no-extension-support" #endif +#if defined(_GLFW_HAS_XKB) + " Xkb" +#endif #if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) " clock_gettime" #endif From cde95f72c0222115f00a94ea7716bf5f95110142 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 18:13:31 +0100 Subject: [PATCH 06/12] Made X extensions be adjacent in version string. --- src/x11_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/x11_init.c b/src/x11_init.c index 4ec8d1be..4a8d0250 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -630,6 +630,9 @@ const char* _glfwPlatformGetVersionString(void) #if !defined(_GLFW_HAS_XRANDR) && !defined(_GLFW_HAS_XF86VIDMODE) " no-mode-switching-support" #endif +#if defined(_GLFW_HAS_XKB) + " Xkb" +#endif #if defined(_GLFW_HAS_GLXGETPROCADDRESS) " glXGetProcAddress" #elif defined(_GLFW_HAS_GLXGETPROCADDRESSARB) @@ -641,9 +644,6 @@ const char* _glfwPlatformGetVersionString(void) #else " no-extension-support" #endif -#if defined(_GLFW_HAS_XKB) - " Xkb" -#endif #if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) " clock_gettime" #endif From 379d0025ec11d579a99eb1acc1b0192a9bfc44d6 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 18:15:28 +0100 Subject: [PATCH 07/12] Removed library name from version string to more closely match OpenGL format. --- src/cocoa_init.m | 2 +- src/win32_init.c | 2 +- src/x11_init.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 785cd267..4370249f 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -261,7 +261,7 @@ int _glfwPlatformTerminate(void) const char* _glfwPlatformGetVersionString(void) { - const char* version = "GLFW " _GLFW_VERSION_FULL " Cocoa"; + const char* version = _GLFW_VERSION_FULL " Cocoa"; return version; } diff --git a/src/win32_init.c b/src/win32_init.c index a69cccd7..0756b0f2 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -205,7 +205,7 @@ int _glfwPlatformTerminate(void) const char* _glfwPlatformGetVersionString(void) { - const char* version = "GLFW " _GLFW_VERSION_FULL + const char* version = _GLFW_VERSION_FULL #if defined(__MINGW32__) " MinGW" #elif defined(__CYGWIN__) diff --git a/src/x11_init.c b/src/x11_init.c index 4a8d0250..0d00b8ab 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -620,7 +620,7 @@ int _glfwPlatformTerminate(void) const char* _glfwPlatformGetVersionString(void) { - const char* version = "GLFW " _GLFW_VERSION_FULL + const char* version = _GLFW_VERSION_FULL #if defined(_GLFW_HAS_XRANDR) " XRandR" #endif From d322fa1ab466874e090c81c9167cb284c0e2ae04 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 18:44:28 +0100 Subject: [PATCH 08/12] Added workaround for APIENTRY. --- src/win32_platform.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/win32_platform.h b/src/win32_platform.h index 8aa3561b..074e28ba 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -40,6 +40,11 @@ #define WIN32_LEAN_AND_MEAN #endif +// This is a workaround for the fact that glfw3.h needs to export APIENTRY (to +// correctly declare a GL_ARB_debug_output callback, for example) but windows.h +// thinks it is the only one that gets to do so +#undef APIENTRY + #include #include From 6add995b06047ec604399807f0dd8c7c8f52bb93 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 19:59:42 +0100 Subject: [PATCH 09/12] Formatting. --- src/x11_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/x11_init.c b/src/x11_init.c index 0d00b8ab..4d3c0f74 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -366,7 +366,7 @@ static void updateKeyCodeLUT(void) static GLboolean initDisplay(void) { - _glfwLibrary.X11.display = XOpenDisplay(0); + _glfwLibrary.X11.display = XOpenDisplay(NULL); if (!_glfwLibrary.X11.display) { _glfwSetError(GLFW_OPENGL_UNAVAILABLE, "X11/GLX: Failed to open X display"); From 1ca5391acdb3f9aba9564eed335d8228966cb79f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 21:12:34 +0100 Subject: [PATCH 10/12] Removed trailing whitespace. --- src/cocoa_gamma.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cocoa_gamma.m b/src/cocoa_gamma.m index 4f21314a..92c9abb0 100644 --- a/src/cocoa_gamma.m +++ b/src/cocoa_gamma.m @@ -48,13 +48,13 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp) CGGammaValue red[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue green[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE]; - + // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE // i.e. 256. I don't think anyone would want to change the gamma on // Mac anyway... if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) return; - + CGGetDisplayTransferByTable(CGMainDisplayID(), GLFW_GAMMA_RAMP_SIZE, red, green, blue, &sampleCount); @@ -78,13 +78,13 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp) CGGammaValue red[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue green[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE]; - + // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE // i.e. 256. I don't think anyone would want to change the gamma on // Mac anyway... if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) return; - + // Convert to float & take the difference of the original gamma and // the linear function. for (i = 0; i < size; i++) @@ -93,6 +93,7 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp) green[i] = ramp->green[i] / 65535.f; blue[i] = ramp->blue[i] / 65535.f; } + CGSetDisplayTransferByTable(CGMainDisplayID(), GLFW_GAMMA_RAMP_SIZE, red, green, blue); } From 57f9602b0e04bc75c57bbead33139985daaec0b0 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 18 Jan 2012 21:13:06 +0100 Subject: [PATCH 11/12] Removed speculation. --- src/cocoa_gamma.m | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/cocoa_gamma.m b/src/cocoa_gamma.m index 92c9abb0..eb291082 100644 --- a/src/cocoa_gamma.m +++ b/src/cocoa_gamma.m @@ -50,8 +50,6 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp) CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE]; // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE - // i.e. 256. I don't think anyone would want to change the gamma on - // Mac anyway... if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) return; @@ -80,8 +78,6 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp) CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE]; // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE - // i.e. 256. I don't think anyone would want to change the gamma on - // Mac anyway... if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) return; From 1187c7da62156546d856ec1895f4d7e95291c042 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 20 Jan 2012 02:23:27 +0100 Subject: [PATCH 12/12] Ported the temporary cursor jitter fix from 2.7.3. --- readme.html | 1 + src/x11_window.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/readme.html b/readme.html index 175e3b81..ede37bdc 100644 --- a/readme.html +++ b/readme.html @@ -314,6 +314,7 @@ version of GLFW.

  • [X11] Added support for the GLX_EXT_swap_control extension as an alternative to GLX_SGI_swap_control
  • [X11] Added the POSIX CLOCK_MONOTONIC time source as the preferred method
  • [X11] Bugfix: Calling glXCreateContextAttribsARB with an unavailable OpenGL version caused the application to terminate with a BadMatch Xlib error
  • +
  • [X11] Bugfix: A synchronization point necessary for jitter-free locked cursor mode was incorrectly removed
  • [Win32] Removed explicit support for versions of Windows older than Windows XP
  • [Win32] Bugfix: Window activation and iconification did not work as expected
  • [Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path
  • diff --git a/src/x11_window.c b/src/x11_window.c index 61e39583..641b3c84 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1736,6 +1736,11 @@ void _glfwPlatformPollEvents(void) window->width / 2, window->height / 2); window->X11.cursorCentered = GL_TRUE; + + // NOTE: This is a temporary fix. It works as long as you use + // offsets accumulated over the course of a frame, instead of + // performing the necessary actions per callback call. + XFlush( _glfwLibrary.X11.display ); } } }