From 32a1cd83fd2e98d6f6da0b6c0b43c3af1323fca4 Mon Sep 17 00:00:00 2001 From: merry Date: Sun, 22 Jan 2023 10:21:52 +0000 Subject: [PATCH] AvaloniaKeyboardDriver: Swallow TextInput events to avoid bell (#4320) --- Ryujinx.Ava/Input/AvaloniaKeyboardDriver.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Ryujinx.Ava/Input/AvaloniaKeyboardDriver.cs b/Ryujinx.Ava/Input/AvaloniaKeyboardDriver.cs index b107898e..edcdb52f 100644 --- a/Ryujinx.Ava/Input/AvaloniaKeyboardDriver.cs +++ b/Ryujinx.Ava/Input/AvaloniaKeyboardDriver.cs @@ -1,5 +1,6 @@ using Avalonia.Controls; using Avalonia.Input; +using Avalonia.Interactivity; using Ryujinx.Ava.Common.Locale; using Ryujinx.Input; using System; @@ -30,6 +31,7 @@ namespace Ryujinx.Ava.Input _control.KeyDown += OnKeyPress; _control.KeyUp += OnKeyRelease; _control.TextInput += Control_TextInput; + _control.AddHandler(InputElement.TextInputEvent, Control_LastChanceTextInput, RoutingStrategies.Bubble); } private void Control_TextInput(object sender, TextInputEventArgs e) @@ -37,6 +39,12 @@ namespace Ryujinx.Ava.Input TextInput?.Invoke(this, e.Text); } + private void Control_LastChanceTextInput(object sender, TextInputEventArgs e) + { + // Swallow event + e.Handled = true; + } + public event Action OnGamepadConnected { add { }