From bdeaf2dbb4a6a3a285f089c957b50746954bb906 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 18:34:12 +0900 Subject: [PATCH 1/5] Update method names in line with framework changes --- osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs | 4 ++-- osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 4 ++-- osu.Game/Screens/Menu/ButtonSystem.cs | 8 ++++---- osu.Game/Screens/Play/FailOverlay.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 8 ++++---- osu.Game/Screens/Play/PauseContainer.cs | 2 +- osu.Game/Screens/Play/SkipButton.cs | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 9dcba02849..18857b137b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -80,7 +80,7 @@ namespace osu.Desktop.VisualTests.Tests private void triggerKeyDown(Column column) { - column.TriggerKeyDown(new InputState(), new KeyDownEventArgs + column.TriggerOnKeyDown(new InputState(), new KeyDownEventArgs { Key = column.Key, Repeat = false @@ -89,7 +89,7 @@ namespace osu.Desktop.VisualTests.Tests private void triggerKeyUp(Column column) { - column.TriggerKeyUp(new InputState(), new KeyUpEventArgs + column.TriggerOnKeyUp(new InputState(), new KeyUpEventArgs { Key = column.Key }); diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index f2ae47354e..a758d5fdef 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface.Volume return; } - volumeMeterMaster.TriggerWheel(state); + volumeMeterMaster.TriggerOnWheel(state); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 47674de817..42819f7f87 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Dialog private void pressButtonAtIndex(int index) { if (index < Buttons.Count()) - Buttons.Skip(index).First().TriggerClick(); + Buttons.Skip(index).First().TriggerOnClick(); } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Dialog if (args.Key == Key.Enter) { - Buttons.OfType().FirstOrDefault()?.TriggerClick(); + Buttons.OfType().FirstOrDefault()?.TriggerOnClick(); return true; } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 72db445052..52039a8417 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Menu switch (args.Key) { case Key.Space: - osuLogo.TriggerClick(state); + osuLogo.TriggerOnClick(state); return true; case Key.Escape: switch (State) @@ -144,7 +144,7 @@ namespace osu.Game.Screens.Menu State = MenuState.Initial; return true; case MenuState.Play: - backButton.TriggerClick(); + backButton.TriggerOnClick(); return true; } @@ -178,10 +178,10 @@ namespace osu.Game.Screens.Menu State = MenuState.TopLevel; return; case MenuState.TopLevel: - buttonsTopLevel.First().TriggerClick(); + buttonsTopLevel.First().TriggerOnClick(); return; case MenuState.Play: - buttonsPlay.First().TriggerClick(); + buttonsPlay.First().TriggerOnClick(); return; } } diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index faff687ddb..3e31da2348 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play { if (!args.Repeat && args.Key == Key.Escape) { - Buttons.Children.Last().TriggerClick(); + Buttons.Children.Last().TriggerOnClick(); return true; } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 6e1c8a34e5..25cbfc14b7 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -131,13 +131,13 @@ namespace osu.Game.Screens.Play public override bool HandleInput => true; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerKeyDown(state, args)); + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerOnKeyDown(state, args)); - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => target.Children.Any(c => c.TriggerKeyUp(state, args)); + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => target.Children.Any(c => c.TriggerOnKeyUp(state, args)); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => target.Children.Any(c => c.TriggerMouseDown(state, args)); + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => target.Children.Any(c => c.TriggerOnMouseDown(state, args)); - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => target.Children.Any(c => c.TriggerMouseUp(state, args)); + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => target.Children.Any(c => c.TriggerOnMouseUp(state, args)); } } } diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 1de62048b7..f052bafd63 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -136,7 +136,7 @@ namespace osu.Game.Screens.Play { if (!args.Repeat && args.Key == Key.Escape) { - Buttons.Children.First().TriggerClick(); + Buttons.Children.First().TriggerOnClick(); return true; } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index 86bbb26412..ee11fc0ca6 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play switch (args.Key) { case Key.Space: - button.TriggerClick(); + button.TriggerOnClick(); return true; } From d749fc516dbafb9d3406f57c91a2e152ed930d8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 20:08:46 +0900 Subject: [PATCH 2/5] Update focus handling in line with framework changes --- .../Graphics/UserInterface/FocusedTextBox.cs | 13 +++++++++++-- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 2 +- osu.Game/Overlays/LoginOverlay.cs | 3 ++- osu.Game/Overlays/Music/PlaylistOverlay.cs | 7 +++++-- .../Settings/Sections/General/LoginSettings.cs | 17 +++++++++++------ osu.Game/Overlays/SettingsOverlay.cs | 5 +++-- osu.Game/Screens/Select/FilterControl.cs | 11 ++++++++--- 8 files changed, 42 insertions(+), 18 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 2f53d00c7e..fe1d255bba 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -3,6 +3,7 @@ using OpenTK.Graphics; using OpenTK.Input; +using osu.Framework.Allocation; using osu.Framework.Input; using System; using System.Linq; @@ -23,11 +24,19 @@ namespace osu.Game.Graphics.UserInterface set { focus = value; - if (!focus) - TriggerFocusLost(); + if (!focus && HasFocus) + inputManager.ChangeFocus(null); } } + private InputManager inputManager; + + [BackgroundDependencyLoader] + private void load(UserInputManager inputManager) + { + this.inputManager = inputManager; + } + protected override bool OnFocus(InputState state) { var result = base.OnFocus(state); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 686a1d513a..90068eb170 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -165,7 +165,7 @@ namespace osu.Game.Overlays protected override bool OnFocus(InputState state) { //this is necessary as inputTextBox is masked away and therefore can't get focus :( - inputTextBox.TriggerFocus(); + InputManager.ChangeFocus(inputTextBox); return false; } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 0930c825b6..b1bc7e0c04 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -189,7 +189,7 @@ namespace osu.Game.Overlays protected override bool OnFocus(InputState state) { - filter.Search.TriggerFocus(); + InputManager.ChangeFocus(filter.Search); return false; } diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index e555600028..e2c2148201 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Overlays.Settings.Sections.General; using OpenTK.Graphics; +using osu.Framework.Input; namespace osu.Game.Overlays { @@ -66,7 +67,7 @@ namespace osu.Game.Overlays settingsSection.Bounding = true; FadeIn(transition_time, EasingTypes.OutQuint); - settingsSection.TriggerFocus(); + InputManager.ChangeFocus(settingsSection); } protected override void PopOut() diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 5e433aa414..82596252b3 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -17,6 +17,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions; +using osu.Framework.Input; namespace osu.Game.Overlays.Music { @@ -35,10 +36,12 @@ namespace osu.Game.Overlays.Music private readonly Bindable beatmapBacking = new Bindable(); public IEnumerable BeatmapSets; + private InputManager inputManager; [BackgroundDependencyLoader] - private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours) + private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours, UserInputManager inputManager) { + this.inputManager = inputManager; this.beatmaps = beatmaps; trackManager = game.Audio.Track; @@ -100,7 +103,7 @@ namespace osu.Game.Overlays.Music protected override void PopIn() { filter.Search.HoldFocus = true; - Schedule(() => filter.Search.TriggerFocus()); + Schedule(() => inputManager.ChangeFocus(filter.Search)); ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); FadeIn(transition_duration, EasingTypes.OutQuint); diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 561f81d6c3..c22a6e7411 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -51,9 +51,12 @@ namespace osu.Game.Overlays.Settings.Sections.General Spacing = new Vector2(0f, 5f); } + private InputManager inputManager; + [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, APIAccess api) + private void load(OsuColour colours, APIAccess api, UserInputManager inputManager) { + this.inputManager = inputManager; this.colours = colours; api?.Register(this); } @@ -160,12 +163,12 @@ namespace osu.Game.Overlays.Settings.Sections.General break; } - form?.TriggerFocus(); + if (form != null) inputManager.ChangeFocus(form); } protected override bool OnFocus(InputState state) { - form?.TriggerFocus(); + if (form != null) inputManager.ChangeFocus(form); return base.OnFocus(state); } @@ -174,6 +177,7 @@ namespace osu.Game.Overlays.Settings.Sections.General private TextBox username; private TextBox password; private APIAccess api; + private InputManager inputManager; private void performLogin() { @@ -182,8 +186,9 @@ namespace osu.Game.Overlays.Settings.Sections.General } [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api, OsuConfigManager config) + private void load(APIAccess api, OsuConfigManager config, UserInputManager inputManager) { + this.inputManager = inputManager; this.api = api; Direction = FillDirection.Vertical; Spacing = new Vector2(0, 5); @@ -235,9 +240,9 @@ namespace osu.Game.Overlays.Settings.Sections.General Schedule(() => { if (string.IsNullOrEmpty(username.Text)) - username.TriggerFocus(); + inputManager.ChangeFocus(username); else - password.TriggerFocus(); + inputManager.ChangeFocus(password); }); return base.OnFocus(state); diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 943545e858..474631fd1e 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -134,12 +134,13 @@ namespace osu.Game.Overlays FadeTo(0, TRANSITION_LENGTH / 2); searchTextBox.HoldFocus = false; - searchTextBox.TriggerFocusLost(); + if (searchTextBox.HasFocus) + InputManager.ChangeFocus(null); } protected override bool OnFocus(InputState state) { - searchTextBox.TriggerFocus(state); + InputManager.ChangeFocus(searchTextBox); return false; } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 7c7863acd1..94bc60a6ca 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -154,7 +154,8 @@ namespace osu.Game.Screens.Select public void Deactivate() { searchTextBox.HoldFocus = false; - searchTextBox.TriggerFocusLost(); + if (searchTextBox.HasFocus) + inputManager.ChangeFocus(searchTextBox); } public void Activate() @@ -164,9 +165,13 @@ namespace osu.Game.Screens.Select private readonly Bindable ruleset = new Bindable(); - [BackgroundDependencyLoader(permitNulls:true)] - private void load(OsuColour colours, OsuGame osu) + private InputManager inputManager; + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuColour colours, OsuGame osu, UserInputManager inputManager) { + this.inputManager = inputManager; + sortTabs.AccentColour = colours.GreenLight; if (osu != null) From 013b4f9b899f12ffeb019d4938d814545d1448ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 21:09:44 +0900 Subject: [PATCH 3/5] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 8baad1b948..91fc2f2906 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8baad1b9484b9f35724e2f965c18cfe710907d80 +Subproject commit 91fc2f290642eaaa2d365ca02558f92eba9009ca From 3644198c6e615f46412549f3e2cb1e1a6c148fb6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 21:20:11 +0900 Subject: [PATCH 4/5] Fix CI issues --- osu.Game/Overlays/LoginOverlay.cs | 1 - .../Overlays/Settings/Sections/General/LoginSettings.cs | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index e2c2148201..c3f41270ce 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Overlays.Settings.Sections.General; using OpenTK.Graphics; -using osu.Framework.Input; namespace osu.Game.Overlays { diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index c22a6e7411..00ca50927e 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -237,14 +237,7 @@ namespace osu.Game.Overlays.Settings.Sections.General protected override bool OnFocus(InputState state) { - Schedule(() => - { - if (string.IsNullOrEmpty(username.Text)) - inputManager.ChangeFocus(username); - else - inputManager.ChangeFocus(password); - }); - + Schedule(() => { inputManager.ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); }); return base.OnFocus(state); } } From 18bcec723a4f8fbc4b89421432a0438d4aa7445f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 28 May 2017 21:29:41 +0900 Subject: [PATCH 5/5] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 91fc2f2906..0b9053ec3d 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 91fc2f290642eaaa2d365ca02558f92eba9009ca +Subproject commit 0b9053ec3d39b486165992374752b280c5eeef06