mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
feat: KDE desktop on the bottom screen beside the session (#1966)
* feat: KDE desktop as a bottom-screen mode beside the top-screen session * test: bottom-desktop launch test sets DISPLAY instead of inheriting it * fix: drop the bottom desktop's launch when the session stops while preparing it * fix: bottom desktop restarts on a fresh surface, trackpad/touch toggle, loading throbber, DroidDeck's display driver * fix: bottom desktop pauses with the session and opens the keyboard for a tapped text field * fix: no bottom desktop guest starts or keeps running unfrozen while the session is paused * fix: bottom desktop treats a freeze in progress as paused * fix: only the session that began a freeze clears its pausing flag * fix: bottom desktop launch is stored and cleared only for its own session generation * fix: a stopped session tears down the bottom desktop it started even after a newer launch is prepared * fix: a new session's bottom desktop replaces one an earlier session left running * fix: release the bottom desktop's keyboard watcher when its compositor dies * fix: bottom desktop starts its guest only for the launch its compositor was attached for * fix: bottom desktop ignores compositor replies to an earlier session's attach
This commit is contained in:
1 parent
8cb5c2168e
commit
bf9435cd36
26 files changed
+1083
-36
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import android.view.KeyEvent
|
||||
|
||||
object GuestKeys {
|
||||
/** Sends [event] as evdev presses, with Shift around characters typed by a keyboard that has no Shift key; false when it has no evdev code. */
|
||||
fun send(event: KeyEvent, sendKey: (code: Int, down: Boolean) -> Unit): Boolean {
|
||||
val down = event.action == KeyEvent.ACTION_DOWN
|
||||
if (!down && event.action != KeyEvent.ACTION_UP) return false
|
||||
var evdev = EvdevKeys.fromKeyCode(event.keyCode)
|
||||
val ch = event.unicodeChar
|
||||
val plain = if (ch > 0) EvdevKeys.unshiftedChar(ch) else 0
|
||||
if (evdev <= 0 && ch > 0) {
|
||||
val code = EvdevKeys.fromKeyCode(EvdevKeys.keycodeForChar(if (plain != 0) plain else ch))
|
||||
if (code > 0) evdev = code
|
||||
}
|
||||
val shiftEvdev = if (evdev > 0 && plain != 0 && event.deviceId <= 0) KEY_LEFTSHIFT else 0
|
||||
if (evdev <= 0 && event.scanCode > 0) evdev = event.scanCode
|
||||
if (evdev <= 0) return false
|
||||
if (down) {
|
||||
if (shiftEvdev != 0) sendKey(shiftEvdev, true)
|
||||
sendKey(evdev, true)
|
||||
} else {
|
||||
sendKey(evdev, false)
|
||||
if (shiftEvdev != 0) sendKey(shiftEvdev, false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private const val KEY_LEFTSHIFT = 42
|
||||
}
|
||||
@@ -10,12 +10,14 @@ enum class SecondScreenMode(val id: String, @StringRes val label: Int) {
|
||||
KEYBOARD_TRACKPAD("keyboard-trackpad", R.string.second_mode_keyboard_trackpad),
|
||||
TERMINAL("terminal", R.string.second_mode_terminal),
|
||||
DECK_CONTROLS("deck-controls", R.string.second_mode_deck_controls),
|
||||
DASHBOARD("dashboard", R.string.second_mode_dashboard);
|
||||
DASHBOARD("dashboard", R.string.second_mode_dashboard),
|
||||
DESKTOP("desktop", R.string.second_mode_desktop);
|
||||
|
||||
companion object {
|
||||
fun opening(remembered: String?, deckPad: Boolean, dashboard: Boolean = false): SecondScreenMode {
|
||||
fun opening(remembered: String?, deckPad: Boolean, dashboard: Boolean = false, desktop: Boolean = false): SecondScreenMode {
|
||||
entries.firstOrNull {
|
||||
it != NONE && it.id == remembered && (it != DECK_CONTROLS || deckPad) && (it != DASHBOARD || dashboard)
|
||||
it != NONE && it.id == remembered && (it != DECK_CONTROLS || deckPad) && (it != DASHBOARD || dashboard) &&
|
||||
(it != DESKTOP || desktop)
|
||||
}?.let { return it }
|
||||
// No pick yet: the dashboard. A pick that can't open right now keeps the old fallback.
|
||||
val picked = entries.any { it != NONE && it.id == remembered }
|
||||
|
||||
Reference in new issue
Block a user