Skip to content

Commit

Permalink
SDL: Move Mouse to the Input project instead of Headless.
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Oct 14, 2024
1 parent b2a35ec commit 4ee1dff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/Ryujinx.Headless.SDL2/WindowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Ryujinx.HLE.UI;
using Ryujinx.Input;
using Ryujinx.Input.HLE;
using Ryujinx.Input.SDL2;
using Ryujinx.SDL2.Common;
using System;
using System.Collections.Concurrent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Input;
using System;
using System.Drawing;
using System.Numerics;

namespace Ryujinx.Headless.SDL2
namespace Ryujinx.Input.SDL2
{
class SDL2Mouse : IMouse
public class SDL2Mouse : IMouse
{
private SDL2MouseDriver _driver;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Input;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Numerics;
using System.Runtime.CompilerServices;
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

Expand Down Expand Up @@ -44,7 +43,7 @@ public SDL2MouseDriver(HideCursorMode hideCursorMode)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.SDL2.Common/SDL2Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private void HandleSDLEvent(ref SDL_Event evnt)

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))
{
Expand Down

0 comments on commit 4ee1dff

Please sign in to comment.