From 9f30044333a8259a21cac923edd273e171d07dcb Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 10 Feb 2026 20:47:56 +0100 Subject: [PATCH] Backends: GLFW: try to set IMGUI_IMPL_GLFW_DISABLE_X11 / IMGUI_IMPL_GLFW_DISABLE_WAYLAND automatically if headers are not available. (#9225) Amend/fix 10d0162378 for system without X11/Wayland headers. (#8921, #8920, #8969) --- backends/imgui_impl_glfw.cpp | 10 ++++++++++ docs/CHANGELOG.txt | 1 + 2 files changed, 11 insertions(+) diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index f166b45d2..da54589fe 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -29,6 +29,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2026-02-10: Try to set IMGUI_IMPL_GLFW_DISABLE_X11 / IMGUI_IMPL_GLFW_DISABLE_WAYLAND automatically if corresponding headers are not accessible. (#9225) // 2025-12-12: Added IMGUI_IMPL_GLFW_DISABLE_X11 / IMGUI_IMPL_GLFW_DISABLE_WAYLAND to forcefully disable either. // 2025-12-10: Avoid repeated glfwSetCursor()/glfwSetInputMode() calls when unnecessary. Lowers overhead for very high framerates (e.g. 10k+ FPS). // 2025-11-06: Lower minimum requirement to GLFW 3.0. Though a recent version e.g GLFW 3.4 is highly recommended. @@ -109,6 +110,15 @@ #pragma clang diagnostic ignored "-Wglobal-constructors" // warning: declaration requires a global destructor // similar to above, not sure what the exact difference is. #endif +#if defined(__has_include) +#if !__has_include() || !__has_include() +#define IMGUI_IMPL_GLFW_DISABLE_X11 +#endif +#if !__has_include() +#define IMGUI_IMPL_GLFW_DISABLE_WAYLAND +#endif +#endif + // GLFW #if !defined(IMGUI_IMPL_GLFW_DISABLE_X11) && (defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)) #define GLFW_HAS_X11 1 diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 00349b9e7..69da2270c 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -219,6 +219,7 @@ Other Changes: Lowers overhead for very high framerates (e.g. 10k+ FPS). [@maxliani] - GLFW: Added IMGUI_IMPL_GLFW_DISABLE_X11 / IMGUI_IMPL_GLFW_DISABLE_WAYLAND to forcefully disable either. (#9109, #9116) + Try to set them automatically if headers are not accessible. (#9225) - OpenGL3: Fixed embedded loader multiple init/shutdown cycles broken on some platforms. (#8792, #9112) - SDL2, SDL3: changed `GetClipboardText()` handler to return NULL on error aka