From 7e0ca6705b0a687a15acde6a90b908f5b6f138d6 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Tue, 31 Jan 2012 10:00:52 +0100 Subject: [PATCH 01/12] Added use of XkbKeycodeToKeysym when Xkb is available. --- src/x11_init.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/x11_init.c b/src/x11_init.c index 4d3c0f74..3ed9ab13 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -79,7 +79,11 @@ static int keyCodeToGLFWKeyCode(int keyCode) // Note: This way we always force "NumLock = ON", which is intentional // since the returned key code should correspond to a physical // location. +#if defined(_GLFW_HAS_XKB) + keySym = XkbKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1, 0); +#else keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1); +#endif switch (keySym) { case XK_KP_0: return GLFW_KEY_KP_0; @@ -102,7 +106,12 @@ static int keyCodeToGLFWKeyCode(int keyCode) // Now try pimary keysym for function keys (non-printable keys). These // should not be layout dependent (i.e. US layout and international // layouts should give the same result). +#if defined(_GLFW_HAS_XKB) + keySym = XkbKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 0, 0); +#else keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 0); +#endif + switch (keySym) { case XK_Escape: return GLFW_KEY_ESCAPE; From f47f5d9f59623e9a46f095c0840413ac3cc631af Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 26 Feb 2012 18:41:33 +0100 Subject: [PATCH 02/12] Updated changelog. --- readme.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.html b/readme.html index 5ab86c64..19c438f5 100644 --- a/readme.html +++ b/readme.html @@ -869,7 +869,8 @@ their skills. Special thanks go out to:

  • Tristam MacDonald, for his bug reports and feedback on the Cocoa port
  • -
  • Hans 'Hanmac' Mackowiak, for adding UTF-8 window title support on X11
  • +
  • Hans 'Hanmac' Mackowiak, for adding UTF-8 window title support on X11 and + a fix for the Xkb support
  • David Medlock, for doing the initial Lua port
  • From 98fbc07aa4d73e61b514f90f7678fa542799f0a6 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 27 Feb 2012 02:21:26 +0100 Subject: [PATCH 03/12] Fixed GLFW_WINDOW_NO_RESIZE state not being saved. --- readme.html | 2 ++ src/cocoa_window.m | 2 ++ src/win32_window.c | 1 + 3 files changed, 5 insertions(+) diff --git a/readme.html b/readme.html index 19c438f5..d23f982a 100644 --- a/readme.html +++ b/readme.html @@ -315,6 +315,7 @@ version of GLFW.

  • [Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable
  • [Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash
  • [Cocoa] Bugfix: glfwInit changed the current directory for unbundled executables
  • +
  • [Cocoa] Bugfix: The GLFW_WINDOW_NO_RESIZE window parameter was always zero
  • [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] Added dependency on libm, where present
  • @@ -328,6 +329,7 @@ version of GLFW.

  • [Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path
  • [Win32] Bugfix: The array for WGL context attributes was too small and could overflow
  • [Win32] Bugfix: Alt+F4 hot key was not translated into WM_CLOSE
  • +
  • [Win32] Bugfix: The GLFW_WINDOW_NO_RESIZE window parameter was always zero
  • v2.7

    diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 221dcc5e..bf3b0fbc 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -816,6 +816,8 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window, if (!initializeCocoa()) return GL_FALSE; + window->resizable = wndconfig->resizable; + // We can only have one application delegate, but we only allocate it the // first time we create a window to keep all window code in this file if (_glfwLibrary.NS.delegate == nil) diff --git a/src/win32_window.c b/src/win32_window.c index 24788a33..0f3c67d0 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1441,6 +1441,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window, GLboolean recreateContext = GL_FALSE; window->Win32.desiredRefreshRate = wndconfig->refreshRate; + window->resizable = wndconfig->resizable; if (!_glfwLibrary.Win32.classAtom) { From a82598ea24d08b82c9e28f3943a70e5bd7ae1f5f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 29 Feb 2012 19:52:34 +0100 Subject: [PATCH 04/12] Disable dynamic loading for Win32 DLL. --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b5569c40..79a5c314 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,9 +47,10 @@ set_target_properties(libglfwStatic libglfwShared PROPERTIES OUTPUT_NAME glfw) if(WIN32) + target_link_libraries(libglfwShared winmm) # The GLFW DLL needs a special compile-time macro and import library name set_target_properties(libglfwShared PROPERTIES - DEFINE_SYMBOL GLFW_BUILD_DLL + COMPILE_DEFINITIONS "GLFW_BUILD_DLL;_GLFW_NO_DLOAD_GDI32;_GLFW_NO_DLOAD_WINMM" PREFIX "" IMPORT_PREFIX "" IMPORT_SUFFIX "dll.lib") From cd7b9b1568a8145bb22393fed1be27223a6f0d3b Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 29 Feb 2012 20:15:39 +0100 Subject: [PATCH 05/12] CMake file formatting. --- CMakeLists.txt | 28 +++++++++++++--------------- examples/CMakeLists.txt | 10 +++++----- src/CMakeLists.txt | 20 ++++++++++---------- tests/CMakeLists.txt | 4 ++-- 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e6554c5..a4454365 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ if (WIN32) # Set up library and include paths list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) -endif (WIN32) +endif() #-------------------------------------------------------------------- # Set up GLFW for Xlib and GLX on Unix-like systems with X Windows @@ -47,12 +47,12 @@ if (UNIX AND NOT APPLE) find_library(MATH_LIBRARY m) if (MATH_LIBRARY) list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY}) - endif(MATH_LIBRARY) + endif() find_library(RT_LIBRARY rt) if (RT_LIBRARY) list(APPEND GLFW_LIBRARIES ${RT_LIBRARY}) - endif(RT_LIBRARY) + endif() include(CheckFunctionExists) include(CheckSymbolExists) @@ -83,24 +83,22 @@ if (UNIX AND NOT APPLE) if (NOT _GLFW_HAS_GLXGETPROCADDRESS) check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB) - endif (NOT _GLFW_HAS_GLXGETPROCADDRESS) + endif() if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB) check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT) - endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB) + endif() if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND NOT _GLFW_HAS_GLXGETPROCADDRESSEXT) message(WARNING "No glXGetProcAddressXXX variant found") - endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND - NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND - NOT _GLFW_HAS_GLXGETPROCADDRESSEXT) + endif() if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(_GLFW_USE_LINUX_JOYSTICKS 1) - endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") -endif(UNIX AND NOT APPLE) + endif() +endif() #-------------------------------------------------------------------- # Set up GLFW for Cocoa and NSOpenGL on Mac OS X @@ -121,7 +119,7 @@ if (UNIX AND APPLE) set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5") else(GLFW_BUILD_UNIVERSAL) message(STATUS "Building GLFW only for the native architecture") - endif(GLFW_BUILD_UNIVERSAL) + endif() # Set up library and include paths find_library(COCOA_FRAMEWORK Cocoa) @@ -131,7 +129,7 @@ if (UNIX AND APPLE) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK}) list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK}) -endif(UNIX AND APPLE) +endif() #-------------------------------------------------------------------- # Add subdirectories @@ -140,11 +138,11 @@ add_subdirectory(src) if (GLFW_BUILD_EXAMPLES) add_subdirectory(examples) -endif(GLFW_BUILD_EXAMPLES) +endif() if (GLFW_BUILD_TESTS) add_subdirectory(tests) -endif(GLFW_BUILD_TESTS) +endif() #-------------------------------------------------------------------- # Create shared configuration header @@ -175,7 +173,7 @@ configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in" # Uninstall operation # Don't generate this target if a higher-level project already has #-------------------------------------------------------------------- -if(NOT TARGET uninstall) +if (NOT TARGET uninstall) configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in ${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d511b22d..37b7f754 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -7,14 +7,14 @@ include_directories(${GLFW_SOURCE_DIR}/include ${GLFW_SOURCE_DIR}/support ${OPENGL_INCLUDE_DIR}) -if(APPLE) +if (APPLE) # Set fancy names for bundles add_executable(Boing MACOSX_BUNDLE boing.c) add_executable(Gears MACOSX_BUNDLE gears.c) add_executable("Split View" MACOSX_BUNDLE splitview.c) add_executable(Triangle MACOSX_BUNDLE triangle.c) add_executable(Wave MACOSX_BUNDLE wave.c) -else(APPLE) +else() # Set boring names for executables add_executable(boing WIN32 boing.c) add_executable(gears WIN32 gears.c) @@ -22,13 +22,13 @@ else(APPLE) add_executable(splitview WIN32 splitview.c) add_executable(triangle WIN32 triangle.c) add_executable(wave WIN32 wave.c) -endif(APPLE) +endif() set(WINDOWS_BINARIES boing gears heightmap splitview triangle wave) -if(MSVC) +if (MSVC) # Tell MSVC to use main instead of WinMain for Windows subsystem executables set_target_properties(${WINDOWS_BINARIES} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") -endif(MSVC) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 79a5c314..bdc4d5fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,15 +1,15 @@ if(UNIX) - if(_GLFW_HAS_XRANDR) + if (_GLFW_HAS_XRANDR) set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr") - endif(_GLFW_HAS_XRANDR) - if(_GLFW_HAS_XF86VIDMODE) + endif() + if (_GLFW_HAS_XF86VIDMODE) set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm") - endif(_GLFW_HAS_XF86VIDMODE) + endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig) -endif(UNIX) +endif() include_directories(${GLFW_SOURCE_DIR}/src ${GLFW_BINARY_DIR}/src @@ -37,7 +37,7 @@ elseif(_GLFW_X11_GLX) x11_window.c) else() message(FATAL_ERROR "No supported platform was selected") -endif(_GLFW_COCOA_NSGL) +endif() add_library(libglfwStatic STATIC ${libglfw_SOURCES}) add_library(libglfwShared SHARED ${libglfw_SOURCES}) @@ -54,16 +54,16 @@ if(WIN32) PREFIX "" IMPORT_PREFIX "" IMPORT_SUFFIX "dll.lib") -endif(WIN32) +endif() if(APPLE) # Append -fno-common to the compile flags to work around a bug in the Apple GCC get_target_property(CFLAGS libglfwShared COMPILE_FLAGS) - if(NOT CFLAGS) + if (NOT CFLAGS) set(CFLAGS "") - endif(NOT CFLAGS) + endif() set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common") -endif(APPLE) +endif() install(TARGETS libglfwStatic libglfwShared DESTINATION lib) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d7ac0954..58631603 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -61,9 +61,9 @@ set(WINDOWS_BINARIES accuracy sharing tearing title windows) set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify joysticks listmodes peter reopen) -if(MSVC) +if (MSVC) # Tell MSVC to use main instead of WinMain for Windows subsystem executables set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup") -endif(MSVC) +endif() From 537754aab84f7edbca100c7c70682f0331c05a20 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 29 Feb 2012 20:17:09 +0100 Subject: [PATCH 06/12] Require CMake 2.8. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4454365..25f83279 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ project(GLFW C) -cmake_minimum_required(VERSION 2.4) +cmake_minimum_required(VERSION 2.8) cmake_policy(VERSION 2.4) set(GLFW_VERSION_MAJOR "3") From a27c444af41434eb270df8dd7a48954585aa4ec3 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 29 Feb 2012 20:19:05 +0100 Subject: [PATCH 07/12] Updated comment. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25f83279..03870594 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,7 +160,7 @@ install(DIRECTORY include/GL DESTINATION include install(FILES COPYING.txt readme.html DESTINATION share/doc/glfw-${GLFW_VERSION_FULL}/) -# The respective port's CMakeLists.txt file installs the library +# The src directory's CMakeLists.txt file installs the library #-------------------------------------------------------------------- # -- Documentation generation From e7fb35a5d8075cd2d2cb28181213b75356d26769 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 1 Mar 2012 03:41:36 +0100 Subject: [PATCH 08/12] Removed legacy CMake policy. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03870594..f27cf7cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ project(GLFW C) cmake_minimum_required(VERSION 2.8) -cmake_policy(VERSION 2.4) set(GLFW_VERSION_MAJOR "3") set(GLFW_VERSION_MINOR "0") From f49119107f6b214a179affc6aba798c2dca70eec Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 1 Mar 2012 03:45:06 +0100 Subject: [PATCH 09/12] Removed misplaced Win32 configuration macros. --- src/config.h.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index f966356c..46a6e2aa 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -60,11 +60,6 @@ // 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@" From b5a3249f2e8a28d1a1324449e80f3b610cc7d40f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 1 Mar 2012 03:51:35 +0100 Subject: [PATCH 10/12] Removed unused header. --- include/GL/glfw3.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index e84bdbba..cc817521 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -136,10 +136,6 @@ extern "C" { /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ -/* Include the declaration of the size_t type used below. - */ -#include - /* Include standard OpenGL headers: GLFW uses GL_FALSE/GL_TRUE, and it is * convenient for the user to only have to include . This also * solves the problem with Windows and needing some From 6f3f68bad1c3aef37c7299cdcdb30b8b28e8e85c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 1 Mar 2012 17:03:42 +0100 Subject: [PATCH 11/12] Gave CMake toolchain file clearer name. --- CMake/{linux-mingw32msvc.cmake => linux-i586-mingw32msvc.cmake} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CMake/{linux-mingw32msvc.cmake => linux-i586-mingw32msvc.cmake} (100%) diff --git a/CMake/linux-mingw32msvc.cmake b/CMake/linux-i586-mingw32msvc.cmake similarity index 100% rename from CMake/linux-mingw32msvc.cmake rename to CMake/linux-i586-mingw32msvc.cmake From 4ac5ea331bdd6e117e5ef36431f051058b30be1b Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 1 Mar 2012 17:15:37 +0100 Subject: [PATCH 12/12] Updated toolchain file README. --- CMake/README.txt | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/CMake/README.txt b/CMake/README.txt index d24854ed..9581f832 100644 --- a/CMake/README.txt +++ b/CMake/README.txt @@ -1,10 +1,19 @@ -This folder contains a collection of toolchains definition in order to -support cross compilation. The naming scheme is the following: +This directory contains a collection of toolchain definitions for cross +compilation, currently limited to compiling Win32 binaries on Linux. + +The toolchain file naming scheme is as follows: + host-system-compiler.cmake -to use this at the time you run the initial cmake command use the -following parameter - -DCMAKE_TOOLCHAIN_FILE=./toolchains/XXX-XXX-XXX.cmake - which maps to file in this folder. +To use these files you add a special parameter when configuring the source tree: + + cmake -DCMAKE_TOOLCHAIN_FILE= . + +For example, to use the Debian GNU/Linux MinGW package, run CMake like this: + + cmake -DCMAKE_TOOLCHAIN_FILE=CMake/linux-i586-mingw32msvc.cmake . + +For more details see this article: + + http://www.paraview.org/Wiki/CMake_Cross_Compiling -For more details see: http://www.paraview.org/Wiki/CMake_Cross_Compiling