mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-04 19:39:15 +00:00
Refresh keyboard labels when layout changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Svg.Skia;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
@@ -293,6 +294,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
AvaloniaKeyboardDriver keyboardDriver = new(owner, KeyboardInputMode.Physical);
|
||||
keyboardDriver.KeyPressed += PhysicalKeyLabelHelper.ObserveKeyPress;
|
||||
AvaloniaKeyboardDriver = keyboardDriver;
|
||||
PhysicalKeyLabelHelper.LabelsChanged += OnPhysicalKeyLabelsChanged;
|
||||
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadConnected += HandleOnGamepadConnected;
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadDisconnected += HandleOnGamepadDisconnected;
|
||||
@@ -1062,9 +1064,18 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
NotifyChangesEvent?.Invoke();
|
||||
}
|
||||
|
||||
private void OnPhysicalKeyLabelsChanged()
|
||||
{
|
||||
if (ConfigViewModel is KeyboardInputViewModel keyboardInputViewModel)
|
||||
{
|
||||
Dispatcher.UIThread.Post(keyboardInputViewModel.Config.NotifyKeyLabelsChanged);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
PhysicalKeyLabelHelper.LabelsChanged -= OnPhysicalKeyLabelsChanged;
|
||||
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadConnected -= HandleOnGamepadConnected;
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadDisconnected -= HandleOnGamepadDisconnected;
|
||||
|
||||
Reference in New Issue
Block a user