feat(phase-1/m5.1): desktop Esc back stack + Ctrl+N/Ctrl+comma shortcuts
JVM PlatformBackHandler made real (PlatformBackStack + LocalPlatformBackStack); window drains it on Esc via Window(onPreviewKeyEvent) — the editor rides the shared seam unchanged (draft flush + discard prompt). Shell registers drawer/settings Esc; preview-phase shortcuts. New --keys-smoke leg drives the exact dispatch headlessly. Keypress capture pending-manual (KWin/Wayland drops xdotool XTEST events to the XWayland window). Verify: ./gradlew assembleDebug :composeApp:compileKotlinJvm :desktopApp:build (SUCCESSFUL); :desktopApp:run --args="--data-dir /tmp/incido-keys --keys-smoke --exit-after 12" (KEYS ALL-OK); --self-test/--settings-smoke/--editor-smoke green; :core:data-jvm:smoke M1a PASS.
This commit is contained in:
1 parent
faab0cde98
commit
639f39d187
5 files changed
+300
-56
No files matched your search
@@ -33,6 +33,7 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -42,6 +43,10 @@ import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.input.key.KeyEventType
|
||||
import androidx.compose.ui.input.key.key
|
||||
import androidx.compose.ui.input.key.type
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Window
|
||||
@@ -60,6 +65,8 @@ import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.incido.compose.data.backup.BackupBridge
|
||||
import org.incido.compose.ui.theme.IncidoTheme
|
||||
import org.incido.compose.util.LocalPlatformBackStack
|
||||
import org.incido.compose.util.PlatformBackStack
|
||||
import org.incido.compose.data.backup.EncryptedBackupCodec
|
||||
import org.incido.compose.data.backup.EncryptedKeyCodec
|
||||
import org.incido.data.crypto.AesGcmFieldCipher
|
||||
@@ -107,6 +114,10 @@ fun main(args: Array<String>) {
|
||||
// so the shared sections (M4.4d) render on the JVM before auto-exit.
|
||||
val settingsSmoke = "--settings-smoke" in args
|
||||
val editorSmoke = "--editor-smoke" in args
|
||||
// M5.1 scripted leg: drives the exact Esc dispatch path the window's
|
||||
// onPreviewKeyEvent uses (backStack.dispatchBack) against the real
|
||||
// editor and settings registrations.
|
||||
val keysSmoke = "--keys-smoke" in args
|
||||
val cryptoSelfTest = "--crypto-self-test" in args
|
||||
val cryptoReopen = "--crypto-reopen" in args
|
||||
val cryptoPassphrase = args.argAfter("--crypto-passphrase") ?: "selftest-passphrase"
|
||||
@@ -123,6 +134,12 @@ fun main(args: Array<String>) {
|
||||
|
||||
val app = DesktopContainer(dataDir)
|
||||
|
||||
// M5.1: the desktop back stack. PlatformBackHandler (composeApp jvm
|
||||
// actual) registers into it; Esc below drains it, topmost enabled
|
||||
// entry first — the editor's discard-prompt chain included, since its
|
||||
// BackHandler(enabled=true){tryClose()} rides the same seam.
|
||||
val backStack = PlatformBackStack()
|
||||
|
||||
// M3: window geometry is desktop-only state, kept in its OWN store file
|
||||
// (incido_window.preferences_pb) — settings stay the phone-shared schema.
|
||||
// Position is deliberately NOT stored: KWin owns placement on this stack.
|
||||
@@ -142,27 +159,43 @@ fun main(args: Array<String>) {
|
||||
onCloseRequest = ::exitApplication,
|
||||
state = windowState,
|
||||
title = "Incido",
|
||||
// M5.1: Esc = system back. Consumed only when a handler is
|
||||
// live; otherwise it falls through so popups keep their own
|
||||
// Esc handling. This is the exact dispatcher --keys-smoke
|
||||
// drives headlessly via backStack.dispatchBack().
|
||||
onPreviewKeyEvent = { event ->
|
||||
if (event.type == KeyEventType.KeyDown && event.key == Key.Escape) {
|
||||
val consumed = backStack.dispatchBack()
|
||||
println("KEYS esc(captured) consumed=$consumed")
|
||||
consumed
|
||||
} else {
|
||||
false
|
||||
}
|
||||
},
|
||||
) {
|
||||
NotesWindow(
|
||||
app = app,
|
||||
repository = app.noteRepository,
|
||||
windowStore = windowStore,
|
||||
windowState = windowState,
|
||||
exitAfterSeconds = exitAfterSeconds,
|
||||
selfTest = selfTest,
|
||||
settingsSmoke = settingsSmoke,
|
||||
editorSmoke = editorSmoke,
|
||||
backupImport = backupImport,
|
||||
backupExport = backupExport,
|
||||
backupExportEnc = backupExportEnc,
|
||||
backupPassphrase = backupPassphrase,
|
||||
cryptoSelfTest = cryptoSelfTest,
|
||||
cryptoReopen = cryptoReopen,
|
||||
cryptoPassphrase = cryptoPassphrase,
|
||||
keyExport = keyExport,
|
||||
keyImport = keyImport,
|
||||
onExit = ::exitApplication,
|
||||
)
|
||||
CompositionLocalProvider(LocalPlatformBackStack provides backStack) {
|
||||
NotesWindow(
|
||||
app = app,
|
||||
repository = app.noteRepository,
|
||||
windowStore = windowStore,
|
||||
windowState = windowState,
|
||||
exitAfterSeconds = exitAfterSeconds,
|
||||
selfTest = selfTest,
|
||||
settingsSmoke = settingsSmoke,
|
||||
editorSmoke = editorSmoke,
|
||||
keysSmoke = keysSmoke,
|
||||
backupImport = backupImport,
|
||||
backupExport = backupExport,
|
||||
backupExportEnc = backupExportEnc,
|
||||
backupPassphrase = backupPassphrase,
|
||||
cryptoSelfTest = cryptoSelfTest,
|
||||
cryptoReopen = cryptoReopen,
|
||||
cryptoPassphrase = cryptoPassphrase,
|
||||
keyExport = keyExport,
|
||||
keyImport = keyImport,
|
||||
onExit = ::exitApplication,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +213,7 @@ private fun NotesWindow(
|
||||
selfTest: Boolean,
|
||||
settingsSmoke: Boolean,
|
||||
editorSmoke: Boolean,
|
||||
keysSmoke: Boolean,
|
||||
backupImport: String?,
|
||||
backupExport: String?,
|
||||
backupExportEnc: String?,
|
||||
@@ -213,6 +247,7 @@ private fun NotesWindow(
|
||||
showSettings = showSettings,
|
||||
onShowSettings = { showSettings = it },
|
||||
editorSmoke = editorSmoke,
|
||||
keysSmoke = keysSmoke,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user