Added io.AddKeyModEvent() and updated backends accordingly. (#2625, #4858)

This commit is contained in:
ocornut
2022-01-10 12:39:01 +01:00
parent 1797135db5
commit 790132a672
9 changed files with 52 additions and 39 deletions

View File

@@ -19,7 +19,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2022-01-10: Inputs: calling new io.AddKeyEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
// 2021-03-04: Initial version.
#include "imgui.h"
@@ -292,11 +292,7 @@ void ImGui_ImplAndroid_NewFrame()
io.SetKeyEventNativeData(key_event.Key, key_event.NativeKeycode, key_event.NativeScancode); // To support legacy indexing (<1.87 user code)
key_queue.second.pop();
}
io.KeyCtrl = ((g_KeyModFlags & ImGuiKeyModFlags_Ctrl) != 0);
io.KeyShift = ((g_KeyModFlags & ImGuiKeyModFlags_Shift) != 0);
io.KeyAlt = ((g_KeyModFlags & ImGuiKeyModFlags_Alt) != 0);
io.KeySuper = ((g_KeyModFlags & ImGuiKeyModFlags_Super) != 0);
io.AddKeyModEvent(g_KeyModFlags);
// Setup display size (every frame to accommodate for window resizing)
int32_t window_width = ANativeWindow_getWidth(g_Window);