SDL: Move Mouse to the Input project instead of Headless.

This commit is contained in:
Evan Husted 2024-10-14 15:03:36 -05:00
parent b2a35ecf6c
commit 4ee1dff497
4 changed files with 7 additions and 8 deletions

View file

@ -10,6 +10,7 @@ using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationPr
using Ryujinx.HLE.UI; using Ryujinx.HLE.UI;
using Ryujinx.Input; using Ryujinx.Input;
using Ryujinx.Input.HLE; using Ryujinx.Input.HLE;
using Ryujinx.Input.SDL2;
using Ryujinx.SDL2.Common; using Ryujinx.SDL2.Common;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;

View file

@ -1,12 +1,11 @@
using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Input;
using System; using System;
using System.Drawing; using System.Drawing;
using System.Numerics; using System.Numerics;
namespace Ryujinx.Headless.SDL2 namespace Ryujinx.Input.SDL2
{ {
class SDL2Mouse : IMouse public class SDL2Mouse : IMouse
{ {
private SDL2MouseDriver _driver; private SDL2MouseDriver _driver;

View file

@ -1,6 +1,5 @@
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Input;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
@ -8,9 +7,9 @@ using System.Numerics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using static SDL2.SDL; using static SDL2.SDL;
namespace Ryujinx.Headless.SDL2 namespace Ryujinx.Input.SDL2
{ {
class SDL2MouseDriver : IGamepadDriver public class SDL2MouseDriver : IGamepadDriver
{ {
private const int CursorHideIdleTime = 5; // seconds private const int CursorHideIdleTime = 5; // seconds
@ -44,7 +43,7 @@ namespace Ryujinx.Headless.SDL2
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static MouseButton DriverButtonToMouseButton(uint rawButton) private static MouseButton DriverButtonToMouseButton(uint rawButton)
{ {
Debug.Assert(rawButton > 0 && rawButton <= (int)MouseButton.Count); Debug.Assert(rawButton is > 0 and <= (int)MouseButton.Count);
return (MouseButton)(rawButton - 1); return (MouseButton)(rawButton - 1);
} }

View file

@ -143,7 +143,7 @@ namespace Ryujinx.SDL2.Common
OnJoystickDisconnected?.Invoke(evnt.cbutton.which); OnJoystickDisconnected?.Invoke(evnt.cbutton.which);
} }
else if (evnt.type == SDL_EventType.SDL_WINDOWEVENT || evnt.type == SDL_EventType.SDL_MOUSEBUTTONDOWN || evnt.type == SDL_EventType.SDL_MOUSEBUTTONUP) else if (evnt.type is SDL_EventType.SDL_WINDOWEVENT or SDL_EventType.SDL_MOUSEBUTTONDOWN or SDL_EventType.SDL_MOUSEBUTTONUP)
{ {
if (_registeredWindowHandlers.TryGetValue(evnt.window.windowID, out Action<SDL_Event> handler)) if (_registeredWindowHandlers.TryGetValue(evnt.window.windowID, out Action<SDL_Event> handler))
{ {