summaryrefslogtreecommitdiffstats
path: root/rsnix/src/wm.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-20 13:47:10 +0200
committersalmonik <salmonik@tuta.io>2026-08-20 13:47:10 +0200
commitcb17c57452ccd2ccca77e99098402d4b9f61c0a5 (patch)
tree6566e0ddaa764c6675e9a56f03772de345170992 /rsnix/src/wm.rs
parentwm: integrate home terminal as window 0 + fix console focus after close (diff)
downloadrs-dos-cb17c57452ccd2ccca77e99098402d4b9f61c0a5.tar.gz
rs-dos-cb17c57452ccd2ccca77e99098402d4b9f61c0a5.zip
wm: F1 spawns a windowed shell — real shell, not a duplicate
Architecture: - vt: ACTIVE terminal redirect — when set, all gop_print!/put_char/write_str go there instead of HOME. Terminal::from_buffer() renders into a WM-owned pixel buffer. - tty: read_line_from_queue() — canonical-mode line input from the task's own message queue (TaskMsg::Key). Returns None on Close. - shell: run_windowed() — same shell as the console but reads from the message queue. Returns on ^D or window close. - wm: F1 calls SPAWN_TERMINAL_CB (set by rsdos). No shell logic in the WM. - rsdos: terminal_task callback + terminal_entry task — creates a 640x400 chrome window, wires up Terminal::from_buffer, sets ACTIVE, runs shell::run_windowed(), cleans up on exit. - shell: 'term' debug command that invokes the callback directly and logs each step to serial.
Diffstat (limited to '')
-rw-r--r--rsnix/src/wm.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/rsnix/src/wm.rs b/rsnix/src/wm.rs
index 2641b69..05781e8 100644
--- a/rsnix/src/wm.rs
+++ b/rsnix/src/wm.rs
@@ -394,8 +394,22 @@ pub fn handle_key(ev: KeyEvent) -> bool {
394 } 394 }
395} 395}
396 396
397static TERM_COUNT: core::sync::atomic::AtomicUsize = core::sync::atomic::AtomicUsize::new(0);
398
399/// Callback set by rsdos to spawn a terminal task. Takes (title, w, h).
400pub static mut SPAWN_TERMINAL_CB: Option<fn(&str, usize, usize)> = None;
401
397fn spawn_terminal() { 402fn spawn_terminal() {
398 crate::serial_println!("wm: F1 (spawn terminal) not implemented yet"); 403 let Some(cb) = (unsafe { SPAWN_TERMINAL_CB }) else {
404 crate::serial_println!("wm: SPAWN_TERMINAL_CB not set");
405 return;
406 };
407 let n = TERM_COUNT.fetch_add(1, Ordering::Relaxed) + 1;
408 let title = alloc::format!("term {}", n);
409 let (cw, ch) = gop::pixel_dims();
410 let w = 640.min(cw);
411 let h = 400.min(ch);
412 cb(&title, w, h);
399} 413}
400 414
401fn remove_from_zorder(id: usize) { 415fn remove_from_zorder(id: usize) {