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/gop.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'rsnix/src/gop.rs') diff --git a/rsnix/src/gop.rs b/rsnix/src/gop.rs index deff226..cddad22 100644 --- a/rsnix/src/gop.rs +++ b/rsnix/src/gop.rs @@ -104,6 +104,25 @@ pub fn qr_locked() -> bool { QR_LOCKED.load(Ordering::Relaxed) } +/// Hook invoked after the console scrolls, so the window manager can +/// re-composite GUI windows (which sit above the console layer in the +/// shadow and must not scroll with it). +fn scroll_hook_noop() {} + +static mut SCROLL_HOOK: fn() = scroll_hook_noop; + +pub fn set_scroll_hook(f: fn()) { + unsafe { + SCROLL_HOOK = f; + } +} + +pub(crate) fn call_scroll_hook() { + unsafe { + SCROLL_HOOK(); + } +} + #[inline] fn stall_display() { let n = DISPLAY_STALL.load(Ordering::Relaxed); -- cgit v1.2.3