A game framework written with osu! in mind.

Transfer cursor position updates from non-mouse input handlers back to OS cursor

+9 -3
+2 -1
osu.Framework/Input/Handlers/INeedsMousePositionFeedback.cs
··· 14 14 /// Receives the final mouse position from an <see cref="InputManager"/>. 15 15 /// </summary> 16 16 /// <param name="position">The final mouse position.</param> 17 - void FeedbackMousePositionChange(Vector2 position); 17 + /// <param name="isSelfFeedback">Whether the feedback was triggered from this handler.</param> 18 + void FeedbackMousePositionChange(Vector2 position, bool isSelfFeedback); 18 19 } 19 20 }
+6 -1
osu.Framework/Input/Handlers/Mouse/MouseHandler.cs
··· 101 101 return true; 102 102 } 103 103 104 - public void FeedbackMousePositionChange(Vector2 position) 104 + public void FeedbackMousePositionChange(Vector2 position, bool isSelfFeedback) 105 105 { 106 106 if (!Enabled.Value) 107 107 return; 108 + 109 + if (!isSelfFeedback) 110 + // if another handler has updated the cursor position, handle updating the OS cursor so we can seamlessly revert 111 + // to mouse control at any point. 112 + window.UpdateMousePosition(position); 108 113 109 114 if (window.RelativeMouseMode) 110 115 {
+1 -1
osu.Framework/Input/InputManager.cs
··· 808 808 foreach (var h in InputHandlers) 809 809 { 810 810 if (h.Enabled.Value && h is INeedsMousePositionFeedback handler) 811 - handler.FeedbackMousePositionChange(mouse.Position); 811 + handler.FeedbackMousePositionChange(mouse.Position, h == mouseSource); 812 812 } 813 813 814 814 handleMouseMove(state, e.LastPosition);