From b7d1f7f86ea1f6440a11dbc90cbbede20e199252 Mon Sep 17 00:00:00 2001 From: Tim Kane Date: Fri, 15 Mar 2024 00:12:08 +1100 Subject: [PATCH] Additional cruft removal and inadvertent copy/paste errors --- backends/imgui_impl_osx.mm | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/backends/imgui_impl_osx.mm b/backends/imgui_impl_osx.mm index e73948959..a7df57413 100644 --- a/backends/imgui_impl_osx.mm +++ b/backends/imgui_impl_osx.mm @@ -741,7 +741,6 @@ static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view) mousePoint = NSMakePoint(mousePoint.x, view.bounds.size.height - mousePoint.y); io.AddMouseSourceEvent(GetMouseSource(event)); io.AddMousePosEvent((float)mousePoint.x, (float)mousePoint.y); - return io.WantCaptureMouse; } @@ -760,9 +759,7 @@ static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view) // scrollingDeltaY. When these are added to the current x and y positions of the scrolling view, // it appears to jump up or down. It can be observed in Preview, various JetBrains IDEs and here. if (event.phase == NSEventPhaseCancelled) - { return false; - } double wheel_dx = 0.0; double wheel_dy = 0.0; @@ -793,16 +790,14 @@ static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view) if (event.type == NSEventTypeKeyDown || event.type == NSEventTypeKeyUp) { if ([event isARepeat]) - { - return io.WantCaptureMouse; - } + return io.WantCaptureKeyboard; int key_code = (int)[event keyCode]; ImGuiKey key = ImGui_ImplOSX_KeyCodeToImGuiKey(key_code); io.AddKeyEvent(key, event.type == NSEventTypeKeyDown); io.SetKeyEventNativeData(key, key_code, -1); // To support legacy indexing (<1.87 user code) - return io.WantCaptureMouse; + return io.WantCaptureKeyboard; } if (event.type == NSEventTypeFlagsChanged) @@ -833,16 +828,13 @@ static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view) case ImGuiKey_LeftAlt: mask = 0x0020; break; case ImGuiKey_RightAlt: mask = 0x0040; break; default: - { - [ImGui_IO_lock unlock]; - return io.WantCaptureMouse; - } + return io.WantCaptureKeyboard; } io.AddKeyEvent(key, (modifier_flags & mask) != 0); io.SetKeyEventNativeData(key, key_code, -1); // To support legacy indexing (<1.87 user code) } - return io.WantCaptureMouse; + return io.WantCaptureKeyboard; } return false;