diff options
| author | Ac_K <Acoustik666@gmail.com> | 2023-01-15 01:05:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-15 01:05:44 +0100 |
| commit | 8071c8c8c044ee56bc7578a4ba3178d2d03733db (patch) | |
| tree | a4b12e0be1afe859b9a8a9dd0c4441f7a168331a /Ryujinx.Ava/Input | |
| parent | b402b4e7f6463c42ac5afcfaee45592e75851dc3 (diff) | |
Ava UI: Fixes "Hide Cursor on Idle" for Windows (#4266)
* Ava: Fixes "Hide Cursor on Idle" for Windows
* Add check in MouseDriver and reduce the time of idling
* Fix linux error
* Change idle time everywhere for consistencies
Diffstat (limited to 'Ryujinx.Ava/Input')
| -rw-r--r-- | Ryujinx.Ava/Input/AvaloniaMouseDriver.cs | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/Ryujinx.Ava/Input/AvaloniaMouseDriver.cs b/Ryujinx.Ava/Input/AvaloniaMouseDriver.cs index b0b6cdf0..b3e1a21a 100644 --- a/Ryujinx.Ava/Input/AvaloniaMouseDriver.cs +++ b/Ryujinx.Ava/Input/AvaloniaMouseDriver.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Input; +using FluentAvalonia.Core; using Ryujinx.Input; using System; using System.Numerics; @@ -69,12 +70,22 @@ namespace Ryujinx.Ava.Input private void Parent_PointerReleaseEvent(object o, PointerReleasedEventArgs args) { - PressedButtons[(int)args.InitialPressMouseButton - 1] = false; + int button = (int)args.InitialPressMouseButton - 1; + + if (PressedButtons.Count() >= button) + { + PressedButtons[button] = false; + } } private void Parent_PointerPressEvent(object o, PointerPressedEventArgs args) { - PressedButtons[(int)args.GetCurrentPoint(_widget).Properties.PointerUpdateKind] = true; + int button = (int)args.GetCurrentPoint(_widget).Properties.PointerUpdateKind; + + if (PressedButtons.Count() >= button) + { + PressedButtons[button] = true; + } } private void Parent_PointerMovedEvent(object o, PointerEventArgs args) @@ -86,12 +97,18 @@ namespace Ryujinx.Ava.Input public void SetMousePressed(MouseButton button) { - PressedButtons[(int)button] = true; + if (PressedButtons.Count() >= (int)button) + { + PressedButtons[(int)button] = true; + } } public void SetMouseReleased(MouseButton button) { - PressedButtons[(int)button] = false; + if (PressedButtons.Count() >= (int)button) + { + PressedButtons[(int)button] = false; + } } public void SetPosition(double x, double y) @@ -101,7 +118,12 @@ namespace Ryujinx.Ava.Input public bool IsButtonPressed(MouseButton button) { - return PressedButtons[(int)button]; + if (PressedButtons.Count() >= (int)button) + { + return PressedButtons[(int)button]; + } + + return false; } public Size GetClientSize() |
