diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-17 18:56:04 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-17 18:56:04 +0200 |
| commit | 5558e3509d020a0e021a77f0617044497b2f2aee (patch) | |
| tree | cd7b6cee9f7c327f9fae7ad9ac27602d1a97b222 /rsnix/src/cursor.rs | |
| parent | USB2/1.1 (EHCI/UHCI) drivers + real-hardware bring-up hardening (diff) | |
| download | rs-dos-5558e3509d020a0e021a77f0617044497b2f2aee.tar.gz rs-dos-5558e3509d020a0e021a77f0617044497b2f2aee.zip | |
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
Diffstat (limited to 'rsnix/src/cursor.rs')
| -rw-r--r-- | rsnix/src/cursor.rs | 19 |
1 files changed, 17 insertions, 2 deletions
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<usize> { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | fn task_main() { | 51 | fn task_main() { |
| 52 | let mut prev_buttons: u8 = 0; | ||
| 52 | loop { | 53 | loop { |
| 53 | while let Some(ev) = crate::usb::poll_mouse() | 54 | while let Some(ev) = crate::usb::poll_mouse() |
| 54 | .or_else(crate::ehci::poll_mouse) | 55 | .or_else(crate::ehci::poll_mouse) |
| 55 | .or_else(crate::uhci::poll_mouse) | 56 | .or_else(crate::uhci::poll_mouse) |
| 56 | .or_else(crate::ps2::try_poll_mouse) | 57 | .or_else(crate::ps2::try_poll_mouse) |
| 57 | { | 58 | { |
| 58 | crate::gop::cursor_move(ev.dx, ev.dy); | 59 | let (cx, cy) = crate::gop::cursor_move(ev.dx, ev.dy); |
| 59 | crate::gop::cursor_set_buttons(btn_bits(&ev)); | 60 | let buttons = btn_bits(&ev); |
| 61 | crate::gop::cursor_set_buttons(buttons); | ||
| 62 | // Left-button edge detection → press/release. | ||
| 63 | let kind = if buttons & 1 != 0 && prev_buttons & 1 == 0 { | ||
| 64 | crate::ps2::MouseKind::Press | ||
| 65 | } else if buttons & 1 == 0 && prev_buttons & 1 != 0 { | ||
| 66 | crate::ps2::MouseKind::Release | ||
| 67 | } else { | ||
| 68 | crate::ps2::MouseKind::Move | ||
| 69 | }; | ||
| 70 | prev_buttons = buttons; | ||
| 71 | // Route to the window manager (focus + deliver to the focused | ||
| 72 | // window with window-relative coordinates). | ||
| 73 | crate::wm::route_mouse(cx as i32, cy as i32, buttons, kind); | ||
| 74 | // Legacy single-target debug routing (`mouse <id>`). | ||
| 60 | if let Some(id) = forward_target() | 75 | if let Some(id) = forward_target() |
| 61 | && crate::sched::send(id, TaskMsg::Mouse(ev)).is_err() | 76 | && crate::sched::send(id, TaskMsg::Mouse(ev)).is_err() |
| 62 | { | 77 | { |
