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

@ -22,7 +22,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-12-13: *BREAKING CHANGE* Add NSView parameter to ImGui_ImplOSX_Init(). Generally fix keyboard support. Using kVK_* codes for keyboard keys.
// 2021-12-13: Add game controller support.
// 2021-09-21: Use mach_absolute_time as CFAbsoluteTimeGetCurrent can jump backwards.
@ -496,10 +496,7 @@ static void ImGui_ImplOSX_UpdateGamepads()
static void ImGui_ImplOSX_UpdateKeyModifiers()
{
ImGuiIO& io = ImGui::GetIO();
io.KeyCtrl = (g_KeyModifiers & ImGuiKeyModFlags_Ctrl) != 0;
io.KeyShift = (g_KeyModifiers & ImGuiKeyModFlags_Shift) != 0;
io.KeyAlt = (g_KeyModifiers & ImGuiKeyModFlags_Alt) != 0;
io.KeySuper = (g_KeyModifiers & ImGuiKeyModFlags_Super) != 0;
io.AddKeyModEvent(g_KeyModifiers);
}
void ImGui_ImplOSX_NewFrame(NSView* view)