fix: avoid handling keybinds after vanilla input focus

This commit is contained in:
Dean Sheather
2024-07-21 02:30:39 +10:00
parent 85c5facff7
commit 81923ddfe4
+14
View File
@@ -24,6 +24,8 @@ internal unsafe class KeybindManager : IDisposable {
internal bool DirectChat;
private long LastRefresh;
private bool VanillaTextInputHasFocus;
private readonly Dictionary<string, Keybind> Keybinds = new();
private static readonly IReadOnlyDictionary<string, ChannelSwitchInfo> KeybindsToIntercept = new Dictionary<string, ChannelSwitchInfo>
{
@@ -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);