diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-22 20:58:31 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-22 20:58:31 -0500 |
commit | dae5838696ee769f9eab528881ba8ad5da34633b (patch) | |
tree | 28f7445764ea7b7215e7d6ed2f44a6545f0e8b97 | |
parent | ddba317142b6b5cbf3efbc867d0b5bd95afcefb2 (diff) | |
download | SMAPI-dae5838696ee769f9eab528881ba8ad5da34633b.tar.gz SMAPI-dae5838696ee769f9eab528881ba8ad5da34633b.tar.bz2 SMAPI-dae5838696ee769f9eab528881ba8ad5da34633b.zip |
Revert "suppress keyboard events when a textbox is focused (#445)"
This reverts commit 033015066650d4bd67a7df0a7f7addf4c6edf617.
-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)) { |