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 /src/SMAPI | |
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.
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Framework/SGame.cs | 22 |
1 files changed, 9 insertions, 13 deletions
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)) { |