From daff060c9a0ff86c12c662583b641871d23c8a5e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Sep 2020 15:18:15 +0900 Subject: [PATCH 1/2] Hide the game-wide cursor on touch input --- osu.Game/Graphics/Cursor/MenuCursorContainer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs index 3015c44613..8da80f25ff 100644 --- a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Input; +using osu.Framework.Input.StateChanges; namespace osu.Game.Graphics.Cursor { @@ -47,7 +48,10 @@ namespace osu.Game.Graphics.Cursor { base.Update(); - if (!CanShowCursor) + var lastMouseSource = GetContainingInputManager().CurrentState.Mouse.LastSource; + bool hasValidInput = lastMouseSource != null && !(lastMouseSource is ISourcedFromTouch); + + if (!hasValidInput || !CanShowCursor) { currentTarget?.Cursor?.Hide(); currentTarget = null; From 1a55d92c719c0d2db2eb0d2c977be242fe2afda8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Sep 2020 15:31:05 +0900 Subject: [PATCH 2/2] Use local input manager --- osu.Game/Graphics/Cursor/MenuCursorContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs index 8da80f25ff..4c7f7957e9 100644 --- a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Graphics.Cursor { base.Update(); - var lastMouseSource = GetContainingInputManager().CurrentState.Mouse.LastSource; + var lastMouseSource = inputManager.CurrentState.Mouse.LastSource; bool hasValidInput = lastMouseSource != null && !(lastMouseSource is ISourcedFromTouch); if (!hasValidInput || !CanShowCursor)