Skip to content

fix(desktop): shrink-clamp escaping windows and refit maximized on work-area change (#30) - #34

Merged
Xuepoo merged 3 commits into
mainfrom
carryctx/web-0038-dpr-clamp
Aug 25, 2026
Merged

Xuepoo merged 3 commits into
mainfrom
carryctx/web-0038-dpr-clamp

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Closes #30.

DPR/display-change window stranding fixes (audit WEB-0038):

  • New pure clampRect (shrink-then-pin, engine DisplayLayout.clampRect semantics + DEC-0021 min-floor deviation) in src/model/window-geometry.ts; clampWindowsToWorkArea delegates via src/desktop/window-refit.ts — oversized windows now SHRINK to the work area instead of overflowing bottom/right forever.
  • fit() refits maximized windows after shell.resize (compensates engine E1: DesktopShell.resize leaves maximized boxes stale).
  • wm-stream re-clamp gated to state events only (restore/un-minimize) — focus/open/close never yank user-parked partially-off-screen windows (engine drag permits titlebar+48px visible parking).
  • Zero/negative-area edge floored to 1px pinned at area origin (tested; documented deviation).
  • Engine findings E1-E4 filed upstream (vectojs-docs 794340f+b94616a): maximized refit gap, unclamped restore replay, DPR-less glyph cache keys, (resolution) mq coverage.

Gates: 163 pass / 0 fail · tsc · oxlint · oxfmt (repo-wide) · build · review round + 3-finding fix round complete.

Xuepoo added 3 commits August 25, 2026 12:28
…rk-area change (#30)

Viewport/DPR changes stranded windows outside the reachable work area
(audit WEB-0038). Three compensations for engine gaps filed upstream in
vectojs-docs forge/findings (commit 794340f):

- clampRect in model/window-geometry mirrors the engine's
  DisplayLayout.clampRect shrink-then-pin semantics (with optional min
  floors): a position-only clamp left windows taller/wider than a
  shrunken work area stranded past the bottom/right forever (4/5 windows
  outside at 568x315).
- fit() re-applies maximize after shell.resize so maximized windows track
  the new work area instead of keeping their stale pre-shrink box (E1,
  measured 1280x760 in a 568x355 viewport).
- every window-manager event re-runs the clamp so restore()'s stale
  pre-maximize box is pulled back inside immediately (E2).
…area (#30)

Review round PX-0159..0163 on WEB-0038:

- Restrict the window-manager stream clamp to "state" events
  (clampWindowsOnEvent): engine drag deliberately parks windows mostly
  off-screen (titlebar + 48px visible, Window.clampMovePosition), so an
  unrelated open/focus/close event must not yank them back on-screen.
  Restore/un-minimize still emit "state" and keep the E2 stale-box
  correction.
- Cover the zero-height work-area edge: clampRect floors to a 1px box
  pinned at area.y, the documented DEC-0021 app-side deviation from the
  engine's applyGeom re-flooring.
- Dist contract: pin the drag-parking permission so an engine change
  that forbids parking surfaces here before the event gate is relaxed.

Rebased onto origin/main 8689e79 (#31): guardTaskbar dropped (the
WebOS-owned taskbar self-subscribes to the wm stream), refitMaximized
kept in fit(), and the per-era setTaskbar sync composes with the
work-area clamp unchanged (applyTheme re-clamps after setTaskbar).
Restores oxfmt-canonical single-quote formatting in main.ts and
window-geometry.test.ts after an external editor session re-saved them
with Biome defaults.
@Xuepoo
Xuepoo merged commit b326ef9 into main Aug 25, 2026
4 checks passed
Xuepoo added a commit that referenced this pull request Aug 25, 2026
* fix(apps): audit-3 surgical batch (#33)

- Paint: Clear hit-tested standalone; it was swallowed by the swatch
  find, so clicks never cleared and set currentColor=''. The palette
  now holds colors-only swatches.
- Windows: re-open the N/NW/NE resize rim above the titlebar drag
  handle via an instance hit-test predicate that survives engine
  applyGeom; maximized/dialog keep the full handle for restore-drag.
- Shell: one-shot work-area re-clamp of just-restored windows on
  gesture end - the engine drops the restored box under the cursor
  unclamped; WEB-0038's clampWindowsToWorkArea untouched.
- Files: inner list viewport binds to the window client height with a
  120px floor instead of a fixed 150px strip.
- Browser: address bar selects its text on focus so typing replaces.

* fix(desktop): bound restore re-clamp to live pointer gestures (#33)

Audit review follow-up (LOW 1 + LOW 2, notes PX-0185..0193), rebased onto
origin/main b326ef9 (WEB-0038 #34):

- Keyboard/taskbar restores no longer leave an armed pendingRestoreClamp
  that would fire at an arbitrary later pointerup anywhere. A document-
  level gesture flag arms deferral only while a pointer is actually down;
  restores arriving outside a gesture re-clamp immediately. The flag resets
  before reclamp's empty-pending early-return so it cannot wedge true.
- A window closed mid-gesture is dropped from both trackers on the wm
  close event, so the next pointerup can never setGeometry a destroyed
  instance.
- Rebase kept both window-manager handlers (WEB-0038's gated shrink clamp
  and this branch's chrome/arming handler are independent) and restored
  the clampPosition import the auto-merge silently dropped.

Covered by three smoke tests: pointer restore still waits for gesture end
(via pointercancel), keyboard restore consumes its clamp at arm time, and
a mid-gesture close produces zero geometry writes on the dead instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Windows strand outside the reachable work area after viewport/DPR changes (maximized refit, oversize shrink, restore clamp)

1 participant