1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:02:55 +08:00

Revert to using a more manual approach to holding focus

This commit is contained in:
Dean Herbert 2023-12-19 19:46:30 +09:00
parent 51f4c7254c
commit c556475c2c
No known key found for this signature in database

View File

@ -132,6 +132,8 @@ namespace osu.Game.Overlays.Mods
protected ShearedToggleButton? CustomisationButton { get; private set; }
protected SelectAllModsButton? SelectAllModsButton { get; set; }
private bool textBoxShouldFocus;
private Sample? columnAppearSample;
private WorkingBeatmap? beatmap;
@ -510,9 +512,9 @@ namespace osu.Game.Overlays.Mods
TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic);
if (customisationVisible.Value)
GetContainingInputManager().ChangeFocus(modSettingsArea);
SearchTextBox.KillFocus();
else
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null));
setTextBoxFocus(textBoxShouldFocus);
}
/// <summary>
@ -626,8 +628,7 @@ namespace osu.Game.Overlays.Mods
nonFilteredColumnCount += 1;
}
if (textSearchStartsActive.Value)
SearchTextBox.HoldFocus = true;
setTextBoxFocus(textSearchStartsActive.Value);
}
protected override void PopOut()
@ -766,12 +767,20 @@ namespace osu.Game.Overlays.Mods
return false;
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
SearchTextBox.HoldFocus = !SearchTextBox.HoldFocus;
if (SearchTextBox.HoldFocus)
SearchTextBox.TakeFocus();
setTextBoxFocus(!textBoxShouldFocus);
return true;
}
private void setTextBoxFocus(bool keepFocus)
{
textBoxShouldFocus = keepFocus;
if (textBoxShouldFocus)
SearchTextBox.TakeFocus();
else
SearchTextBox.KillFocus();
}
#endregion
#region Sample playback control