Disable keyboard controller input while swkbd is open (foreground) (second attempt) (#6808)
* Block input updates while swkbd is open in foreground mode * Flush internal driver state before unblocking input updates * Rename Flush to Clear and remove unnecessary attribute * Clear the driver state only if the GamepadDriver isn't null
This commit is contained in:
parent
4d84df9487
commit
8f51938e2b
@ -81,6 +81,11 @@ namespace Ryujinx.Input.GTK3
|
||||
return _pressedKeys.Contains(nativeKey);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_pressedKeys.Clear();
|
||||
}
|
||||
|
||||
public IGamepad GetGamepad(string id)
|
||||
{
|
||||
if (!_keyboardIdentifers[0].Equals(id))
|
||||
|
@ -107,6 +107,8 @@ namespace Ryujinx.UI.Applet
|
||||
swkbdDialog.SetInputLengthValidation(args.StringLengthMin, args.StringLengthMax);
|
||||
swkbdDialog.SetInputValidation(args.KeyboardMode);
|
||||
|
||||
((MainWindow)_parent).RendererWidget.NpadManager.BlockInputUpdates();
|
||||
|
||||
if (swkbdDialog.Run() == (int)ResponseType.Ok)
|
||||
{
|
||||
inputText = swkbdDialog.InputEntry.Text;
|
||||
@ -128,6 +130,7 @@ namespace Ryujinx.UI.Applet
|
||||
});
|
||||
|
||||
dialogCloseEvent.WaitOne();
|
||||
((MainWindow)_parent).RendererWidget.NpadManager.UnblockInputUpdates();
|
||||
|
||||
userText = error ? null : inputText;
|
||||
|
||||
|
@ -174,6 +174,11 @@ namespace Ryujinx.Input.HLE
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (InputConfig inputConfig in _inputConfig)
|
||||
{
|
||||
_controllers[(int)inputConfig.PlayerIndex].GamepadDriver?.Clear();
|
||||
}
|
||||
|
||||
_blockInputUpdates = false;
|
||||
}
|
||||
}
|
||||
|
@ -33,5 +33,11 @@ namespace Ryujinx.Input
|
||||
/// <param name="id">The unique id of the gamepad</param>
|
||||
/// <returns>An instance of <see cref="IGamepad"/> associated to the gamepad id given or null if not found</returns>
|
||||
IGamepad GetGamepad(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Clear the internal state of the driver.
|
||||
/// </summary>
|
||||
/// <remarks>Does nothing by default.</remarks>
|
||||
void Clear() { }
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ namespace Ryujinx.Ava.Input
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_driver?.ResetKeys();
|
||||
_driver?.Clear();
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
|
@ -94,7 +94,7 @@ namespace Ryujinx.Ava.Input
|
||||
return _pressedKeys.Contains(nativeKey);
|
||||
}
|
||||
|
||||
public void ResetKeys()
|
||||
public void Clear()
|
||||
{
|
||||
_pressedKeys.Clear();
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ namespace Ryujinx.Ava.UI.Applet
|
||||
{
|
||||
try
|
||||
{
|
||||
_parent.ViewModel.AppHost.NpadManager.BlockInputUpdates();
|
||||
var response = await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.SoftwareKeyboard], args);
|
||||
|
||||
if (response.Result == UserResult.Ok)
|
||||
@ -143,6 +144,7 @@ namespace Ryujinx.Ava.UI.Applet
|
||||
});
|
||||
|
||||
dialogCloseEvent.WaitOne();
|
||||
_parent.ViewModel.AppHost.NpadManager.UnblockInputUpdates();
|
||||
|
||||
userText = error ? null : inputText;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user