Skip to content

Commit

Permalink
Merge pull request ppy#30799 from peppy/fix-player-loader-focus-fux
Browse files Browse the repository at this point in the history
Fix beatmap load not continuing when when settings slider is focused
  • Loading branch information
bdach authored Nov 22, 2024
2 parents ce3d4e8 + ae98f63 commit 479ff7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 20 additions & 1 deletion osu.Game.Tests/Visual/Gameplay/TestScenePlayerLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets.Mods;
Expand Down Expand Up @@ -207,7 +208,25 @@ void moveMouse()
}

[Test]
public void TestBlockLoadViaFocus()
public void TestLoadNotBlockedViaArbitraryFocus()
{
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());

AddUntilStep("click settings slider", () =>
{
InputManager.MoveMouseTo(loader.ChildrenOfType<OsuSliderBar<float>>().First());
InputManager.Click(MouseButton.Left);

return InputManager.FocusedDrawable is OsuSliderBar<float>;
});

AddUntilStep("wait for load ready", () => player?.LoadState == LoadState.Ready);
AddUntilStep("loads", () => !loader.IsCurrentScreen());
}

[Test]
public void TestBlockLoadViaOverlayFocus()
{
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
Expand Down
4 changes: 3 additions & 1 deletion osu.Game/Screens/Play/PlayerLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ protected bool BackgroundBrightnessReduction
// not ready if the user is dragging a slider or otherwise.
&& (inputManager.DraggedDrawable == null || inputManager.DraggedDrawable is OsuLogo)
// not ready if a focused overlay is visible, like settings.
&& inputManager.FocusedDrawable == null;
&& inputManager.FocusedDrawable is not OsuFocusedOverlayContainer
// or if a child of a focused overlay is focused, like settings' search textbox.
&& inputManager.FocusedDrawable?.FindClosestParent<OsuFocusedOverlayContainer>() == null;

private readonly Func<Player> createPlayer;

Expand Down

0 comments on commit 479ff7e

Please sign in to comment.