From fb310d1282db663807ad6dd9abc2bdeef259d467 Mon Sep 17 00:00:00 2001
From: Lukas Berger <mail@lukasberger.at>
Date: Thu, 24 Oct 2024 13:24:43 +0200
Subject: [PATCH] Store and compare cursor-positions before updating last move
 time to fix idle-hiding

---
 src/Ryujinx/AppHost.cs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs
index f4bfd116..8e0ec9cc 100644
--- a/src/Ryujinx/AppHost.cs
+++ b/src/Ryujinx/AppHost.cs
@@ -89,6 +89,7 @@ namespace Ryujinx.Ava
         private float _newVolume;
         private KeyboardHotkeyState _prevHotkeyState;
 
+        private Point? _lastCursorPoint;
         private long _lastCursorMoveTime;
         private bool _isCursorInRenderer = true;
         private bool _ignoreCursorState = false;
@@ -221,12 +222,13 @@ namespace Ryujinx.Ava
 
             if (sender is MainWindow window)
             {
-                if (ConfigurationState.Instance.HideCursor.Value == HideCursorMode.OnIdle)
+                var point = e.GetCurrentPoint(window).Position;
+
+                if (ConfigurationState.Instance.HideCursor.Value == HideCursorMode.OnIdle && (_lastCursorPoint == null || _lastCursorPoint != point))
                 {
                     _lastCursorMoveTime = Stopwatch.GetTimestamp();
                 }
 
-                var point = e.GetCurrentPoint(window).Position;
                 var bounds = RendererHost.EmbeddedWindow.Bounds;
                 var windowYOffset = bounds.Y + window.MenuBarHeight;
                 var windowYLimit = (int)window.Bounds.Height - window.StatusBarHeight - 1;
@@ -244,6 +246,7 @@ namespace Ryujinx.Ava
                     !_viewModel.IsSubMenuOpen;
 
                 _ignoreCursorState = false;
+                _lastCursorPoint = point;
             }
         }