From c0145f4e81683bdbff4694fd16b045ac1050cd3b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Fri, 22 Nov 2024 22:57:07 +0000 Subject: [PATCH 1/2] Factor scale in UserInputManager.mouseOutsideAllDisplays The mouse position is in pixel/client coordinates, while window and displays positions are in window coordinates. --- osu.Framework/Input/UserInputManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Framework/Input/UserInputManager.cs b/osu.Framework/Input/UserInputManager.cs index c08f0b2f63..4c5de68114 100644 --- a/osu.Framework/Input/UserInputManager.cs +++ b/osu.Framework/Input/UserInputManager.cs @@ -87,6 +87,9 @@ private bool mouseOutsideAllDisplays(Vector2 mousePosition) { Point windowLocation; + float scale = Host.Window is ISDLWindow window ? window.Scale : 1; + mousePosition /= scale; + switch (Host.Window.WindowMode.Value) { case WindowMode.Windowed: From 0d77c76738760244cf5e3439caa3084e4c756f6b Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Fri, 22 Nov 2024 22:02:43 -0500 Subject: [PATCH 2/2] Reorder code --- osu.Framework/Input/UserInputManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Framework/Input/UserInputManager.cs b/osu.Framework/Input/UserInputManager.cs index 4c5de68114..2d2cbf6314 100644 --- a/osu.Framework/Input/UserInputManager.cs +++ b/osu.Framework/Input/UserInputManager.cs @@ -87,9 +87,6 @@ private bool mouseOutsideAllDisplays(Vector2 mousePosition) { Point windowLocation; - float scale = Host.Window is ISDLWindow window ? window.Scale : 1; - mousePosition /= scale; - switch (Host.Window.WindowMode.Value) { case WindowMode.Windowed: @@ -101,6 +98,9 @@ private bool mouseOutsideAllDisplays(Vector2 mousePosition) break; } + float scale = Host.Window is ISDLWindow window ? window.Scale : 1; + mousePosition /= scale; + int x = (int)MathF.Floor(windowLocation.X + mousePosition.X); int y = (int)MathF.Floor(windowLocation.Y + mousePosition.Y);