aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Hansen <emmausssss@gmail.com>2022-07-08 18:16:30 +0000
committerGitHub <noreply@github.com>2022-07-08 15:16:30 -0300
commitd86a116e1e936594e6b375098ab52120a1b67d29 (patch)
treeb20822320ac652dee6feb34c01bfcfaf05810877
parent4c2ab880ef38afefe2606245eef83ebb6724cc70 (diff)
ensure mouse cursor is only hidden when mouse is in renderer (#3448)
-rw-r--r--Ryujinx.Ava/AppHost.cs25
-rw-r--r--Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs1
2 files changed, 10 insertions, 16 deletions
diff --git a/Ryujinx.Ava/AppHost.cs b/Ryujinx.Ava/AppHost.cs
index 518b2ffc..55693ed3 100644
--- a/Ryujinx.Ava/AppHost.cs
+++ b/Ryujinx.Ava/AppHost.cs
@@ -77,7 +77,7 @@ namespace Ryujinx.Ava
private IRenderer _renderer;
private readonly Thread _renderingThread;
- private bool _isMouseInClient;
+ private bool _isMouseInRenderer;
private bool _renderingStarted;
private bool _dialogShown;
@@ -142,7 +142,6 @@ namespace Ryujinx.Ava
ConfigurationState.Instance.HideCursorOnIdle.Event += HideCursorState_Changed;
- _parent.PointerEnter += Parent_PointerEntered;
_parent.PointerLeave += Parent_PointerLeft;
_parent.PointerMoved += Parent_PointerMoved;
@@ -157,18 +156,15 @@ namespace Ryujinx.Ava
private void Parent_PointerMoved(object sender, PointerEventArgs e)
{
_lastCursorMoveTime = Stopwatch.GetTimestamp();
+ var p = e.GetCurrentPoint(_parent).Position;
+ var r = _parent.InputHitTest(p);
+ _isMouseInRenderer = r == Renderer;
}
private void Parent_PointerLeft(object sender, PointerEventArgs e)
{
- Renderer.Cursor = ConfigurationState.Instance.Hid.EnableMouse ? InvisibleCursor : Cursor.Default;
-
- _isMouseInClient = false;
- }
-
- private void Parent_PointerEntered(object sender, PointerEventArgs e)
- {
- _isMouseInClient = true;
+ _isMouseInRenderer = false;
+ _parent.Cursor = Cursor.Default;
}
private void SetRendererWindowSize(Size size)
@@ -898,13 +894,10 @@ namespace Ryujinx.Ava
{
if (ConfigurationState.Instance.Hid.EnableMouse)
{
- if (_isMouseInClient)
+ Dispatcher.UIThread.Post(() =>
{
- Dispatcher.UIThread.Post(() =>
- {
- _parent.Cursor = InvisibleCursor;
- });
- }
+ _parent.Cursor = _isMouseInRenderer ? InvisibleCursor : Cursor.Default;
+ });
}
else
{
diff --git a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
index 48e0b048..bea84e3b 100644
--- a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
+++ b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
@@ -376,6 +376,7 @@ namespace Ryujinx.Ava.Ui.Windows
ViewModel.ShowContent = true;
ViewModel.ShowLoadProgress = false;
ViewModel.IsLoadingIndeterminate = false;
+ Cursor = Cursor.Default;
AppHost = null;