From a1f341a64f4086e0edb56508597443fe708c52d2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 1 May 2017 15:23:01 +0900 Subject: [PATCH] Fix textbox focus issues (and inability to use escape). --- osu.Game/Overlays/Music/FilterControl.cs | 4 ++++ osu.Game/Overlays/Music/PlaylistOverlay.cs | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index 9e32a2e31d..dda88d64b6 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select; using OpenTK; using OpenTK.Graphics; +using System; namespace osu.Game.Overlays.Music { @@ -35,6 +36,7 @@ namespace osu.Game.Overlays.Music { RelativeSizeAxes = Axes.X, Height = 40, + Exit = () => ExitRequested?.Invoke(), }, new CollectionsDropdown { @@ -46,6 +48,8 @@ namespace osu.Game.Overlays.Music }; } + public Action ExitRequested; + public class FilterTextBox : SearchTextBox { protected override Color4 BackgroundUnfocused => OsuColour.FromHex(@"222222"); diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 434f534e5f..1613bd794a 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -73,13 +73,14 @@ namespace osu.Game.Overlays.Music { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + ExitRequested = () => State = Visibility.Hidden, Padding = new MarginPadding(10), }, }, }, }; - + list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren().ToList(); beatmapBacking.BindTo(game.Beatmap); @@ -95,7 +96,7 @@ namespace osu.Game.Overlays.Music protected override void PopIn() { filter.Search.HoldFocus = true; - filter.Search.TriggerFocus(); + Schedule(() => filter.Search.TriggerFocus()); ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); FadeIn(transition_duration, EasingTypes.OutQuint); @@ -104,7 +105,6 @@ namespace osu.Game.Overlays.Music protected override void PopOut() { filter.Search.HoldFocus = false; - filter.Search.TriggerFocusLost(); ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); FadeOut(transition_duration);