Skip to content

Commit 3109131

Browse files
committed
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_glfw.h # imgui.cpp # imgui_internal.h
2 parents 42015f7 + 635eb1d commit 3109131

File tree

10 files changed

+137
-68
lines changed

10 files changed

+137
-68
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ imgui*.ini
1212
examples/*/Debug/*
1313
examples/*/Release/*
1414
examples/*/x64/*
15+
examples/*.tmp
1516

1617
## Visual Studio artifacts
1718
.vs

backends/imgui_impl_glfw.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// dear imgui: Platform Backend for GLFW
22
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
33
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
4-
// (Requires: GLFW 3.1+. Prefer GLFW 3.3+ or GLFW 3.4+ for full feature support.)
4+
// (Requires: GLFW 3.0+. Prefer GLFW 3.3+/3.4+ for full feature support.)
55

66
// Implemented features:
77
// [X] Platform: Clipboard support.
88
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
99
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values are obsolete since 1.87 and not supported since 1.91.5]
1010
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
11-
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
11+
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors) with GLFW 3.1+. Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
1212
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
1313
// [X] Multiple Dear ImGui contexts support.
1414
// Missing features or Issues:
@@ -32,6 +32,7 @@
3232
// CHANGELOG
3333
// (minor and older changes stripped away, please see git history for details)
3434
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
35+
// 2025-11-06: Lower minimum requirement to GLFW 3.0. Though a recent version e.g GLFW 3.4 is highly recommended.
3536
// 2025-09-18: Call platform_io.ClearPlatformHandlers() on shutdown.
3637
// 2025-09-15: Content Scales are always reported as 1.0 on Wayland. FramebufferScale are always reported as 1.0 on X11. (#8920, #8921)
3738
// 2025-09-10: [Docking] Improve multi-viewport behavior in tiling WMs on X11 via the ImGui_ImplGlfw_SetWindowFloating() function. Note: using GLFW backend on Linux/BSD etc. requires linking with -lX11. (#8884, #8474, #8289)
@@ -159,6 +160,7 @@
159160

160161
// We gather version tests as define in order to easily see which features are version-dependent.
161162
#define GLFW_VERSION_COMBINED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 + GLFW_VERSION_REVISION)
163+
#define GLFW_HAS_CREATECURSOR (GLFW_VERSION_COMBINED >= 3100) // 3.1+ glfwCreateCursor()
162164
#define GLFW_HAS_WINDOW_TOPMOST (GLFW_VERSION_COMBINED >= 3200) // 3.2+ GLFW_FLOATING
163165
#define GLFW_HAS_WINDOW_HOVERED (GLFW_VERSION_COMBINED >= 3300) // 3.3+ GLFW_HOVERED
164166
#define GLFW_HAS_WINDOW_ALPHA (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwSetWindowOpacity
@@ -212,7 +214,9 @@ struct ImGui_ImplGlfw_Data
212214
GlfwClientApi ClientApi;
213215
double Time;
214216
GLFWwindow* MouseWindow;
217+
#if GLFW_HAS_CREATECURSOR
215218
GLFWcursor* MouseCursors[ImGuiMouseCursor_COUNT];
219+
#endif
216220
bool MouseIgnoreButtonUpWaitForFocusLoss;
217221
bool MouseIgnoreButtonUp;
218222
ImVec2 LastValidMousePos;
@@ -681,7 +685,9 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
681685
snprintf(bd->BackendPlatformName, sizeof(bd->BackendPlatformName), "imgui_impl_glfw (%d)", GLFW_VERSION_COMBINED);
682686
io.BackendPlatformUserData = (void*)bd;
683687
io.BackendPlatformName = bd->BackendPlatformName;
688+
#if GLFW_HAS_CREATECURSOR
684689
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
690+
#endif
685691
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
686692

687693
bool has_viewports = false;
@@ -721,6 +727,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
721727
// (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
722728
// GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
723729
// Missing cursors will return nullptr and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
730+
#if GLFW_HAS_CREATECURSOR
724731
GLFWerrorfun prev_error_callback = glfwSetErrorCallback(nullptr);
725732
bd->MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
726733
bd->MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
@@ -739,6 +746,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
739746
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
740747
#endif
741748
glfwSetErrorCallback(prev_error_callback);
749+
#endif
742750
#if GLFW_HAS_GETERROR && !defined(__EMSCRIPTEN__) // Eat errors (see #5908)
743751
(void)glfwGetError(nullptr);
744752
#endif
@@ -825,10 +833,10 @@ void ImGui_ImplGlfw_Shutdown()
825833
if (bd->CanvasSelector)
826834
emscripten_set_wheel_callback(bd->CanvasSelector, nullptr, false, nullptr);
827835
#endif
828-
836+
#if GLFW_HAS_CREATECURSOR
829837
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
830838
glfwDestroyCursor(bd->MouseCursors[cursor_n]);
831-
839+
#endif
832840
// Windows: restore our WndProc hook
833841
#ifdef _WIN32
834842
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
@@ -937,7 +945,9 @@ static void ImGui_ImplGlfw_UpdateMouseCursor()
937945
{
938946
// Show OS mouse cursor
939947
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
948+
#if GLFW_HAS_CREATECURSOR
940949
glfwSetCursor(window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]);
950+
#endif
941951
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
942952
}
943953
}

backends/imgui_impl_glfw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
99
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values are obsolete since 1.87 and not supported since 1.91.5]
1010
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
11-
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
11+
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors) with GLFW 3.1+. Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
1212
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
1313
// [X] Multiple Dear ImGui contexts support.
1414
// Missing features or Issues:

docs/CHANGELOG.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ HOW TO UPDATE?
4141

4242
Breaking Changes:
4343

44+
- Keys: commented out legacy names which were obsoleted in 1.89.0 (August 2022).
45+
- ImGuiKey_ModCtrl --> ImGuiMod_Ctrl
46+
- ImGuiKey_ModShift --> ImGuiMod_Shift
47+
- ImGuiKey_ModAlt --> ImGuiMod_Alt
48+
- ImGuiKey_ModSuper --> ImGuiMod_Super
49+
- IO: commented out legacy io.ClearInputCharacters() obsoleted in 1.89.8 (Aug 2023).
50+
Using io.ClearInputKeys() is enough.
51+
- BeginChild: commented out legacy names which were obsoleted in 1.90.0 (Nov 2023),
52+
1.90.9 (July 2024), 1.91.1 (August 2024). (#462, #7687)
53+
- ImGuiChildFlags_Border --> ImGuiChildFlags_Borders
54+
- ImGuiWindowFlags_NavFlattened --> ImGuiChildFlags_NavFlattened (moved to ImGuiChildFlags).
55+
- ImGuiWindowFlags_AlwaysUseWindowPadding --> ImGuiChildFlags_AlwaysUseWindowPadding (moved to ImGuiChildFlags).
56+
So:
57+
- BeginChild(name, size, 0, ImGuiWindowFlags_NavFlattened) --> BeginChild(name, size, ImGuiChildFlags_NavFlattened, 0)
58+
- BeginChild(name, size, 0, ImGuiWindowFlags_AlwaysUseWindowPadding) --> BeginChild(name, size, ImGuiChildFlags_AlwaysUseWindowPadding, 0)
59+
- Commented out legacy SetItemAllowOverlap() obsoleted in 1.89.7: this never worked right.
60+
Use SetNextItemAllowOverlap() _before_ item instead.
61+
4462
Other Changes:
4563

4664
- Tables: fixed a bug where nesting BeginTable()->Begin()->BeginTable() would
@@ -50,6 +68,9 @@ Other Changes:
5068
- Tables: Angled headers: fixed an auto-resize feedback loop that could
5169
affect tables with empty non-resizing columns using angled headers, making
5270
them typically flicker back and forth between +0 and +1 pixels.
71+
- Windows: io.ConfigWindowsMoveFromTitleBarOnly is latched during Begin(),
72+
effectively allowing to change the value on a per-window basis (although
73+
there is a better internal mechanism for it).
5374
- Disabled: fixed a bug when a previously enabled item that got nav focus
5475
and then turns disabled could still be activated using keyboard. (#9036)
5576
- InputText: when buffer is not resizable, trying to paste contents that
@@ -73,6 +94,12 @@ Other Changes:
7394
triggered by some widgets e.g. Checkbox(), Selectable() and many others, which
7495
cleared ActiveId at the same time as editing. (#9028)
7596
Note that IsItemDeactivatedAfterEdit() was not affected, only IsItemEdited).
97+
- Drag and Drop:
98+
- Added ImGuiDragDropFlags_AcceptDrawAsHovered to make accepting item render
99+
as hovered, which can allow using e.g. Button() as drop target. (#8632)
100+
- Style: added ImGuiCol_DragDropTargetBg, style.DragDropTargetRounding,
101+
style.DragDropTargetBorderSize and style.DragDropTargetPadding to configure
102+
the drop target highlight. (#9056) [@aaronkirkham]
76103
- Demo: About Box: emit infos to convey when IM_ASSERT() macro is disabled,
77104
- so users don't miss out on programming errors being reported.
78105
- so it is included in config/build info submitted in new GitHub Issues.
@@ -84,6 +111,8 @@ Other Changes:
84111
- Backends:
85112
- GLFW: fixed building on Linux platforms where Wayland headers
86113
are not available. (#9024, #8969, #8921, #8920) [@jagot]
114+
- GLFW: lower minimum requirement from GLFW 3.1 to GLFW 3.0. Though
115+
a recent version e.g GLFW 3.4 is highly recommended! (#9055) [@Clownacy]
87116
- SDL3: fixed Platform_OpenInShellFn() return value (the return value
88117
was unused in core but might be used by a direct caller). (#9027) [@achabense]
89118
- SDL3: fixed an issue with missing characters events when an already active text

0 commit comments

Comments
 (0)