Backends: GLFW: fixed applying mouse cursor shapes to secondary viewports. (#9545)
Amend 9a4fd69f6
This commit is contained in:
parent
367b2c24f3
commit
d7950e2c42
@ -32,6 +32,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2026-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2026-09-15: [Docking] Fixed applying mouse cursor shapes to secondary viewports (broken in 1.92.6, 2025-12-10).
|
||||
// 2026-04-21: Added a Win32-specific implementation of ImGui_ImplGlfw_GetContentScaleXXXX functions for legacy GLFW 3.2.
|
||||
// 2026-03-25: Mouse cursor is properly restored if changed by user app/code while using glfwSetInputMode(..., GLFW_CURSOR_DISABLED) or ImGuiConfigFlags_NoMouseCursorChange. Amend change from 2025-12-10.
|
||||
// 2026-02-10: Try to set IMGUI_IMPL_GLFW_DISABLE_X11 / IMGUI_IMPL_GLFW_DISABLE_WAYLAND automatically if corresponding headers are not accessible. (#9225)
|
||||
@ -996,12 +997,21 @@ static void ImGui_ImplGlfw_UpdateMouseCursor()
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) || glfwGetInputMode(bd->Window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
bd->LastMouseCursor = nullptr; // Invalidate so that if user changes underlying cursor we will update it next time we can.
|
||||
bd->LastMouseCursor = nullptr; // Invalidate so that if user changes underlying cursor we will update it next time we can.
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
|
||||
#if GLFW_HAS_CREATECURSOR
|
||||
GLFWcursor* set_mouse_cursor = bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow];
|
||||
if (bd->LastMouseCursor == set_mouse_cursor)
|
||||
set_mouse_cursor = NULL;
|
||||
else
|
||||
bd->LastMouseCursor = set_mouse_cursor;
|
||||
#endif
|
||||
|
||||
for (int n = 0; n < platform_io.Viewports.Size; n++)
|
||||
{
|
||||
GLFWwindow* window = (GLFWwindow*)platform_io.Viewports[n]->PlatformHandle;
|
||||
@ -1019,12 +1029,8 @@ static void ImGui_ImplGlfw_UpdateMouseCursor()
|
||||
// Show OS mouse cursor
|
||||
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
|
||||
#if GLFW_HAS_CREATECURSOR
|
||||
GLFWcursor* cursor = bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow];
|
||||
if (bd->LastMouseCursor != cursor)
|
||||
{
|
||||
glfwSetCursor(window, cursor);
|
||||
bd->LastMouseCursor = cursor;
|
||||
}
|
||||
if (set_mouse_cursor)
|
||||
glfwSetCursor(window, set_mouse_cursor);
|
||||
#endif
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
}
|
||||
@ -1422,6 +1428,7 @@ static void ImGui_ImplGlfw_CreateWindow(ImGuiViewport* viewport)
|
||||
glfwMakeContextCurrent(vd->Window);
|
||||
glfwSwapInterval(0);
|
||||
}
|
||||
bd->LastMouseCursor = nullptr; // Invalidate so that cursor is set again
|
||||
}
|
||||
|
||||
static void ImGui_ImplGlfw_DestroyWindow(ImGuiViewport* viewport)
|
||||
|
||||
@ -114,6 +114,8 @@ Other Changes:
|
||||
Docking+Viewports Branch:
|
||||
|
||||
- Backends:
|
||||
- GLFW: fixed applying mouse cursor shapes to secondary viewports, broken in 1.92.6
|
||||
when introducing a cache. (#9545) [@JamesWrigley]
|
||||
- Metal: fixed resizing windows losing framebuffer scale. (#6828, #8856) [@laikoken]
|
||||
- Examples:
|
||||
- SDL3+Metal, GLFW+Metal: fix multi-viewport support.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user