diff options
Diffstat (limited to '')
| -rw-r--r-- | rsnix/src/wm.rs | 16 |
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 | ||
| 397 | static 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). | ||
| 400 | pub static mut SPAWN_TERMINAL_CB: Option<fn(&str, usize, usize)> = None; | ||
| 401 | |||
| 397 | fn spawn_terminal() { | 402 | fn 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 | ||
| 401 | fn remove_from_zorder(id: usize) { | 415 | fn remove_from_zorder(id: usize) { |
