From c2ea59d253be56ae1ceb99696a05a57164c2d1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Wed, 28 Dec 2022 11:19:27 +0100 Subject: [PATCH] SteamController: Hold to toggle touchpads in X360 --- .../Profiles/Predefined/X360Profile.cs | 23 ++++++++++++++++--- docs/shortcuts.md | 1 + 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/SteamController/Profiles/Predefined/X360Profile.cs b/SteamController/Profiles/Predefined/X360Profile.cs index af909f7..d59daae 100644 --- a/SteamController/Profiles/Predefined/X360Profile.cs +++ b/SteamController/Profiles/Predefined/X360Profile.cs @@ -5,6 +5,10 @@ namespace SteamController.Profiles.Predefined { public class X360Profile : Default.BackPanelShortcutsProfile { + public static readonly TimeSpan HoldToggleTouchPads = TimeSpan.FromMilliseconds(2000); + public const String TouchPadsConsumed = "TouchPads"; + public static bool TouchPadsEnabled { get; set; } = true; + public override bool Selected(Context context) { return context.Enabled && context.X360.Valid && context.KeyboardMouseValid && !context.State.SteamUsesSteamInput; @@ -31,9 +35,22 @@ namespace SteamController.Profiles.Predefined return Status.Done; } - // Default emulation - EmulateScrollOnLPad(context); - EmulateMouseOnRPad(context, false); + if (context.Steam.BtnLPadPress.Hold(HoldToggleTouchPads, TouchPadsConsumed) && context.Steam.BtnRPadPress.HoldOnce(HoldToggleTouchPads, TouchPadsConsumed)) + { + TouchPadsEnabled = !TouchPadsEnabled; + } + + if (TouchPadsEnabled) + { + // Default emulation + EmulateScrollOnLPad(context); + EmulateMouseOnRPad(context, false); + } + else + { + // We need to disable Lizard Mouse + context.Steam.LizardMouse = false; + } // DPad context.X360[Xbox360Button.Up] = context.Steam.BtnDpadUp; diff --git a/docs/shortcuts.md b/docs/shortcuts.md index 5858bee..ec6b36c 100644 --- a/docs/shortcuts.md +++ b/docs/shortcuts.md @@ -35,3 +35,4 @@ | DPad Arrows | Keyboard Arrows | | | | | A | RETURN | | | | | B | BACKSPACE | | | | +| Hold Press Left+Right Pad | | Toggle Mouse Trackpad | | |