From 51cf85a9ab3806fe9294d33b24c52165a08aed6b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Thu, 9 Nov 2023 13:22:49 +0100 Subject: [PATCH 1/3] Add touch input settings to android Also updates touch settings so the touch handler can't be disabled on mobile. --- osu.Android/OsuGameAndroid.cs | 4 ++++ .../Settings/Sections/Input/TouchSettings.cs | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs index dea70e6b27..52cfb67f42 100644 --- a/osu.Android/OsuGameAndroid.cs +++ b/osu.Android/OsuGameAndroid.cs @@ -11,6 +11,7 @@ using osu.Framework.Input.Handlers; using osu.Framework.Platform; using osu.Game; using osu.Game.Overlays.Settings; +using osu.Game.Overlays.Settings.Sections.Input; using osu.Game.Updater; using osu.Game.Utils; @@ -97,6 +98,9 @@ namespace osu.Android case AndroidJoystickHandler jh: return new AndroidJoystickSettings(jh); + case AndroidTouchHandler th: + return new TouchSettings(th); + default: return base.CreateSettingsSubsectionFor(handler); } diff --git a/osu.Game/Overlays/Settings/Sections/Input/TouchSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/TouchSettings.cs index 175fcc4709..0056de6674 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TouchSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TouchSettings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Input.Handlers; using osu.Framework.Localisation; @@ -28,11 +29,14 @@ namespace osu.Game.Overlays.Settings.Sections.Input [BackgroundDependencyLoader] private void load(OsuConfigManager osuConfig) { - Add(new SettingsCheckbox + if (!RuntimeInfo.IsMobile) // don't allow disabling the only input method (touch) on mobile. { - LabelText = CommonStrings.Enabled, - Current = handler.Enabled - }); + Add(new SettingsCheckbox + { + LabelText = CommonStrings.Enabled, + Current = handler.Enabled + }); + } Add(new SettingsCheckbox { From 0c4c9aa4b515840611b3b39017ff73d04a3ecf1b Mon Sep 17 00:00:00 2001 From: Susko3 Date: Thu, 9 Nov 2023 14:37:10 +0100 Subject: [PATCH 2/3] Show touch taps setting in player loader on mobile platforms --- osu.Game/Screens/Play/PlayerSettings/InputSettings.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs index 852fbd8dcc..1387e01305 100644 --- a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -1,6 +1,7 @@ // 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; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Configuration; @@ -22,8 +23,9 @@ namespace osu.Game.Screens.Play.PlayerSettings { new PlayerCheckbox { - LabelText = MouseSettingsStrings.DisableClicksDuringGameplay, - Current = config.GetBindable(OsuSetting.MouseDisableButtons) + // TODO: change to touchscreen detection once https://github.com/ppy/osu/pull/25348 makes it in + LabelText = RuntimeInfo.IsDesktop ? MouseSettingsStrings.DisableClicksDuringGameplay : TouchSettingsStrings.DisableTapsDuringGameplay, + Current = config.GetBindable(RuntimeInfo.IsDesktop ? OsuSetting.MouseDisableButtons : OsuSetting.TouchDisableGameplayTaps) } }; } From 1b08f317fbd1fac55276dc05c29b0339667f2871 Mon Sep 17 00:00:00 2001 From: Susko3 Date: Thu, 9 Nov 2023 15:12:24 +0100 Subject: [PATCH 3/3] Show touch input settings on iOS This does not cover android since `TouchHandler` is SDL-based. --- osu.Game/OsuGameBase.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1f46eb0c0d..f44dac5f5a 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -575,14 +575,14 @@ namespace osu.Game case JoystickHandler jh: return new JoystickSettings(jh); - - case TouchHandler th: - return new TouchSettings(th); } } switch (handler) { + case TouchHandler th: + return new TouchSettings(th); + case MidiHandler: return new InputSection.HandlerSection(handler);