From 31a7c4f66eada14999ac195c819b0e13dba3e18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 14 Jan 2020 21:54:01 +0100 Subject: [PATCH] Platform: check for presence of GLFW cursor defines instead of a version. Makes this work on older Git clones which have version set as 3.4 but don't contain those defines yet. --- src/Magnum/Platform/GlfwApplication.cpp | 4 ++-- src/Magnum/Platform/GlfwApplication.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index 76d329769..e59e884c8 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -710,13 +710,13 @@ constexpr Int CursorMap[] { GLFW_ARROW_CURSOR, GLFW_IBEAM_CURSOR, GLFW_CROSSHAIR_CURSOR, - #if GLFW_VERSION_MAJOR*100 + GLFW_VERSION_MINOR >= 304 + #ifdef GLFW_RESIZE_NWSE_CURSOR GLFW_RESIZE_NWSE_CURSOR, GLFW_RESIZE_NESW_CURSOR, #endif GLFW_HRESIZE_CURSOR, GLFW_VRESIZE_CURSOR, - #if GLFW_VERSION_MAJOR*100 + GLFW_VERSION_MINOR >= 304 + #ifdef GLFW_RESIZE_NWSE_CURSOR GLFW_RESIZE_ALL_CURSOR, GLFW_NOT_ALLOWED_CURSOR, #endif diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index cd525df6d..3474f9efb 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -562,7 +562,11 @@ class GlfwApplication { TextInput, /**< Text input */ Crosshair, /**< Crosshair */ - #if defined(DOXYGEN_GENERATING_OUTPUT) || GLFW_VERSION_MAJOR*100 + GLFW_VERSION_MINOR >= 304 + /* Checking for GLFW_RESIZE_NWSE_CURSOR being defined instead of a + version check because older Git clones have version set to 3.4 + but don't contain those defines. All new cursors were added in + the same commit, so it's okay to test for just one define. */ + #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(GLFW_RESIZE_NWSE_CURSOR) /** * Double arrow pointing northwest and southeast * @note Available since GLFW 3.4. @@ -579,7 +583,7 @@ class GlfwApplication { ResizeWE, /**< Double arrow pointing west and east */ ResizeNS, /**< Double arrow pointing north and south */ - #if defined(DOXYGEN_GENERATING_OUTPUT) || GLFW_VERSION_MAJOR*100 + GLFW_VERSION_MINOR >= 304 + #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(GLFW_RESIZE_NWSE_CURSOR) /** * Four pointed arrow pointing north, south, east, and west * @note Available since GLFW 3.4.