From f04fcfe4a49af50c3a24ddf896cda4e39f4f28d0 Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Sun, 30 Jan 2022 15:50:56 -0500 Subject: [PATCH] fix: only accept modifier keybinds when input focused --- ChatTwo/Ui/ChatLog.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index d589856..e4841bc 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -176,7 +176,7 @@ internal sealed class ChatLog : IUiComponent { private unsafe ImGuiViewport* _lastViewport; - private void HandleKeybinds() { + private void HandleKeybinds(bool modifiersOnly = false) { var modifierState = (ModifierFlag) 0; if (ImGui.GetIO().KeyAlt) { modifierState |= ModifierFlag.Alt; @@ -197,7 +197,7 @@ internal sealed class ChatLog : IUiComponent { } void Intercept(VirtualKey key, ModifierFlag modifier) { - if (!ImGui.IsKeyPressed((int) key) || !modifierState.HasFlag(modifier)) { + if (!ImGui.IsKeyPressed((int) key) || !modifierState.HasFlag(modifier) || modifier == 0 && modifiersOnly) { return; } @@ -385,7 +385,7 @@ internal sealed class ChatLog : IUiComponent { } if (ImGui.IsItemActive()) { - this.HandleKeybinds(); + this.HandleKeybinds(true); } if (!this.Activate && !ImGui.IsItemActive()) {