From 5558e3509d020a0e021a77f0617044497b2f2aee Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 17 Aug 2026 18:56:04 +0200 Subject: Windowed GUI: wm module, input routing, and the paint app - Add the wm window-manager facility per ADR 0004: overlapping pixel-surface windows, damage-rectangle compositing, WM-drawn title bar, focus/minimize/close, and F1-F4 keybindings - Add gop shadow compositing primitives and vt::repaint_region so the console stays layer 0 beneath windows - Route mouse (absolute coords, press/release edges) and keyboard (focus-aware input pump) to the focused window - Add the rspaint drawing-program crate (pen, 8 colors, clear) and shell draw/windows/restore commands - Extend TaskMsg with AppMouse/Focus/Close and document the design in CONTEXT.md + ADR 0004 --- rsnix/src/cursor.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'rsnix/src/cursor.rs') diff --git a/rsnix/src/cursor.rs b/rsnix/src/cursor.rs index 31b919e..b986b23 100644 --- a/rsnix/src/cursor.rs +++ b/rsnix/src/cursor.rs @@ -49,14 +49,29 @@ fn forward_target() -> Option { } fn task_main() { + let mut prev_buttons: u8 = 0; loop { while let Some(ev) = crate::usb::poll_mouse() .or_else(crate::ehci::poll_mouse) .or_else(crate::uhci::poll_mouse) .or_else(crate::ps2::try_poll_mouse) { - crate::gop::cursor_move(ev.dx, ev.dy); - crate::gop::cursor_set_buttons(btn_bits(&ev)); + let (cx, cy) = crate::gop::cursor_move(ev.dx, ev.dy); + let buttons = btn_bits(&ev); + crate::gop::cursor_set_buttons(buttons); + // Left-button edge detection → press/release. + let kind = if buttons & 1 != 0 && prev_buttons & 1 == 0 { + crate::ps2::MouseKind::Press + } else if buttons & 1 == 0 && prev_buttons & 1 != 0 { + crate::ps2::MouseKind::Release + } else { + crate::ps2::MouseKind::Move + }; + prev_buttons = buttons; + // Route to the window manager (focus + deliver to the focused + // window with window-relative coordinates). + crate::wm::route_mouse(cx as i32, cy as i32, buttons, kind); + // Legacy single-target debug routing (`mouse `). if let Some(id) = forward_target() && crate::sched::send(id, TaskMsg::Mouse(ev)).is_err() { -- cgit v1.2.3