mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-04 11:29:14 +00:00
Fix AltGr key assignment and silence keyboard SetLed logs
This commit is contained in:
@@ -82,8 +82,8 @@
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Ctrl Left",
|
||||
"es_ES": "Alt Gr",
|
||||
"fr_FR": "Alt Gr",
|
||||
"es_ES": "Ctrl Izquierdo",
|
||||
"fr_FR": "Ctrl Gauche",
|
||||
"he_IL": "",
|
||||
"it_IT": "Ctrl sinistro",
|
||||
"ja_JP": "",
|
||||
@@ -232,8 +232,8 @@
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Alt Right",
|
||||
"es_ES": "Alt Derecho",
|
||||
"fr_FR": "Alt Droite",
|
||||
"es_ES": "Alt Gr",
|
||||
"fr_FR": "Alt Gr",
|
||||
"he_IL": "",
|
||||
"it_IT": "Alt destro",
|
||||
"ja_JP": "",
|
||||
|
||||
@@ -33,6 +33,13 @@ namespace Ryujinx.Input.Assigner
|
||||
|
||||
public Button? GetPressedButton()
|
||||
{
|
||||
// On some layouts (for example AltGr on Windows), Right Alt is reported as Ctrl+Alt.
|
||||
// Prefer AltRight in that case so the binding reflects the physical key used.
|
||||
if (_keyboardState.IsPressed(Key.ControlLeft) && _keyboardState.IsPressed(Key.AltRight))
|
||||
{
|
||||
return !ShouldCancel() ? new Button(Key.AltRight) : null;
|
||||
}
|
||||
|
||||
Button? keyPressed = null;
|
||||
|
||||
for (Key key = Key.Unknown; key < Key.Count; key++)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -146,7 +145,7 @@ namespace Ryujinx.Ava.Input
|
||||
|
||||
public void SetLed(uint packedRgb)
|
||||
{
|
||||
Logger.Info?.Print(LogClass.UI, "SetLed called on an AvaloniaKeyboard");
|
||||
// Keyboard LED is not supported by this backend.
|
||||
}
|
||||
|
||||
public void SetTriggerThreshold(float triggerThreshold) { }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Threading;
|
||||
using Ryujinx.Ava.Input;
|
||||
using Ryujinx.Input;
|
||||
using Ryujinx.Input.Assigner;
|
||||
using System;
|
||||
@@ -25,6 +26,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
|
||||
private bool _isWaitingForInput;
|
||||
private bool _shouldUnbind;
|
||||
private IKeyboard _keyboard;
|
||||
public event EventHandler<ButtonAssignedEventArgs> ButtonAssigned;
|
||||
|
||||
public ButtonKeyAssigner(ToggleButton toggleButton)
|
||||
@@ -34,6 +36,9 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
|
||||
public async void GetInputAndAssign(IButtonAssigner assigner, IKeyboard keyboard = null)
|
||||
{
|
||||
_keyboard = keyboard;
|
||||
ClearKeyboardState(_keyboard);
|
||||
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
ToggledButton.IsChecked = true;
|
||||
@@ -82,6 +87,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
_isWaitingForInput = false;
|
||||
|
||||
ToggledButton.IsChecked = false;
|
||||
ClearKeyboardState(_keyboard);
|
||||
|
||||
if (pressedButton.HasValue && pressedButton.Value.AsHidType<Key>() == Key.BackSpace)
|
||||
{
|
||||
@@ -98,6 +104,15 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
_isWaitingForInput = false;
|
||||
ToggledButton.IsChecked = false;
|
||||
_shouldUnbind = shouldUnbind;
|
||||
ClearKeyboardState(_keyboard);
|
||||
}
|
||||
|
||||
private static void ClearKeyboardState(IKeyboard keyboard)
|
||||
{
|
||||
if (keyboard is AvaloniaKeyboard avaloniaKeyboard)
|
||||
{
|
||||
avaloniaKeyboard.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user