From b28298f3294853d372bb7ba7cd30c7ba9d65fd7d Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 29 Jul 2012 14:07:01 +0200 Subject: [PATCH 1/5] Fixed call to CGPointMake. --- 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 fd57040e..d00fbbff 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1163,7 +1163,7 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y) { if (window->mode == GLFW_FULLSCREEN) { - CGPoint globalPoint = CGMakePoint(x, y); + CGPoint globalPoint = CGPointMake(x, y); CGDisplayMoveCursorToPoint(CGMainDisplayID(), globalPoint); } else From 93ec9fa90171ce7bdcd52ea0dc7ade981ed1d113 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Mon, 30 Jul 2012 00:14:09 +0100 Subject: [PATCH 2/5] Changed library output name to "glfw3", and pkg-config name to libglfw3. Since the headers are already named differently, this allows side-by-side installation of GLFW 2.x and GLFW 3.x. --- CMakeLists.txt | 6 +++--- src/CMakeLists.txt | 1 + src/{libglfw.pc.in => libglfw3.pc.in} | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) rename src/{libglfw.pc.in => libglfw3.pc.in} (92%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fbdd950..f082c3d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,10 +251,10 @@ install(FILES COPYING.txt readme.html # Create and install pkg-config file on supported platforms #-------------------------------------------------------------------- if (_GLFW_X11_GLX OR _GLFW_COCOA_NSGL) - configure_file(${GLFW_SOURCE_DIR}/src/libglfw.pc.in - ${GLFW_BINARY_DIR}/src/libglfw.pc @ONLY) + configure_file(${GLFW_SOURCE_DIR}/src/libglfw3.pc.in + ${GLFW_BINARY_DIR}/src/libglfw3.pc @ONLY) - install(FILES ${GLFW_BINARY_DIR}/src/libglfw.pc + install(FILES ${GLFW_BINARY_DIR}/src/libglfw3.pc DESTINATION lib/pkgconfig) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 25a80e3a..78cd1c07 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ elseif (_GLFW_X11_GLX) endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) +set_target_properties(glfw PROPERTIES OUTPUT_NAME "glfw3") if (BUILD_SHARED_LIBS) diff --git a/src/libglfw.pc.in b/src/libglfw3.pc.in similarity index 92% rename from src/libglfw.pc.in rename to src/libglfw3.pc.in index be6275aa..775819ed 100644 --- a/src/libglfw.pc.in +++ b/src/libglfw3.pc.in @@ -8,6 +8,6 @@ Description: A portable library for OpenGL, window and input Version: @GLFW_VERSION_FULL@ URL: http://www.glfw.org/ Requires.private: @GLFW_PKG_DEPS@ -Libs: -L${libdir} -lglfw +Libs: -L${libdir} -lglfw3 Libs.private: @GLFW_PKG_LIBS@ Cflags: -I${includedir} From 0f0e42b975742c0918e0813b7a24247c197ed758 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Mon, 30 Jul 2012 01:04:08 +0100 Subject: [PATCH 3/5] Use SOVERSION for shared libraries on Unix-like systems. --- CMakeLists.txt | 10 ++++++++++ src/CMakeLists.txt | 7 ++++++- src/libglfw3.pc.in | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f082c3d7..d49a2aea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,6 +215,16 @@ endif() #-------------------------------------------------------------------- set(GLFW_LIBRARIES ${glfw_LIBRARIES} CACHE STRING "Dependencies of GLFW") +#-------------------------------------------------------------------- +# Choose library output name +#-------------------------------------------------------------------- +if (BUILD_SHARED_LIBS AND UNIX) + # On Unix-like systems, shared libraries can use the soname system. + set(GLFW_LIB_NAME glfw) +else() + set(GLFW_LIB_NAME glfw3) +endif() + #-------------------------------------------------------------------- # Add subdirectories #-------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 78cd1c07..926ef668 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,9 +30,14 @@ elseif (_GLFW_X11_GLX) endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) -set_target_properties(glfw PROPERTIES OUTPUT_NAME "glfw3") +set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}") if (BUILD_SHARED_LIBS) + # Include version information in the output + set_target_properties(glfw PROPERTIES VERSION ${GLFW_VERSION}) + if (UNIX) + set_target_properties(glfw PROPERTIES SOVERSION ${GLFW_VERSION_MAJOR}) + endif() if (_GLFW_WIN32_WGL) # The GLFW DLL needs a special compile-time macro and import library name diff --git a/src/libglfw3.pc.in b/src/libglfw3.pc.in index 775819ed..175c902d 100644 --- a/src/libglfw3.pc.in +++ b/src/libglfw3.pc.in @@ -8,6 +8,6 @@ Description: A portable library for OpenGL, window and input Version: @GLFW_VERSION_FULL@ URL: http://www.glfw.org/ Requires.private: @GLFW_PKG_DEPS@ -Libs: -L${libdir} -lglfw3 +Libs: -L${libdir} -l@GLFW_LIB_NAME@ Libs.private: @GLFW_PKG_LIBS@ Cflags: -I${includedir} From a8686ce0b5072e96d1b8f84032fd517e69c682b8 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 30 Jul 2012 20:11:19 +0200 Subject: [PATCH 4/5] Added credit. --- readme.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.html b/readme.html index e0e7056e..10fa433b 100644 --- a/readme.html +++ b/readme.html @@ -848,6 +848,9 @@ 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
  • +
  • John Bartholomew, for adding proper version number and soname to the + shared library build
  • +
  • Lambert Clara, for a bug fix for the modes test
  • Jarrod Davis, for the Delphi port of GLFW
  • From 6c37c84d91d37925b14b9dadb988b02255533cc3 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 30 Jul 2012 20:15:34 +0200 Subject: [PATCH 5/5] Reduced the number of conditional blocks. --- src/x11_window.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index 84b6f7d6..e5c548de 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1139,20 +1139,14 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) void _glfwPlatformRefreshWindowParams(void) { -#if defined(_GLFW_HAS_XRANDR) - XRRScreenConfiguration* sc; -#endif /*_GLFW_HAS_XRANDR*/ -#if defined(_GLFW_HAS_XF86VIDMODE) - XF86VidModeModeLine modeline; - int dotclock; - float pixels_per_second, pixels_per_frame; -#endif /*_GLFW_HAS_XF86VIDMODE*/ _GLFWwindow* window = _glfwLibrary.currentWindow; // Retrieve refresh rate if possible if (_glfwLibrary.X11.RandR.available) { #if defined(_GLFW_HAS_XRANDR) + XRRScreenConfiguration* sc; + sc = XRRGetScreenInfo(_glfwLibrary.X11.display, _glfwLibrary.X11.root); window->refreshRate = XRRConfigCurrentRate(sc); XRRFreeScreenConfigInfo(sc); @@ -1161,6 +1155,10 @@ void _glfwPlatformRefreshWindowParams(void) else if (_glfwLibrary.X11.VidMode.available) { #if defined(_GLFW_HAS_XF86VIDMODE) + XF86VidModeModeLine modeline; + int dotclock; + float pixels_per_second, pixels_per_frame; + // Use the XF86VidMode extension to get current video mode XF86VidModeGetModeLine(_glfwLibrary.X11.display, _glfwLibrary.X11.screen,