mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
Dolphin from the rail: guide toggles full screen (its window and settings), drawn in the main window
This commit is contained in:
1 parent
7fbfeb2edd
commit
ee3fd4d6b8
2 files changed
+29
-5
No files matched your search
@@ -736,6 +736,20 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
if (pcKeyboardOpen && event.device != null && PadBridge.isFromController(event.device)) return super.dispatchKeyEvent(event)
|
||||
// Dolphin (PC) has no controller menu of its own: in a Dolphin game from the rail the guide
|
||||
// button is its Toggle Fullscreen hotkey (Alt+Return, Dolphin's default) instead, which
|
||||
// brings up Dolphin's window with its Config / Graphics / Stop buttons, and back again.
|
||||
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_MODE && guideIsDolphinFullscreen() &&
|
||||
event.device != null && PadBridge.isFromController(event.device)
|
||||
) {
|
||||
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0 && CompositorHost.isStarted) {
|
||||
WaylandCompositor.nativeSendKey(KEY_LEFTALT, 1)
|
||||
WaylandCompositor.nativeSendKey(KEY_ENTER, 1)
|
||||
WaylandCompositor.nativeSendKey(KEY_ENTER, 0)
|
||||
WaylandCompositor.nativeSendKey(KEY_LEFTALT, 0)
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (event.keyCode != KeyEvent.KEYCODE_BACK && padBridge?.onKeyEvent(event) == true) return true
|
||||
// A hardware keyboard, forwarded to the compositor's wl_keyboard. Back is left to the
|
||||
// activity, which opens the drawer.
|
||||
@@ -994,6 +1008,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
if (reset) secondScreenMode = SecondScreenMode.NONE
|
||||
}
|
||||
|
||||
private fun guideIsDolphinFullscreen(): Boolean =
|
||||
SessionState.mode == SessionService.MODE_RUN &&
|
||||
SessionState.program?.substringAfterLast('/')?.startsWith("dolphin") == true
|
||||
|
||||
/** Touchpad on the desktop, direct in Steam, unless the drawer says otherwise. */
|
||||
private fun usingTouchpad(): Boolean = when (SessionPrefs.touchMode(this)) {
|
||||
SessionPrefs.TOUCH_PAD -> true
|
||||
@@ -1191,6 +1209,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
}
|
||||
|
||||
companion object {
|
||||
// evdev codes (linux/input-event-codes.h) for the Alt+Return sent to Dolphin.
|
||||
private const val KEY_LEFTALT = 56
|
||||
private const val KEY_ENTER = 28
|
||||
private const val TAG = "SessionActivity"
|
||||
private const val BACK_DOUBLE_PRESS_TIMEOUT_MS = 500L
|
||||
private const val DRAWER_HAT_THRESHOLD = 0.5f
|
||||
|
||||
Reference in new issue
Block a user