diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-06-28 19:03:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 19:03:27 +0200 |
commit | 40daca5684afdc8a62dfcb1beb27c58b5262c9e7 (patch) | |
tree | 0b4fc882c96771a5a7b4efa54085cf3dd5c15b42 /src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs | |
parent | 981e0c082d8b55e65b7bd9ef07c92ed761b88ab7 (diff) |
[Ryujinx.Headless.SDL2] Address dotnet-format issues (#5379)1.1.939
* 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
* Address or silence dotnet format CA1806 and a few CA1854 warnings
* Address most dotnet format whitespace warnings
* Apply dotnet format whitespace formatting
A few of them have been manually reverted and the corresponding warning was silenced
* 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
* First dotnet format pass
* Add trailing commas
* Fix naming and formatting issues
Diffstat (limited to 'src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs')
-rw-r--r-- | src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs b/src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs index 7b88e265..8983091f 100644 --- a/src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs +++ b/src/Ryujinx.Headless.SDL2/SDL2MouseDriver.cs @@ -1,4 +1,5 @@ -using Ryujinx.Common.Configuration; +using Ryujinx.Common.Configuration; +using Ryujinx.Common.Logging; using Ryujinx.Input; using System; using System.Diagnostics; @@ -14,7 +15,7 @@ namespace Ryujinx.Headless.SDL2 private const int CursorHideIdleTime = 5; // seconds private bool _isDisposed; - private HideCursorMode _hideCursorMode; + private readonly HideCursorMode _hideCursorMode; private bool _isHidden; private long _lastCursorMoveTime; @@ -22,7 +23,7 @@ namespace Ryujinx.Headless.SDL2 public Vector2 CurrentPosition { get; private set; } public Vector2 Scroll { get; private set; } - public Size _clientSize; + public Size ClientSize; public SDL2MouseDriver(HideCursorMode hideCursorMode) { @@ -31,7 +32,11 @@ namespace Ryujinx.Headless.SDL2 if (_hideCursorMode == HideCursorMode.Always) { - SDL_ShowCursor(SDL_DISABLE); + if (SDL_ShowCursor(SDL_DISABLE) != SDL_DISABLE) + { + Logger.Error?.PrintMsg(LogClass.Application, "Failed to disable the cursor."); + } + _isHidden = true; } } @@ -46,7 +51,7 @@ namespace Ryujinx.Headless.SDL2 public void UpdatePosition() { - SDL_GetMouseState(out int posX, out int posY); + _ = SDL_GetMouseState(out int posX, out int posY); Vector2 position = new(posX, posY); if (CurrentPosition != position) @@ -71,7 +76,11 @@ namespace Ryujinx.Headless.SDL2 { if (!_isHidden) { - SDL_ShowCursor(SDL_DISABLE); + if (SDL_ShowCursor(SDL_DISABLE) != SDL_DISABLE) + { + Logger.Error?.PrintMsg(LogClass.Application, "Failed to disable the cursor."); + } + _isHidden = true; } } @@ -79,7 +88,11 @@ namespace Ryujinx.Headless.SDL2 { if (_isHidden) { - SDL_ShowCursor(SDL_ENABLE); + if (SDL_ShowCursor(SDL_ENABLE) != SDL_ENABLE) + { + Logger.Error?.PrintMsg(LogClass.Application, "Failed to enable the cursor."); + } + _isHidden = false; } } @@ -118,7 +131,7 @@ namespace Ryujinx.Headless.SDL2 public void SetClientSize(int width, int height) { - _clientSize = new Size(width, height); + ClientSize = new Size(width, height); } public bool IsButtonPressed(MouseButton button) @@ -128,7 +141,7 @@ namespace Ryujinx.Headless.SDL2 public Size GetClientSize() { - return _clientSize; + return ClientSize; } public string DriverName => "SDL2"; @@ -162,4 +175,4 @@ namespace Ryujinx.Headless.SDL2 _isDisposed = true; } } -}
\ No newline at end of file +} |