diff --git a/osu.Game/Input/OsuUserInputManager.cs b/osu.Game/Input/OsuUserInputManager.cs index 7a9002a004..5e700e32de 100644 --- a/osu.Game/Input/OsuUserInputManager.cs +++ b/osu.Game/Input/OsuUserInputManager.cs @@ -3,17 +3,43 @@ #nullable disable +using osu.Framework.Bindables; using osu.Framework.Input; +using osu.Framework.Input.StateChanges.Events; using osuTK.Input; namespace osu.Game.Input { public class OsuUserInputManager : UserInputManager { + /// + /// Whether the last input applied to the game is sourced from mouse. + /// + public IBindable IsMouseInputSource => isMouseInputSource; + + private readonly Bindable isMouseInputSource = new Bindable(); + internal OsuUserInputManager() { } + public override void HandleInputStateChange(InputStateChangeEvent inputStateChange) + { + switch (inputStateChange) + { + case ButtonStateChangeEvent: + case MousePositionChangeEvent: + isMouseInputSource.Value = true; + break; + + default: + isMouseInputSource.Value = false; + break; + } + + base.HandleInputStateChange(inputStateChange); + } + protected override MouseButtonEventManager CreateButtonEventManagerFor(MouseButton button) { switch (button)