1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Update focus specifications in line with framework changes

This commit is contained in:
Dean Herbert 2024-05-22 21:27:53 +08:00
parent 8d02ac5e21
commit 66ceda1d67
No known key found for this signature in database
26 changed files with 29 additions and 29 deletions

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
editorInfo.Selected.ValueChanged += selection => editorInfo.Selected.ValueChanged += selection =>
{ {
// ensure any ongoing edits are committed out to the *current* selection before changing to a new one. // ensure any ongoing edits are committed out to the *current* selection before changing to a new one.
GetContainingInputManager().TriggerFocusContention(null); GetContainingFocusManager().TriggerFocusContention(null);
// Required to avoid cyclic failure in BindableWithCurrent (TriggerChange called during the Current_Set process). // Required to avoid cyclic failure in BindableWithCurrent (TriggerChange called during the Current_Set process).
// Arguable a framework issue but since we haven't hit it anywhere else a local workaround seems best. // Arguable a framework issue but since we haven't hit it anywhere else a local workaround seems best.

View File

@ -137,7 +137,7 @@ namespace osu.Game.Collections
this.ScaleTo(0.9f, exit_duration); this.ScaleTo(0.9f, exit_duration);
// Ensure that textboxes commit // Ensure that textboxes commit
GetContainingInputManager()?.TriggerFocusContention(this); GetContainingFocusManager()?.TriggerFocusContention(this);
} }
} }
} }

View File

@ -31,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface
if (!allowImmediateFocus) if (!allowImmediateFocus)
return; return;
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(this)); Scheduler.Add(() => GetContainingFocusManager().ChangeFocus(this));
} }
public new void KillFocus() => base.KillFocus(); public new void KillFocus() => base.KillFocus();

View File

@ -57,7 +57,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
base.OnFocus(e); base.OnFocus(e);
GetContainingInputManager().ChangeFocus(Component); GetContainingFocusManager().ChangeFocus(Component);
} }
protected override OsuTextBox CreateComponent() => CreateTextBox().With(t => protected override OsuTextBox CreateComponent() => CreateTextBox().With(t =>

View File

@ -85,7 +85,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
Current.BindValueChanged(updateTextBoxFromSlider, true); Current.BindValueChanged(updateTextBoxFromSlider, true);
} }
public bool TakeFocus() => GetContainingInputManager().ChangeFocus(textBox); public bool TakeFocus() => GetContainingFocusManager().ChangeFocus(textBox);
private bool updatingFromTextBox; private bool updatingFromTextBox;

View File

@ -243,7 +243,7 @@ namespace osu.Game.Overlays.AccountCreation
if (nextTextBox != null) if (nextTextBox != null)
{ {
Schedule(() => GetContainingInputManager().ChangeFocus(nextTextBox)); Schedule(() => GetContainingFocusManager().ChangeFocus(nextTextBox));
return true; return true;
} }

View File

@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Comments
base.LoadComplete(); base.LoadComplete();
if (!TextBox.ReadOnly) if (!TextBox.ReadOnly)
GetContainingInputManager().ChangeFocus(TextBox); GetContainingFocusManager().ChangeFocus(TextBox);
} }
protected override void OnCommit(string text) protected override void OnCommit(string text)

View File

@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Login
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); }); Schedule(() => { GetContainingFocusManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
} }
} }
} }

View File

@ -186,7 +186,7 @@ namespace osu.Game.Overlays.Login
} }
if (form != null) if (form != null)
ScheduleAfterChildren(() => GetContainingInputManager()?.ChangeFocus(form)); ScheduleAfterChildren(() => GetContainingFocusManager()?.ChangeFocus(form));
}); });
private void updateDropdownCurrent(UserStatus? status) private void updateDropdownCurrent(UserStatus? status)
@ -216,7 +216,7 @@ namespace osu.Game.Overlays.Login
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
if (form != null) GetContainingInputManager().ChangeFocus(form); if (form != null) GetContainingFocusManager().ChangeFocus(form);
base.OnFocus(e); base.OnFocus(e);
} }
} }

View File

@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Login
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
Schedule(() => { GetContainingInputManager().ChangeFocus(codeTextBox); }); Schedule(() => { GetContainingFocusManager().ChangeFocus(codeTextBox); });
} }
} }
} }

View File

@ -78,7 +78,7 @@ namespace osu.Game.Overlays
this.FadeIn(transition_time, Easing.OutQuint); this.FadeIn(transition_time, Easing.OutQuint);
FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out); FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out);
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(panel)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(panel));
} }
protected override void PopOut() protected override void PopOut()

View File

@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Mods
{ {
base.LoadComplete(); base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(nameTextBox)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(nameTextBox));
nameTextBox.Current.BindValueChanged(s => nameTextBox.Current.BindValueChanged(s =>
{ {

View File

@ -136,7 +136,7 @@ namespace osu.Game.Overlays.Mods
{ {
base.LoadComplete(); base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(nameTextBox)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(nameTextBox));
} }
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e) public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)

View File

@ -949,7 +949,7 @@ namespace osu.Game.Overlays.Mods
RequestScroll?.Invoke(this); RequestScroll?.Invoke(this);
// Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action. // Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action.
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null)); Scheduler.Add(() => GetContainingFocusManager().ChangeFocus(null));
return true; return true;
} }

View File

@ -465,7 +465,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
} }
if (HasFocus) if (HasFocus)
GetContainingInputManager().ChangeFocus(null); GetContainingFocusManager().ChangeFocus(null);
cancelAndClearButtons.FadeOut(300, Easing.OutQuint); cancelAndClearButtons.FadeOut(300, Easing.OutQuint);
cancelAndClearButtons.BypassAutoSizeAxes |= Axes.Y; cancelAndClearButtons.BypassAutoSizeAxes |= Axes.Y;

View File

@ -106,7 +106,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{ {
var next = Children.SkipWhile(c => c != sender).Skip(1).FirstOrDefault(); var next = Children.SkipWhile(c => c != sender).Skip(1).FirstOrDefault();
if (next != null) if (next != null)
GetContainingInputManager().ChangeFocus(next); GetContainingFocusManager().ChangeFocus(next);
} }
} }
} }

View File

@ -201,7 +201,7 @@ namespace osu.Game.Overlays
searchTextBox.HoldFocus = false; searchTextBox.HoldFocus = false;
if (searchTextBox.HasFocus) if (searchTextBox.HasFocus)
GetContainingInputManager().ChangeFocus(null); GetContainingFocusManager().ChangeFocus(null);
} }
public override bool AcceptsFocus => true; public override bool AcceptsFocus => true;

View File

@ -580,7 +580,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{ {
base.LoadComplete(); base.LoadComplete();
GetContainingInputManager().ChangeFocus(this); GetContainingFocusManager().ChangeFocus(this);
SelectAll(); SelectAll();
} }
} }

View File

@ -138,7 +138,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(sliderVelocitySlider)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(sliderVelocitySlider));
} }
} }
} }

View File

@ -142,7 +142,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(volume)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(volume));
} }
private static string? getCommonBank(IList<HitSampleInfo>[] relevantSamples) => relevantSamples.Select(GetBankValue).Distinct().Count() == 1 ? GetBankValue(relevantSamples.First()) : null; private static string? getCommonBank(IList<HitSampleInfo>[] relevantSamples) => relevantSamples.Select(GetBankValue).Distinct().Count() == 1 ? GetBankValue(relevantSamples.First()) : null;

View File

@ -45,7 +45,7 @@ namespace osu.Game.Screens.Edit.Setup
OnFocused?.Invoke(); OnFocused?.Invoke();
base.OnFocus(e); base.OnFocus(e);
GetContainingInputManager().TriggerFocusContention(this); GetContainingFocusManager().TriggerFocusContention(this);
} }
} }
} }

View File

@ -73,7 +73,7 @@ namespace osu.Game.Screens.Edit.Setup
base.LoadComplete(); base.LoadComplete();
if (string.IsNullOrEmpty(ArtistTextBox.Current.Value)) if (string.IsNullOrEmpty(ArtistTextBox.Current.Value))
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(ArtistTextBox)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(ArtistTextBox));
ArtistTextBox.Current.BindValueChanged(artist => transferIfRomanised(artist.NewValue, RomanisedArtistTextBox)); ArtistTextBox.Current.BindValueChanged(artist => transferIfRomanised(artist.NewValue, RomanisedArtistTextBox));
TitleTextBox.Current.BindValueChanged(title => transferIfRomanised(title.NewValue, RomanisedTitleTextBox)); TitleTextBox.Current.BindValueChanged(title => transferIfRomanised(title.NewValue, RomanisedTitleTextBox));

View File

@ -126,7 +126,7 @@ namespace osu.Game.Screens.Edit.Timing
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
base.OnFocus(e); base.OnFocus(e);
GetContainingInputManager().ChangeFocus(textBox); GetContainingFocusManager().ChangeFocus(textBox);
} }
private void updateState() private void updateState()

View File

@ -248,21 +248,21 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
{ {
base.LoadComplete(); base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(passwordTextBox)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(passwordTextBox));
passwordTextBox.OnCommit += (_, _) => performJoin(); passwordTextBox.OnCommit += (_, _) => performJoin();
} }
private void performJoin() private void performJoin()
{ {
lounge?.Join(room, passwordTextBox.Text, null, joinFailed); lounge?.Join(room, passwordTextBox.Text, null, joinFailed);
GetContainingInputManager().TriggerFocusContention(passwordTextBox); GetContainingFocusManager().TriggerFocusContention(passwordTextBox);
} }
private void joinFailed(string error) => Schedule(() => private void joinFailed(string error) => Schedule(() =>
{ {
passwordTextBox.Text = string.Empty; passwordTextBox.Text = string.Empty;
GetContainingInputManager().ChangeFocus(passwordTextBox); GetContainingFocusManager().ChangeFocus(passwordTextBox);
errorText.Text = error; errorText.Text = error;
errorText errorText

View File

@ -245,7 +245,7 @@ namespace osu.Game.Screens.Select
searchTextBox.ReadOnly = true; searchTextBox.ReadOnly = true;
searchTextBox.HoldFocus = false; searchTextBox.HoldFocus = false;
if (searchTextBox.HasFocus) if (searchTextBox.HasFocus)
GetContainingInputManager().ChangeFocus(searchTextBox); GetContainingFocusManager().ChangeFocus(searchTextBox);
} }
public void Activate() public void Activate()

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{ {
base.LoadComplete(); base.LoadComplete();
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(this)); ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(this));
beatmap.BindValueChanged(_ => Hide()); beatmap.BindValueChanged(_ => Hide());
} }