mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-06-28 12:30:47 -07:00
Add hide-cursor command line argument & always hide cursor option (#4613)
* Add hide-cursor command line argument * gtk: Adjust SettingsWindow for hide cursor options * ava: Adjust SettingsWindow for hide cursor options * ava: Add override check for HideCursor arg * Remove copy&paste sins * ava: Leave a little more room between the options * gtk: Fix hide cursor issues * ava: Only hide cursor if it's within the embedded window
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
public enum HideCursor
|
||||
{
|
||||
Never,
|
||||
OnIdle,
|
||||
Always
|
||||
}
|
||||
}
|
@ -107,8 +107,8 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
GraphicsDebugLevel glLogLevel,
|
||||
AspectRatio aspectRatio,
|
||||
bool enableMouse,
|
||||
HideCursor hideCursor)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursor)
|
||||
HideCursorMode hideCursorMode)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode)
|
||||
{
|
||||
_glLogLevel = glLogLevel;
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ namespace Ryujinx.Headless.SDL2
|
||||
[Option("enable-mouse", Required = false, Default = false, HelpText = "Enable or disable mouse support.")]
|
||||
public bool EnableMouse { get; set; }
|
||||
|
||||
[Option("hide-cursor", Required = false, Default = HideCursor.OnIdle, HelpText = "Change when the cursor gets hidden.")]
|
||||
public HideCursor HideCursor { get; set; }
|
||||
[Option("hide-cursor", Required = false, Default = HideCursorMode.OnIdle, HelpText = "Change when the cursor gets hidden.")]
|
||||
public HideCursorMode HideCursorMode { get; set; }
|
||||
|
||||
[Option("list-input-profiles", Required = false, HelpText = "List inputs profiles.")]
|
||||
public bool ListInputProfiles { get; set; }
|
||||
|
@ -478,8 +478,8 @@ namespace Ryujinx.Headless.SDL2
|
||||
private static WindowBase CreateWindow(Options options)
|
||||
{
|
||||
return options.GraphicsBackend == GraphicsBackend.Vulkan
|
||||
? new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursor)
|
||||
: new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursor);
|
||||
? new VulkanWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode)
|
||||
: new OpenGLWindow(_inputManager, options.LoggingGraphicsDebugLevel, options.AspectRatio, options.EnableMouse, options.HideCursorMode);
|
||||
}
|
||||
|
||||
private static IRenderer CreateRenderer(Options options, WindowBase window)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Ryujinx.Input;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Input;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
@ -13,7 +14,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
private const int CursorHideIdleTime = 5; // seconds
|
||||
|
||||
private bool _isDisposed;
|
||||
private HideCursor _hideCursor;
|
||||
private HideCursorMode _hideCursorMode;
|
||||
private bool _isHidden;
|
||||
private long _lastCursorMoveTime;
|
||||
|
||||
@ -23,12 +24,12 @@ namespace Ryujinx.Headless.SDL2
|
||||
public Vector2 Scroll { get; private set; }
|
||||
public Size _clientSize;
|
||||
|
||||
public SDL2MouseDriver(HideCursor hideCursor)
|
||||
public SDL2MouseDriver(HideCursorMode hideCursorMode)
|
||||
{
|
||||
PressedButtons = new bool[(int)MouseButton.Count];
|
||||
_hideCursor = hideCursor;
|
||||
_hideCursorMode = hideCursorMode;
|
||||
|
||||
if (_hideCursor == HideCursor.Always)
|
||||
if (_hideCursorMode == HideCursorMode.Always)
|
||||
{
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
_isHidden = true;
|
||||
@ -59,7 +60,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
private void CheckIdle()
|
||||
{
|
||||
if (_hideCursor != HideCursor.OnIdle)
|
||||
if (_hideCursorMode != HideCursorMode.OnIdle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ namespace Ryujinx.Headless.SDL2.Vulkan
|
||||
GraphicsDebugLevel glLogLevel,
|
||||
AspectRatio aspectRatio,
|
||||
bool enableMouse,
|
||||
HideCursor hideCursor)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursor)
|
||||
HideCursorMode hideCursorMode)
|
||||
: base(inputManager, glLogLevel, aspectRatio, enableMouse, hideCursorMode)
|
||||
{
|
||||
_glLogLevel = glLogLevel;
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ namespace Ryujinx.Headless.SDL2
|
||||
GraphicsDebugLevel glLogLevel,
|
||||
AspectRatio aspectRatio,
|
||||
bool enableMouse,
|
||||
HideCursor hideCursor)
|
||||
HideCursorMode hideCursorMode)
|
||||
{
|
||||
MouseDriver = new SDL2MouseDriver(hideCursor);
|
||||
MouseDriver = new SDL2MouseDriver(hideCursorMode);
|
||||
_inputManager = inputManager;
|
||||
_inputManager.SetMouseDriver(MouseDriver);
|
||||
NpadManager = _inputManager.CreateNpadManager();
|
||||
|
Reference in New Issue
Block a user