1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 20:42:54 +08:00

Use textbox focus state directly rather than trying to track it independently

This commit is contained in:
Bartłomiej Dach 2024-04-19 11:08:34 +02:00
parent 9d04b44a88
commit 2dcbb823ef
No known key found for this signature in database

View File

@ -143,8 +143,6 @@ namespace osu.Game.Overlays.Mods
protected ShearedToggleButton? CustomisationButton { get; private set; } protected ShearedToggleButton? CustomisationButton { get; private set; }
protected SelectAllModsButton? SelectAllModsButton { get; set; } protected SelectAllModsButton? SelectAllModsButton { get; set; }
private bool textBoxShouldFocus;
private Sample? columnAppearSample; private Sample? columnAppearSample;
private WorkingBeatmap? beatmap; private WorkingBeatmap? beatmap;
@ -542,7 +540,7 @@ namespace osu.Game.Overlays.Mods
if (customisationVisible.Value) if (customisationVisible.Value)
SearchTextBox.KillFocus(); SearchTextBox.KillFocus();
else else
setTextBoxFocus(textBoxShouldFocus); setTextBoxFocus(textSearchStartsActive.Value);
} }
/// <summary> /// <summary>
@ -798,15 +796,13 @@ namespace osu.Game.Overlays.Mods
return false; return false;
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`) // TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
setTextBoxFocus(!textBoxShouldFocus); setTextBoxFocus(!SearchTextBox.HasFocus);
return true; return true;
} }
private void setTextBoxFocus(bool keepFocus) private void setTextBoxFocus(bool focus)
{ {
textBoxShouldFocus = keepFocus; if (focus)
if (textBoxShouldFocus)
SearchTextBox.TakeFocus(); SearchTextBox.TakeFocus();
else else
SearchTextBox.KillFocus(); SearchTextBox.KillFocus();