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