Skip to content

Commit

Permalink
Backends: OSX: Forward keyDown/keyUp events to OS when unused by Dear…
Browse files Browse the repository at this point in the history
… ImGui.
  • Loading branch information
ocornut committed Feb 7, 2022
1 parent c6cab1f commit 2554b51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backends/imgui_impl_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 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.
// 2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
Expand Down Expand Up @@ -131,15 +132,17 @@ - (void)viewDidMoveToWindow

- (void)keyDown:(NSEvent*)event
{
ImGui_ImplOSX_HandleEvent(event, self);
if (!ImGui_ImplOSX_HandleEvent(event, self))
[super keyDown:event];

// Call to the macOS input manager system.
[self interpretKeyEvents:@[event]];
}

- (void)keyUp:(NSEvent*)event
{
ImGui_ImplOSX_HandleEvent(event, self);
if (!ImGui_ImplOSX_HandleEvent(event, self))
[super keyUp:event];
}

- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Other Changes:
- Backends: OSX: Added basic Platform IME support. (#3108, #2598) [@liuliu]
- Backends: OSX: Fix Game Controller nav mapping to use shoulder for both focusing and tweak speed. (#4759)
- Backends: OSX: Fix building with old Xcode versions that are missing gamepad features. [@rokups]
- Backends: OSX: Forward keyDown/keyUp events to OS when unused by Dear ImGui.
- Backends: Android, GLUT: Submit keys using io.AddKeyEvent(). Submit keymods using io.AddKeyModsEvent() at the same time. (#2625)
- Backends: Android, GLUT: Submit mouse data using io.AddMousePosEvent(), AddMouseButtonEvent(), AddMouseWheelEvent() functions. (#4858)
- Backends: OpenGL3: Fixed a buffer overflow in imgui_impl_opengl3_loader.h init (added in 1.86). (#4468, #4830) [@dymk]
Expand Down

0 comments on commit 2554b51

Please sign in to comment.