Backends: OSX: Build fIx. Made GetKeyName() input tolerant. Internals: added GetNavInputName().

This commit is contained in:
ocornut
2022-01-11 16:13:38 +01:00
parent e8172fdfbc
commit 956e03009a
4 changed files with 19 additions and 4 deletions

View File

@ -603,9 +603,10 @@ bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
if ([event isARepeat])
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, (int)[event keyCode], -1); // To support legacy indexing (<1.87 user code)
io.SetKeyEventNativeData(key, key_code, -1); // To support legacy indexing (<1.87 user code)
return io.WantCaptureKeyboard;
}