diff options
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI/Framework/SGame.cs | 22 |
2 files changed, 9 insertions, 14 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index b5d6e32a..8907c8af 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -15,7 +15,6 @@ * Fixed deadlock in rare cases when injecting a file with an asset loader. * Fixed unhelpful error when a mod exposes a non-public API. * Fixed unhelpful error when a translation file has duplicate keys due to case-insensitivity. - * Fixed input events being raised for keyboard buttons when a textbox is receiving input. * Fixed some JSON field names being case-sensitive. * Fixed `helper.ReadJsonFile` and `helper.WriteJsonFile` not normalising path separators. diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 73c87118..2d3bad55 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -258,7 +258,7 @@ namespace StardewModdingAPI.Framework this.Monitor.Log("Context: before save creation.", LogLevel.Trace); SaveEvents.InvokeBeforeCreate(this.Monitor); } - + // raise before-save if (Context.IsWorldReady && !this.IsBetweenSaveEvents) { @@ -387,23 +387,20 @@ namespace StardewModdingAPI.Framework } // raise input events - bool isTextboxReceiving = Game1.keyboardDispatcher?.Subscriber?.Selected == true; foreach (var pair in inputState.ActiveButtons) { SButton button = pair.Key; InputStatus status = pair.Value; - bool isKeyboard = button.TryGetKeyboard(out Keys keyboardKey); if (status == InputStatus.Pressed) { - if (!isTextboxReceiving || !isKeyboard) - InputEvents.InvokeButtonPressed(this.Monitor, button, cursor, button.IsActionButton(), button.IsUseToolButton()); + InputEvents.InvokeButtonPressed(this.Monitor, button, cursor, button.IsActionButton(), button.IsUseToolButton()); // legacy events - if (isKeyboard) + if (button.TryGetKeyboard(out Keys key)) { - if (!isTextboxReceiving && keyboardKey != Keys.None) - ControlEvents.InvokeKeyPressed(this.Monitor, keyboardKey); + if (key != Keys.None) + ControlEvents.InvokeKeyPressed(this.Monitor, key); } else if (button.TryGetController(out Buttons controllerButton)) { @@ -415,14 +412,13 @@ namespace StardewModdingAPI.Framework } else if (status == InputStatus.Released) { - if (!isTextboxReceiving || !isKeyboard) - InputEvents.InvokeButtonReleased(this.Monitor, button, cursor, button.IsActionButton(), button.IsUseToolButton()); + InputEvents.InvokeButtonReleased(this.Monitor, button, cursor, button.IsActionButton(), button.IsUseToolButton()); // legacy events - if (isKeyboard) + if (button.TryGetKeyboard(out Keys key)) { - if (!isTextboxReceiving && keyboardKey != Keys.None) - ControlEvents.InvokeKeyReleased(this.Monitor, keyboardKey); + if (key != Keys.None) + ControlEvents.InvokeKeyReleased(this.Monitor, key); } else if (button.TryGetController(out Buttons controllerButton)) { |