diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-21 04:09:57 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-21 04:09:57 +0200 |
| commit | 235906cc36d9195b7b36d67f94f40cacccf030fd (patch) | |
| tree | 0970d6766c7d99beb3ee15a87503dcee9ed6185e | |
| parent | wm: 1px focus-colored border + flush full window on focus change (diff) | |
| download | rs-dos-235906cc36d9195b7b36d67f94f40cacccf030fd.tar.gz rs-dos-235906cc36d9195b7b36d67f94f40cacccf030fd.zip | |
wm: fix usize underflow in move_window at screen edges
ox.saturating_sub(pad) / oy.saturating_sub(pad) — plain subtraction
on usize wraps to usize::MAX when the window sits at x=0 or y=0,
causing composite_rect to draw at the far end of the framebuffer
instead of near the window. Also broke drag-to-move when stuck
against the top or left edge.
| -rw-r--r-- | rsnix/src/wm.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/rsnix/src/wm.rs b/rsnix/src/wm.rs index e5ae6ba..39ad1be 100644 --- a/rsnix/src/wm.rs +++ b/rsnix/src/wm.rs | |||
| @@ -604,9 +604,10 @@ fn move_window(id: usize, nx: usize, ny: usize) { | |||
| 604 | WINDOWS[id].x = nx; | 604 | WINDOWS[id].x = nx; |
| 605 | WINDOWS[id].y = ny; | 605 | WINDOWS[id].y = ny; |
| 606 | } | 606 | } |
| 607 | let pad = 1; | 607 | let pad: usize = 1; |
| 608 | composite_rect(ox - pad, oy - pad, w.w + 2 * pad, w.h + TITLE_BAR_H + 2 * pad); | 608 | let oh = w.h + TITLE_BAR_H; |
| 609 | composite_rect(nx - pad, ny - pad, w.w + 2 * pad, w.h + TITLE_BAR_H + 2 * pad); | 609 | composite_rect(ox.saturating_sub(pad), oy.saturating_sub(pad), w.w + 2 * pad, oh + 2 * pad); |
| 610 | composite_rect(nx.saturating_sub(pad), ny.saturating_sub(pad), w.w + 2 * pad, oh + 2 * pad); | ||
| 610 | } | 611 | } |
| 611 | 612 | ||
| 612 | pub fn owner(id: usize) -> Option<usize> { | 613 | pub fn owner(id: usize) -> Option<usize> { |
