From b418c26050870b900ff56d5a47f32209795aaf4a Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 21 Aug 2026 03:30:35 +0200 Subject: v0.5.11: fix terminal focus — toggle ACTIVE on Focus messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - tty: read_line_from_queue() now takes &mut Terminal and handles TaskMsg::Focus: Focus(true) sets ACTIVE to the terminal, Focus(false) clears it. This fixes the bug where the console shell's gop_print! output was redirected to the soft terminal even after focus switched away from it. - shell: run_windowed() passes the terminal through to read_line_from_queue. - wm: remove noisy per-key debug logging from pump_main. --- rsnix/src/tty.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'rsnix/src/tty.rs') diff --git a/rsnix/src/tty.rs b/rsnix/src/tty.rs index 918f6e0..c44dca8 100644 --- a/rsnix/src/tty.rs +++ b/rsnix/src/tty.rs @@ -139,7 +139,14 @@ pub fn read_line() -> LineInput { /// windowed shells). Same semantics as `read_line` but keys arrive as /// `TaskMsg::Key` instead of from the global PS/2 queue. Returns `None` /// on `TaskMsg::Close` (window was closed). -pub fn read_line_from_queue() -> Option { +/// Read one line in canonical mode from the task's message queue (for +/// windowed shells). Same semantics as `read_line` but keys arrive as +/// `TaskMsg::Key` instead of from the global PS/2 queue. Returns `None` +/// on `TaskMsg::Close` (window was closed). +/// +/// Handles `TaskMsg::Focus` to toggle the global `ACTIVE` redirect so +/// gop_print! goes to the right terminal buffer. +pub fn read_line_from_queue(term: &mut crate::vt::Terminal) -> Option { crate::vt::sync_scroll(); let mut buf = strbuf::String::::new(); loop { @@ -191,6 +198,13 @@ pub fn read_line_from_queue() -> Option { } _ => {} }, + crate::sched::TaskMsg::Focus(gained) => { + if gained { + crate::vt::set_active(term as *mut crate::vt::Terminal); + } else { + crate::vt::set_active(core::ptr::null_mut()); + } + } crate::sched::TaskMsg::Close => return None, _ => {} } -- cgit v1.2.3