diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-06-26 03:55:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-26 01:55:25 +0000 |
commit | 2de78a2d55a1306761788570ab192897299c55d8 (patch) | |
tree | b7b66b94ca3107689806a7981a9bf8817480eab6 /src/Ryujinx.Input.SDL2/SDL2Keyboard.cs | |
parent | b29ded1d6009dc6a82a0aefd594eda21b5c2d814 (diff) |
[Ryujinx.Input.SDL2] Address dotnet-format issues (#5385)1.1.922
* dotnet format style --severity info
Some changes were manually reverted.
* dotnet format analyzers --serverity info
Some changes have been minimally adapted.
* Restore a few unused methods and variables
* Silence dotnet format IDE0052 warnings
* Address dotnet format CA1816 warnings
* Address or silence dotnet format CA1806 and a few CA1854 warnings
* Address most dotnet format whitespace warnings
* Add comments to disabled warnings
* Simplify properties and array initialization, Use const when possible, Remove trailing commas
* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"
This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.
* dotnet format whitespace after rebase
* Add trailing commas, log errors instead of throwing and remove redundant code
Diffstat (limited to 'src/Ryujinx.Input.SDL2/SDL2Keyboard.cs')
-rw-r--r-- | src/Ryujinx.Input.SDL2/SDL2Keyboard.cs | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs index 2fe0614d..f46930a8 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs @@ -26,9 +26,11 @@ namespace Ryujinx.Input.SDL2 private readonly object _userMappingLock = new(); +#pragma warning disable IDE0052 // Remove unread private member private readonly SDL2KeyboardDriver _driver; +#pragma warning restore IDE0052 private StandardKeyboardInputConfig _configuration; - private List<ButtonMappingEntry> _buttonsUserMapping; + private readonly List<ButtonMappingEntry> _buttonsUserMapping; private static readonly SDL_Keycode[] _keysDriverMapping = new SDL_Keycode[(int)Key.Count] { @@ -208,29 +210,19 @@ namespace Ryujinx.Input.SDL2 private static SDL_Keymod GetKeyboardModifierMask(Key key) { - switch (key) + return key switch { - case Key.ShiftLeft: - return SDL_Keymod.KMOD_LSHIFT; - case Key.ShiftRight: - return SDL_Keymod.KMOD_RSHIFT; - case Key.ControlLeft: - return SDL_Keymod.KMOD_LCTRL; - case Key.ControlRight: - return SDL_Keymod.KMOD_RCTRL; - case Key.AltLeft: - return SDL_Keymod.KMOD_LALT; - case Key.AltRight: - return SDL_Keymod.KMOD_RALT; - case Key.WinLeft: - return SDL_Keymod.KMOD_LGUI; - case Key.WinRight: - return SDL_Keymod.KMOD_RGUI; + Key.ShiftLeft => SDL_Keymod.KMOD_LSHIFT, + Key.ShiftRight => SDL_Keymod.KMOD_RSHIFT, + Key.ControlLeft => SDL_Keymod.KMOD_LCTRL, + Key.ControlRight => SDL_Keymod.KMOD_RCTRL, + Key.AltLeft => SDL_Keymod.KMOD_LALT, + Key.AltRight => SDL_Keymod.KMOD_RALT, + Key.WinLeft => SDL_Keymod.KMOD_LGUI, + Key.WinRight => SDL_Keymod.KMOD_RGUI, // NOTE: Menu key isn't supported by SDL2. - case Key.Menu: - default: - return SDL_Keymod.KMOD_NONE; - } + _ => SDL_Keymod.KMOD_NONE, + }; } public KeyboardStateSnapshot GetKeyboardStateSnapshot() @@ -416,4 +408,4 @@ namespace Ryujinx.Input.SDL2 return Vector3.Zero; } } -}
\ No newline at end of file +} |