diff --git a/app/src/main/java/com/droiddeck/launcher/input/FakeInputWriter.java b/app/src/main/java/com/droiddeck/launcher/input/FakeInputWriter.java index c345532d..ed4a88d2 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/FakeInputWriter.java +++ b/app/src/main/java/com/droiddeck/launcher/input/FakeInputWriter.java @@ -566,6 +566,16 @@ public class FakeInputWriter { } } + /** + * Whether the pad, as the Steam client now sees it, has a Quick Access button: a Deck's or a + * Steam Controller's does, an Xbox or PlayStation pad's does not (libfakeinput drops the bit). + * Unset is the Deck, libfakeinput's default. + */ + public static boolean padHasQam() { + int type = padType; + return type < 0 || type == PAD_TYPE_DECK || type == PAD_TYPE_STEAM; + } + /** * Switches what the pad is to the Steam client while the session runs ([PAD_TYPE_DECK], * [PAD_TYPE_STEAM] or [PAD_TYPE_XBOX]); libfakeinput unplugs the old device and plugs in the new. diff --git a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java index a93c8b9a..78822422 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java +++ b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java @@ -400,8 +400,8 @@ public final class PadBridge { boolean qamStarted = qamPressed && !systemQamPressed; systemGuidePressed = guidePressed; systemQamPressed = qamPressed; - // A Deck controller's QAM button is held for as long as the touch one is. - if (qamStarted && !SessionState.getDeckPad()) startQamChord(); + // A Deck or Steam Controller's QAM button is held for as long as the touch one is. + if (qamStarted && !nativeQam()) startQamChord(); else publish(); } @@ -426,9 +426,18 @@ public final class PadBridge { } } - /** Opens the client's Quick Access menu: a tap of the Deck's button, or the Guide-then-A chord. */ + /** + * Whether the client's pad has its own QAM button to press. The Deck's sysfs being up is not + * enough: the drawer can make the pad an Xbox or PlayStation one, which has none, and a press + * of it never reaches the client. + */ + private static boolean nativeQam() { + return SessionState.getDeckPad() && FakeInputWriter.padHasQam(); + } + + /** Opens the client's Quick Access menu: a tap of the pad's button, or the Guide-then-A chord. */ public synchronized void triggerQam() { - if (!SessionState.getDeckPad()) { + if (!nativeQam()) { startQamChord(); return; } @@ -571,7 +580,7 @@ public final class PadBridge { return; } boolean guide = systemGuidePressed || qamChordActive; - boolean qam = SessionState.getDeckPad() && (systemQamPressed || qamTapPressed); + boolean qam = nativeQam() && (systemQamPressed || qamTapPressed); if (!guide && !qam) { writer.writePad(state); return;