From 82d944dc899505f6d56b6f529cb2e1447490e664 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Jan 2019 19:10:11 +0900 Subject: [PATCH 1/8] Fix textbox colours not always being set corrrectly --- osu.Game/Overlays/Music/FilterControl.cs | 12 ++---------- .../SearchableList/SearchableListFilterControl.cs | 13 +++---------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index ea18c9bb2c..c2c10d999f 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; @@ -53,10 +52,9 @@ namespace osu.Game.Overlays.Music public class FilterTextBox : SearchTextBox { - private Color4 backgroundColour; + protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f); + protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f); - protected override Color4 BackgroundUnfocused => backgroundColour; - protected override Color4 BackgroundFocused => backgroundColour; protected override bool AllowCommit => true; public FilterTextBox() @@ -64,12 +62,6 @@ namespace osu.Game.Overlays.Music Masking = true; CornerRadius = 5; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - backgroundColour = colours.Gray2; - } } } } diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index f679e0186a..478e3d4c95 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -127,17 +127,10 @@ namespace osu.Game.Overlays.SearchableList private class FilterSearchTextBox : SearchTextBox { - protected override Color4 BackgroundUnfocused => backgroundColour; - protected override Color4 BackgroundFocused => backgroundColour; + protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f); + protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f); + protected override bool AllowCommit => true; - - private Color4 backgroundColour; - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - backgroundColour = colours.Gray2.Opacity(0.9f); - } } } } From 260034a80ebfe2e4f604bd1459eac499552b0f5a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Jan 2019 19:20:08 +0900 Subject: [PATCH 2/8] Don't auto-focus textboxes when on screen keyboard would cause inconvenience --- .../Graphics/UserInterface/FocusedTextBox.cs | 19 ++++++++++++++++++- .../Chat/Selection/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- .../SearchableList/SearchableListOverlay.cs | 2 +- osu.Game/Overlays/SettingsOverlay.cs | 2 +- .../Screens/Multi/Lounge/LoungeSubScreen.cs | 2 +- 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 273ac12db4..9eac0c1109 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -3,7 +3,9 @@ using osuTK.Graphics; using System; +using osu.Framework.Allocation; using osu.Framework.Input.Events; +using osu.Framework.Platform; using osu.Game.Input.Bindings; using osuTK.Input; @@ -21,9 +23,16 @@ namespace osu.Game.Graphics.UserInterface private bool focus; + private bool allowImmediateFocus => host?.OnScreenKeyboardOverlapsGameWindow != true; + + public void TakeFocus() + { + if (allowImmediateFocus) GetContainingInputManager().ChangeFocus(this); + } + public bool HoldFocus { - get { return focus; } + get { return allowImmediateFocus && focus; } set { focus = value; @@ -32,6 +41,14 @@ namespace osu.Game.Graphics.UserInterface } } + private GameHost host; + + [BackgroundDependencyLoader] + private void load(GameHost host) + { + this.host = host; + } + // We may not be focused yet, but we need to handle keyboard input to be able to request focus public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput; diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs index 5969d7aded..00de5fd5fd 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs @@ -164,7 +164,7 @@ namespace osu.Game.Overlays.Chat.Selection protected override void OnFocus(FocusEvent e) { - GetContainingInputManager().ChangeFocus(search); + search.TakeFocus(); base.OnFocus(e); } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 74edf48433..821c942a57 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -302,7 +302,7 @@ namespace osu.Game.Overlays protected override void OnFocus(FocusEvent e) { //this is necessary as textbox is masked away and therefore can't get focus :( - GetContainingInputManager().ChangeFocus(textbox); + textbox.TakeFocus(); base.OnFocus(e); } diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index f69ab3ec38..7b5a59836f 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Music protected override void PopIn() { filter.Search.HoldFocus = true; - Schedule(() => GetContainingInputManager().ChangeFocus(filter.Search)); + Schedule(() => filter.Search.TakeFocus()); this.ResizeTo(new Vector2(1, playlist_height), transition_duration, Easing.OutQuint); this.FadeIn(transition_duration, Easing.OutQuint); diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index ecb610c1f4..87c369e246 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -103,7 +103,7 @@ namespace osu.Game.Overlays.SearchableList protected override void OnFocus(FocusEvent e) { - GetContainingInputManager().ChangeFocus(Filter.Search); + Filter.Search.TakeFocus(); } protected override void PopIn() diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index e5eee22164..802e97d92a 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -179,7 +179,7 @@ namespace osu.Game.Overlays protected override void OnFocus(FocusEvent e) { - GetContainingInputManager().ChangeFocus(searchTextBox); + searchTextBox.TakeFocus(); base.OnFocus(e); } diff --git a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs index db0f105e0e..28ec5d2d1a 100644 --- a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Multi.Lounge protected override void OnFocus(FocusEvent e) { - GetContainingInputManager().ChangeFocus(Filter.Search); + Filter.Search.TakeFocus(); } protected override void OnEntering(Screen last) From c8c375636fab9a166326d6d0ae61d3c6b3b8790d Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 25 Jan 2019 19:34:25 +0900 Subject: [PATCH 3/8] Use lambda Co-Authored-By: peppy --- osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 9eac0c1109..73c9c0dd0e 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -32,7 +32,7 @@ namespace osu.Game.Graphics.UserInterface public bool HoldFocus { - get { return allowImmediateFocus && focus; } + get => allowImmediateFocus && focus; set { focus = value; From 5c70be07ab3d6bbd14a95de5c9561450653dffbf Mon Sep 17 00:00:00 2001 From: phosphene47 Date: Fri, 25 Jan 2019 22:58:55 +1100 Subject: [PATCH 4/8] Display carousel over beatmap info wedge --- osu.Game/Screens/Select/SongSelect.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index c33e718540..e30b5914be 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -123,6 +123,16 @@ namespace osu.Game.Screens.Select Padding = new MarginPadding { Top = 10, Right = 5 }, } }, + beatmapInfoWedge = new BeatmapInfoWedge + { + Size = wedged_container_size, + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding + { + Top = left_area_padding, + Right = left_area_padding, + }, + }, new Container { RelativeSizeAxes = Axes.Both, @@ -163,16 +173,6 @@ namespace osu.Game.Screens.Select } }, }, - beatmapInfoWedge = new BeatmapInfoWedge - { - Size = wedged_container_size, - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding - { - Top = left_area_padding, - Right = left_area_padding, - }, - }, new ResetScrollContainer(() => Carousel.ScrollToSelected()) { RelativeSizeAxes = Axes.Y, From e939f75f4bcf20f96873d9028e352b1d46c4b4dc Mon Sep 17 00:00:00 2001 From: ProgrammaticNajel Date: Sat, 26 Jan 2019 18:19:01 +0800 Subject: [PATCH 5/8] Transform screen mouse coordinates to local space coordinates. --- .../Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs index 0dcf5ba551..ee28f4ae6b 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs @@ -22,8 +22,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles { base.LoadComplete(); - // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame - HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position; + // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame + HitObject.Position = Parent.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); } protected override bool OnClick(ClickEvent e) From e71b13683a1189ae8fda808b2b2f22674e651900 Mon Sep 17 00:00:00 2001 From: ProgrammaticNajel Date: Sat, 26 Jan 2019 22:55:33 +0800 Subject: [PATCH 6/8] Add null check --- .../Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs index ee28f4ae6b..07c3132282 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs @@ -5,6 +5,7 @@ using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; +using osuTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles { @@ -23,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles base.LoadComplete(); // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame - HitObject.Position = Parent.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position); + HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position)?? Vector2.Zero; } protected override bool OnClick(ClickEvent e) From 0797f5d644b80e1f6c5b62a5864b6f3a5e1c2d4d Mon Sep 17 00:00:00 2001 From: ProgrammaticNajel Date: Sat, 26 Jan 2019 22:56:31 +0800 Subject: [PATCH 7/8] Update SliderPlacementBlueprint.cs --- .../Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs index f563ad2264..989a53db1f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderPlacementBlueprint.cs @@ -47,6 +47,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders setState(PlacementState.Initial); } + protected override void LoadComplete() + { + base.LoadComplete(); + + // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame + HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero; + } + protected override bool OnMouseMove(MouseMoveEvent e) { switch (state) From 2058604ef35c03d01fdc5d92d79197dbeeb1bca5 Mon Sep 17 00:00:00 2001 From: ProgrammaticNajel Date: Sat, 26 Jan 2019 23:10:13 +0800 Subject: [PATCH 8/8] Typo fix --- .../Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs index 07c3132282..a4050f0c31 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles base.LoadComplete(); // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame - HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position)?? Vector2.Zero; + HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero; } protected override bool OnClick(ClickEvent e)