mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
Add QAM shortcut to the session drawer
This commit is contained in:
1 parent
b3cdc14800
commit
b79650a2d1
3 files changed
+22
-8
No files matched your search
@@ -183,6 +183,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
padBridge?.applyTouch { st -> st.setPressed(com.steamdeck.launcher.input.GamepadState.IDX_BUTTON_MODE.toInt(), false) }
|
||||
}, 90)
|
||||
}) else null,
|
||||
onQam = if (SessionState.mode == SessionService.MODE_STEAM) ({
|
||||
drawerOpen = false
|
||||
padBridge?.triggerQam()
|
||||
}) else null,
|
||||
onProtons = { refreshProtons(); showProtons = true },
|
||||
onOsc = { v -> SessionPrefs.setOscMode(this@SessionActivity, v); readPrefs(); updateOnScreenControls() },
|
||||
onTouch = { v -> SessionPrefs.setTouchMode(this@SessionActivity, v); readPrefs() },
|
||||
|
||||
@@ -162,14 +162,21 @@ public final class PadBridge {
|
||||
boolean qamStarted = qamPressed && !systemQamPressed;
|
||||
systemGuidePressed = guidePressed;
|
||||
systemQamPressed = qamPressed;
|
||||
if (qamStarted && !qamChordActive) {
|
||||
qamChordActive = true;
|
||||
int generation = ++qamChordGeneration;
|
||||
publish();
|
||||
mainHandler.postDelayed(() -> pressQamA(generation), QAM_GUIDE_LEAD_MS);
|
||||
} else {
|
||||
publish();
|
||||
}
|
||||
if (qamStarted) startQamChord();
|
||||
else publish();
|
||||
}
|
||||
|
||||
/** Starts the same Guide-then-A sequence used by the touch QAM button. */
|
||||
public synchronized void triggerQam() {
|
||||
startQamChord();
|
||||
}
|
||||
|
||||
private void startQamChord() {
|
||||
if (qamChordActive) return;
|
||||
qamChordActive = true;
|
||||
int generation = ++qamChordGeneration;
|
||||
publish();
|
||||
mainHandler.postDelayed(() -> pressQamA(generation), QAM_GUIDE_LEAD_MS);
|
||||
}
|
||||
|
||||
private synchronized void pressQamA(int generation) {
|
||||
|
||||
@@ -127,6 +127,8 @@ class DrawerActions(
|
||||
val onKeyboard: () -> Unit,
|
||||
/** Sends the Guide button (the client's menu); null on the desktop, where there is none. */
|
||||
val onSteamMenu: (() -> Unit)?,
|
||||
/** Sends Guide + A to open Steam's Quick Access Menu; null on the desktop. */
|
||||
val onQam: (() -> Unit)?,
|
||||
val onProtons: () -> Unit,
|
||||
val onOsc: (String) -> Unit,
|
||||
val onTouch: (String) -> Unit,
|
||||
@@ -210,6 +212,7 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
)
|
||||
ActionRow("Keyboard", "The on-screen keyboard, for a field the client or a program is waiting on.", "Show") { host.open = null; a.onKeyboard() }
|
||||
if (a.onSteamMenu != null) ActionRow("Steam menu", "The Guide button: the client's own overlay, for a pad without one.", "Open ◉") { host.open = null; a.onSteamMenu.invoke() }
|
||||
if (a.onQam != null) ActionRow("Quick Access Menu", "Guide + A opens Steam's Quick Access Menu.", "Open ⋯") { host.open = null; a.onQam.invoke() }
|
||||
}
|
||||
|
||||
SettingsGroup("Next session") {
|
||||
|
||||
Reference in new issue
Block a user