From 81923ddfe4f282ddcb0b2de86a833691086c91c9 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Sun, 21 Jul 2024 02:30:39 +1000 Subject: [PATCH] fix: avoid handling keybinds after vanilla input focus --- ChatTwo/GameFunctions/KeybindManager.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ChatTwo/GameFunctions/KeybindManager.cs b/ChatTwo/GameFunctions/KeybindManager.cs index 5ce87f9..254bdf8 100644 --- a/ChatTwo/GameFunctions/KeybindManager.cs +++ b/ChatTwo/GameFunctions/KeybindManager.cs @@ -24,6 +24,8 @@ internal unsafe class KeybindManager : IDisposable { internal bool DirectChat; private long LastRefresh; + private bool VanillaTextInputHasFocus; + private readonly Dictionary Keybinds = new(); private static readonly IReadOnlyDictionary KeybindsToIntercept = new Dictionary { @@ -390,7 +392,19 @@ internal unsafe class KeybindManager : IDisposable { // Vanilla text input has focus if (RaptureAtkModule.Instance()->AtkModule.IsTextInputActive()) + { + VanillaTextInputHasFocus = true; return; + } + + // If the vanilla text input has just lost focus, clear all keys so we + // don't try to process them immediately. + if (VanillaTextInputHasFocus) + { + Plugin.KeyState.ClearAll(); + VanillaTextInputHasFocus = false; + return; + } var modifierState = GetModifiers(source);