1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-13 00:24:20 +00:00

Additional cruft removal and inadvertent copy/paste errors

This commit is contained in:
Tim Kane 2024-03-15 00:12:08 +11:00
parent 5d621088a6
commit b7d1f7f86e

View file

@ -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;