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
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (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-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-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-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)
|
// 2026-02-10: Try to set IMGUI_IMPL_GLFW_DISABLE_X11 / IMGUI_IMPL_GLFW_DISABLE_WAYLAND automatically if corresponding headers are not accessible. (#9225)
|
||||||
@ -1002,6 +1003,15 @@ static void ImGui_ImplGlfw_UpdateMouseCursor()
|
|||||||
|
|
||||||
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
||||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
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++)
|
for (int n = 0; n < platform_io.Viewports.Size; n++)
|
||||||
{
|
{
|
||||||
GLFWwindow* window = (GLFWwindow*)platform_io.Viewports[n]->PlatformHandle;
|
GLFWwindow* window = (GLFWwindow*)platform_io.Viewports[n]->PlatformHandle;
|
||||||
@ -1019,12 +1029,8 @@ static void ImGui_ImplGlfw_UpdateMouseCursor()
|
|||||||
// Show OS mouse cursor
|
// Show OS mouse cursor
|
||||||
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
|
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
|
||||||
#if GLFW_HAS_CREATECURSOR
|
#if GLFW_HAS_CREATECURSOR
|
||||||
GLFWcursor* cursor = bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow];
|
if (set_mouse_cursor)
|
||||||
if (bd->LastMouseCursor != cursor)
|
glfwSetCursor(window, set_mouse_cursor);
|
||||||
{
|
|
||||||
glfwSetCursor(window, cursor);
|
|
||||||
bd->LastMouseCursor = cursor;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
}
|
}
|
||||||
@ -1422,6 +1428,7 @@ static void ImGui_ImplGlfw_CreateWindow(ImGuiViewport* viewport)
|
|||||||
glfwMakeContextCurrent(vd->Window);
|
glfwMakeContextCurrent(vd->Window);
|
||||||
glfwSwapInterval(0);
|
glfwSwapInterval(0);
|
||||||
}
|
}
|
||||||
|
bd->LastMouseCursor = nullptr; // Invalidate so that cursor is set again
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGui_ImplGlfw_DestroyWindow(ImGuiViewport* viewport)
|
static void ImGui_ImplGlfw_DestroyWindow(ImGuiViewport* viewport)
|
||||||
|
|||||||
@ -114,6 +114,8 @@ Other Changes:
|
|||||||
Docking+Viewports Branch:
|
Docking+Viewports Branch:
|
||||||
|
|
||||||
- Backends:
|
- 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]
|
- Metal: fixed resizing windows losing framebuffer scale. (#6828, #8856) [@laikoken]
|
||||||
- Examples:
|
- Examples:
|
||||||
- SDL3+Metal, GLFW+Metal: fix multi-viewport support.
|
- SDL3+Metal, GLFW+Metal: fix multi-viewport support.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user