[Ryujinx.Headless.SDL2] Address dotnet-format issues (#5379)

* 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
This commit is contained in:
TSRBerry 2023-06-28 19:03:27 +02:00 committed by GitHub
parent 981e0c082d
commit 40daca5684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 218 additions and 208 deletions

View file

@ -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;
}
}
}
}