From f4fab5a2b06c37df08d2d315bcb44d15af1786a4 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 17 Aug 2026 19:08:47 +0200 Subject: wm: keep windows in place when the console scrolls beneath them The console's batched scroll (gop::shift_up_n) shifts the whole shared shadow, which dragged any composited window pixels up with it. Add a scroll hook so the window manager re-composites every visible window after a console scroll, restoring them at their fixed positions. --- rsnix/src/wm.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'rsnix/src/wm.rs') diff --git a/rsnix/src/wm.rs b/rsnix/src/wm.rs index be74f9a..1326696 100644 --- a/rsnix/src/wm.rs +++ b/rsnix/src/wm.rs @@ -90,6 +90,8 @@ pub fn init() { CASCADE_Y = 0; } FOCUSED.store(CONSOLE, Ordering::Relaxed); + // When the console scrolls, re-composite windows so they stay put. + gop::set_scroll_hook(redraw_windows); } /// The focused window, or `None` if the console has focus. @@ -661,6 +663,20 @@ pub fn spawn_input_pump() -> Option { crate::sched::spawn(pump_main, "wm-input") } +/// Re-composite every visible window. Called after the console scrolls so +/// windows stay in place while the text layer beneath them shifts. +pub fn redraw_windows() { + unsafe { + for i in 0..ZLEN { + let id = ZORDER[i]; + let w = WINDOWS[id]; + if w.used && w.state == WinState::Visible { + composite_rect(w.x, w.y, w.w, w.h + TITLE_BAR_H); + } + } + } +} + fn pump_main() { loop { if focused().is_some() { -- cgit v1.2.3