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 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;
@ -510,9 +512,9 @@ namespace osu.Game.Overlays.Mods
TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic); TopLevelContent.MoveToY(-modAreaHeight, transition_duration, Easing.InOutCubic);
if (customisationVisible.Value) if (customisationVisible.Value)
GetContainingInputManager().ChangeFocus(modSettingsArea); SearchTextBox.KillFocus();
else else
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null)); setTextBoxFocus(textBoxShouldFocus);
} }
/// <summary> /// <summary>
@ -626,8 +628,7 @@ namespace osu.Game.Overlays.Mods
nonFilteredColumnCount += 1; nonFilteredColumnCount += 1;
} }
if (textSearchStartsActive.Value) setTextBoxFocus(textSearchStartsActive.Value);
SearchTextBox.HoldFocus = true;
} }
protected override void PopOut() protected override void PopOut()
@ -766,12 +767,20 @@ 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`, `/`)
SearchTextBox.HoldFocus = !SearchTextBox.HoldFocus; setTextBoxFocus(!textBoxShouldFocus);
if (SearchTextBox.HoldFocus)
SearchTextBox.TakeFocus();
return true; return true;
} }
private void setTextBoxFocus(bool keepFocus)
{
textBoxShouldFocus = keepFocus;
if (textBoxShouldFocus)
SearchTextBox.TakeFocus();
else
SearchTextBox.KillFocus();
}
#endregion #endregion
#region Sample playback control #region Sample playback control