1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-24 07:40:22 +01:00

Backends: OSX: Inputs: Monitor NSKeyUp events to catch missing keyUp for key when user press Cmd + key (#5128)

This commit is contained in:
thedmd 2022-03-22 18:45:27 +01:00 committed by ocornut
parent c5f67218bf
commit 3c07879504
2 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2022-03-22: Inputs: Monitor NSKeyUp events to catch missing keyUp for key when user press Cmd + key
// 2022-02-07: Inputs: Forward keyDown/keyUp events to OS when unused by dear imgui.
// 2022-01-31: Fix building with old Xcode versions that are missing gamepad features.
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
@ -429,7 +430,7 @@ bool ImGui_ImplOSX_Init(NSView* view)
// Some events do not raise callbacks of AppView in some circumstances (for example when CMD key is held down).
// This monitor taps into global event stream and captures these events.
NSEventMask eventMask = NSEventMaskFlagsChanged;
NSEventMask eventMask = NSEventMaskFromType(NSKeyUp) | NSEventMaskFlagsChanged;
[NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event)
{
ImGui_ImplOSX_HandleEvent(event, g_KeyEventResponder);

View File

@ -71,6 +71,7 @@ Other Changes:
- ImVector: Fixed erase() with empty range. (#5009) [@thedmd]
- Backends: SDL: Fixed dragging out viewport broken on some SDL setups. (#5012) [@rokups]
- Backends: SDL: Added support for extra mouse buttons (SDL_BUTTON_X1/SDL_BUTTON_X2). (#5125) [@sgiurgiu]
- Backends: OSX: Monitor NSKeyUp events to catch missing keyUp for key when user press Cmd + key (#5128) [@thedmd]
- Examples: Emscripten: Fix building for latest Emscripten specs. (#3632)