Skip to content

Commit

Permalink
Fix cursor shape getting stuck when switching from imgui
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jan 20, 2025
1 parent 33fbc17 commit 0d21d37
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Windows/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,18 @@ namespace MainWindow
case WM_SETCURSOR:
if ((lParam & 0xFFFF) == HTCLIENT && g_Config.bShowImDebugger) {
LPTSTR win32_cursor = 0;
switch (ImGui_ImplPlatform_GetCursor()) {
case ImGuiMouseCursor_Arrow: win32_cursor = IDC_ARROW; break;
case ImGuiMouseCursor_TextInput: win32_cursor = IDC_IBEAM; break;
case ImGuiMouseCursor_ResizeAll: win32_cursor = IDC_SIZEALL; break;
case ImGuiMouseCursor_ResizeEW: win32_cursor = IDC_SIZEWE; break;
case ImGuiMouseCursor_ResizeNS: win32_cursor = IDC_SIZENS; break;
case ImGuiMouseCursor_ResizeNESW: win32_cursor = IDC_SIZENESW; break;
case ImGuiMouseCursor_ResizeNWSE: win32_cursor = IDC_SIZENWSE; break;
case ImGuiMouseCursor_Hand: win32_cursor = IDC_HAND; break;
case ImGuiMouseCursor_NotAllowed: win32_cursor = IDC_NO; break;
if (g_Config.bShowImDebugger) {
switch (ImGui_ImplPlatform_GetCursor()) {
case ImGuiMouseCursor_Arrow: win32_cursor = IDC_ARROW; break;
case ImGuiMouseCursor_TextInput: win32_cursor = IDC_IBEAM; break;
case ImGuiMouseCursor_ResizeAll: win32_cursor = IDC_SIZEALL; break;
case ImGuiMouseCursor_ResizeEW: win32_cursor = IDC_SIZEWE; break;
case ImGuiMouseCursor_ResizeNS: win32_cursor = IDC_SIZENS; break;
case ImGuiMouseCursor_ResizeNESW: win32_cursor = IDC_SIZENESW; break;
case ImGuiMouseCursor_ResizeNWSE: win32_cursor = IDC_SIZENWSE; break;
case ImGuiMouseCursor_Hand: win32_cursor = IDC_HAND; break;
case ImGuiMouseCursor_NotAllowed: win32_cursor = IDC_NO; break;
}
}
if (win32_cursor) {
SetCursor(::LoadCursor(nullptr, win32_cursor));
Expand Down

0 comments on commit 0d21d37

Please sign in to comment.