From f1b0d15813098228369dd647ffc04a7dbd92c02a Mon Sep 17 00:00:00 2001 From: Marco Maia Date: Sun, 3 Dec 2023 15:53:52 -0300 Subject: [PATCH] Fix warning while using external GLFW older than version 3.4.0 (#3599) Co-authored-by: Marco Maia --- src/platforms/rcore_desktop.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/platforms/rcore_desktop.c b/src/platforms/rcore_desktop.c index 0aca73134..e31032911 100644 --- a/src/platforms/rcore_desktop.c +++ b/src/platforms/rcore_desktop.c @@ -88,11 +88,6 @@ //---------------------------------------------------------------------------------- // Defines and Macros //---------------------------------------------------------------------------------- -// TODO: HACK: Added flag if not provided by GLFW when using external library -// Latest GLFW release (GLFW 3.3.8) does not implement this flag, it was added for 3.4.0-dev -#if !defined(GLFW_MOUSE_PASSTHROUGH) - #define GLFW_MOUSE_PASSTHROUGH 0x0002000D -#endif //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -396,11 +391,13 @@ void SetWindowState(unsigned int flags) } // State change: FLAG_WINDOW_MOUSE_PASSTHROUGH +#if defined (GLFW_MOUSE_PASSTHROUGH) if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) != (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0)) { glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE); CORE.Window.flags |= FLAG_WINDOW_MOUSE_PASSTHROUGH; } +#endif // State change: FLAG_MSAA_4X_HINT if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) != (flags & FLAG_MSAA_4X_HINT)) && ((flags & FLAG_MSAA_4X_HINT) > 0)) @@ -509,11 +506,13 @@ void ClearWindowState(unsigned int flags) } // State change: FLAG_WINDOW_MOUSE_PASSTHROUGH +#if defined (GLFW_MOUSE_PASSTHROUGH) if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0)) { glfwSetWindowAttrib(platform.handle, GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE); CORE.Window.flags &= ~FLAG_WINDOW_MOUSE_PASSTHROUGH; } +#endif // State change: FLAG_MSAA_4X_HINT if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) > 0) && ((flags & FLAG_MSAA_4X_HINT) > 0)) @@ -1316,8 +1315,10 @@ int InitPlatform(void) else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE); // Mouse passthrough +#if defined (GLFW_MOUSE_PASSTHROUGH) if ((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) glfwWindowHint(GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE); else glfwWindowHint(GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE); +#endif if (CORE.Window.flags & FLAG_MSAA_4X_HINT) {