From f5829860a2241a767a5500de9b31637f19dc8554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 23 Jun 2017 18:02:24 +0200 Subject: [PATCH] Get rid of AlwaysReceiveInput --- osu-framework | 2 +- .../Objects/Drawables/DrawableSlider.cs | 4 ---- .../Objects/Drawables/DrawableSpinner.cs | 2 -- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 3 ++- osu.Game/Graphics/Containers/ParallaxContainer.cs | 2 -- osu.Game/Graphics/Cursor/CursorTrail.cs | 3 ++- osu.Game/Graphics/Processing/RatioAdjust.cs | 1 - osu.Game/OsuGameBase.cs | 1 - .../Overlays/SearchableList/SearchableListOverlay.cs | 1 - osu.Game/Overlays/Toolbar/Toolbar.cs | 3 --- osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 2 -- osu.Game/Rulesets/UI/Playfield.cs | 12 ------------ osu.Game/Screens/Play/KeyCounterCollection.cs | 6 +++--- osu.Game/Screens/Play/KeyCounterMouse.cs | 4 +++- osu.Game/Screens/Play/MenuOverlay.cs | 1 - osu.Game/Screens/Play/SkipButton.cs | 2 -- osu.Game/Screens/Select/FilterControl.cs | 2 -- 17 files changed, 11 insertions(+), 40 deletions(-) diff --git a/osu-framework b/osu-framework index 97ff3376d1..6a81d52ba2 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 97ff3376d1bdac3703d442e62f5ee6a36eb3b73f +Subproject commit 6a81d52ba24c4c4bcd83bf1062143ad93d8f4545 diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index b80f1d7178..395e496b61 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -28,10 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSlider(Slider s) : base(s) { - // Since the DrawableSlider itself is just a container without a size we need to - // pass all input through. - AlwaysReceiveInput = true; - SliderBouncer bouncer1; slider = s; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 3722d13ffc..840acb8221 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSpinner(Spinner s) : base(s) { - AlwaysReceiveInput = true; - Origin = Anchor.Centre; Position = s.Position; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 29d6d1f147..86dfe8e95e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { spinner = s; - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; Children = new Drawable[] @@ -40,6 +39,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + private bool tracking; public bool Tracking { diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 2d5952a3ce..19475b00c9 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -19,8 +19,6 @@ namespace osu.Game.Graphics.Containers public ParallaxContainer() { - AlwaysReceiveInput = true; - RelativeSizeAxes = Axes.Both; AddInternal(content = new Container { diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 183679fbd3..d3386c2bbf 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -65,7 +65,6 @@ namespace osu.Game.Graphics.Cursor // as we are currently very dependent on having a running clock, let's make our own clock for the time being. Clock = new FramedClock(); - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; for (int i = 0; i < max_sprites; i++) @@ -75,6 +74,8 @@ namespace osu.Game.Graphics.Cursor } } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) { diff --git a/osu.Game/Graphics/Processing/RatioAdjust.cs b/osu.Game/Graphics/Processing/RatioAdjust.cs index dd039d5144..640814d8e1 100644 --- a/osu.Game/Graphics/Processing/RatioAdjust.cs +++ b/osu.Game/Graphics/Processing/RatioAdjust.cs @@ -12,7 +12,6 @@ namespace osu.Game.Graphics.Processing { public RatioAdjust() { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 306cdaddf0..5e73ea55e6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -152,7 +152,6 @@ namespace osu.Game { new Container { - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Depth = float.MinValue, Children = new Drawable[] diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 05ee38153d..25f6b4f60b 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -82,7 +82,6 @@ namespace osu.Game.Overlays.SearchableList RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - AlwaysReceiveInput = true, Children = new Drawable[] { Header = CreateHeader(), diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 16e4f22ec8..a7e5f8dcc4 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -33,8 +33,6 @@ namespace osu.Game.Overlays.Toolbar public Toolbar() { - AlwaysReceiveInput = true; - Children = new Drawable[] { new ToolbarBackground(), @@ -55,7 +53,6 @@ namespace osu.Game.Overlays.Toolbar }, new FillFlowContainer { - AlwaysReceiveInput = true, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Direction = FillDirection.Horizontal, diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index 1928c0fc1f..c1fd234628 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -17,8 +17,6 @@ namespace osu.Game.Overlays.Toolbar public ToolbarUserArea() { - AlwaysReceiveInput = true; - RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 612569a9ae..ff321a18a5 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.UI /// Whether we want our internal coordinate system to be scaled to a specified width. protected Playfield(float? customWidth = null) { - AlwaysReceiveInput = true; - // Default height since we force relative size axes Size = Vector2.One; @@ -50,7 +48,6 @@ namespace osu.Game.Rulesets.UI { content = new Container { - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, } } @@ -100,19 +97,10 @@ namespace osu.Game.Rulesets.UI //dividing by the customwidth will effectively scale our content to the required container size. protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale; - - public ScaledContainer() - { - AlwaysReceiveInput = true; - } } public class HitObjectContainer : Container where U : Drawable { - public HitObjectContainer() - { - AlwaysReceiveInput = true; - } } } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 25cbfc14b7..8d70a0f1a9 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -9,6 +9,7 @@ using osu.Framework.Input; using osu.Framework.Configuration; using osu.Framework.Allocation; using osu.Game.Configuration; +using OpenTK; namespace osu.Game.Screens.Play { @@ -20,8 +21,6 @@ namespace osu.Game.Screens.Play public KeyCounterCollection() { - AlwaysReceiveInput = true; - Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; } @@ -124,11 +123,12 @@ namespace osu.Game.Screens.Play public Receptor(KeyCounterCollection target) { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; this.target = target; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + public override bool HandleInput => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerOnKeyDown(state, args)); diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 744cb905d9..49d669aef9 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -3,6 +3,7 @@ using osu.Framework.Input; using OpenTK.Input; +using OpenTK; namespace osu.Game.Screens.Play { @@ -12,10 +13,11 @@ namespace osu.Game.Screens.Play public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button)) { - AlwaysReceiveInput = true; Button = button; } + protected override bool InternalContains(Vector2 screenSpacePos) => true; + private static string getStringRepresentation(MouseButton button) { switch (button) diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index 1d557269c4..adfa1a736b 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -186,7 +186,6 @@ namespace osu.Game.Screens.Play protected MenuOverlay() { - AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index d110f8ecac..b38a9b4934 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -34,8 +34,6 @@ namespace osu.Game.Screens.Play public SkipButton(double startTime) { - AlwaysReceiveInput = true; - this.startTime = startTime; RelativePositionAxes = Axes.Both; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 51937df189..531c78c17e 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -82,7 +82,6 @@ namespace osu.Game.Screens.Select new Container { Padding = new MarginPadding(20), - AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Width = 0.5f, Anchor = Anchor.TopRight, @@ -109,7 +108,6 @@ namespace osu.Game.Screens.Select Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - AlwaysReceiveInput = true, Children = new Drawable[] { groupTabs = new OsuTabControl