UI: Some Avalonia cleanup (#3358)

This commit is contained in:
Ac_K 2022-06-23 20:59:02 +02:00 committed by GitHub
parent f2a41b7a1c
commit 8aff17a93c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1119 additions and 716 deletions

View file

@ -57,7 +57,7 @@ namespace Ryujinx.Ava
private static readonly Cursor InvisibleCursor = new Cursor(StandardCursorType.None);
private readonly AccountManager _accountManager;
private UserChannelPersistence _userChannelPersistence;
private readonly UserChannelPersistence _userChannelPersistence;
private readonly InputManager _inputManager;
@ -82,7 +82,6 @@ namespace Ryujinx.Ava
private bool _dialogShown;
private WindowsMultimediaTimerResolution _windowsMultimediaTimerResolution;
private KeyboardStateSnapshot _lastKeyboardSnapshot;
private readonly CancellationTokenSource _gpuCancellationTokenSource;
@ -126,7 +125,6 @@ namespace Ryujinx.Ava
_glLogLevel = ConfigurationState.Instance.Logger.GraphicsDebugLevel;
_inputManager.SetMouseDriver(new AvaloniaMouseDriver(renderer));
_keyboardInterface = (IKeyboard)_inputManager.KeyboardDriver.GetGamepad("0");
_lastKeyboardSnapshot = _keyboardInterface.GetKeyboardStateSnapshot();
NpadManager = _inputManager.CreateNpadManager();
TouchScreenManager = _inputManager.CreateTouchScreenManager();
@ -722,9 +720,7 @@ namespace Ryujinx.Ava
}
}
var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam.Value
? HLE.MemoryConfiguration.MemoryConfiguration6GB
: HLE.MemoryConfiguration.MemoryConfiguration4GB;
var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam.Value ? HLE.MemoryConfiguration.MemoryConfiguration6GB : HLE.MemoryConfiguration.MemoryConfiguration4GB;
IntegrityCheckLevel fsIntegrityCheckLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None;
@ -898,7 +894,7 @@ namespace Ryujinx.Ava
}
}
private void HandleScreenState(KeyboardStateSnapshot keyboard, KeyboardStateSnapshot lastKeyboard)
private void HandleScreenState()
{
if (ConfigurationState.Instance.Hid.EnableMouse)
{
@ -935,19 +931,12 @@ namespace Ryujinx.Ava
{
Dispatcher.UIThread.Post(() =>
{
KeyboardStateSnapshot keyboard = _keyboardInterface.GetKeyboardStateSnapshot();
HandleScreenState();
HandleScreenState(keyboard, _lastKeyboardSnapshot);
if (keyboard.IsPressed(Key.Delete))
if (_keyboardInterface.GetKeyboardStateSnapshot().IsPressed(Key.Delete) && _parent.WindowState != WindowState.FullScreen)
{
if (_parent.WindowState != WindowState.FullScreen)
{
Ptc.Continue();
}
Ptc.Continue();
}
_lastKeyboardSnapshot = keyboard;
});
}