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/vt.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 '')
| -rw-r--r-- | rsnix/src/vt.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/rsnix/src/vt.rs b/rsnix/src/vt.rs index 9444063..c5fc5fd 100644 --- a/rsnix/src/vt.rs +++ b/rsnix/src/vt.rs | |||
| @@ -147,6 +147,31 @@ pub fn size() -> (usize, usize) { | |||
| 147 | unsafe { (ROWS, COLS) } | 147 | unsafe { (ROWS, COLS) } |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | /// Re-render the console's cells into the shadow for a pixel region, so the | ||
| 151 | /// window manager can restore the console (layer 0) beneath a window that | ||
| 152 | /// moved, closed, or was minimized. Does not push — the caller pushes once. | ||
| 153 | pub fn repaint_region(x: usize, y: usize, w: usize, h: usize) { | ||
| 154 | unsafe { | ||
| 155 | if CELLS.is_null() { | ||
| 156 | return; | ||
| 157 | } | ||
| 158 | let (cols, rows) = (COLS, ROWS); | ||
| 159 | let c0 = x / 8; | ||
| 160 | let c1 = (x + w).div_ceil(8).min(cols); | ||
| 161 | let r0 = y / 16; | ||
| 162 | let r1 = (y + h).div_ceil(16).min(rows); | ||
| 163 | let cells = &*CELLS; | ||
| 164 | for r in r0..r1 { | ||
| 165 | for c in c0..c1 { | ||
| 166 | let cell = cells[r * cols + c]; | ||
| 167 | let fg = PALETTE[cell.fg as usize]; | ||
| 168 | let bg = PALETTE[cell.bg as usize]; | ||
| 169 | crate::gop::shadow_glyph_px(c * 8, r * 16, cell.ch, fg, bg); | ||
| 170 | } | ||
| 171 | } | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 150 | /// DEBUG (crash-family): read one cell's raw word (ch | fg<<16 | bg<<24) | 175 | /// DEBUG (crash-family): read one cell's raw word (ch | fg<<16 | bg<<24) |
| 151 | /// from the live cells grid and the rendered grid, for the given text | 176 | /// from the live cells grid and the rendered grid, for the given text |
| 152 | /// row/col. Returns (raw_cell, raw_rendered). | 177 | /// row/col. Returns (raw_cell, raw_rendered). |
