From 100b9e3bca294cca5d8a380e75f7ba9586454518 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 4 Jun 2023 12:12:15 +0200 Subject: [PATCH] fix: Cursor icons on Windows not working correctly after imgui update --- lib/external/imgui/source/imgui_impl_glfw.cpp | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/external/imgui/source/imgui_impl_glfw.cpp b/lib/external/imgui/source/imgui_impl_glfw.cpp index 9964cdbac..e0037a059 100644 --- a/lib/external/imgui/source/imgui_impl_glfw.cpp +++ b/lib/external/imgui/source/imgui_impl_glfw.cpp @@ -822,8 +822,41 @@ 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. - glfwSetCursor(window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]); + + // IMHEX PATCH BEGIN + #if defined(_WIN32) + switch (imgui_cursor) { + case ImGuiMouseCursor_Hand: + SetCursor(LoadCursor(nullptr, IDC_HAND)); + break; + case ImGuiMouseCursor_ResizeEW: + SetCursor(LoadCursor(nullptr, IDC_SIZEWE)); + break; + case ImGuiMouseCursor_ResizeNS: + SetCursor(LoadCursor(nullptr, IDC_SIZENS)); + break; + case ImGuiMouseCursor_ResizeNWSE: + SetCursor(LoadCursor(nullptr, IDC_SIZENWSE)); + break; + case ImGuiMouseCursor_ResizeNESW: + SetCursor(LoadCursor(nullptr, IDC_SIZENESW)); + break; + case ImGuiMouseCursor_ResizeAll: + SetCursor(LoadCursor(nullptr, IDC_SIZEALL)); + break; + case ImGuiMouseCursor_NotAllowed: + SetCursor(LoadCursor(nullptr, IDC_NO)); + break; + case ImGuiMouseCursor_TextInput: + SetCursor(LoadCursor(nullptr, IDC_IBEAM)); + break; + } + #else + glfwSetCursor(window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]); + #endif + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); + // IMHEX PATCH END } } }