Rebuild Displays around the canvas, and let the transaction keep color

Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
Gabriel Brown
2026-08-24 10:44:11 -04:00
parent 1f694b00b6
commit 9bc68ba358
29 changed files with 3065 additions and 388 deletions
+30
View File
@@ -54,4 +54,34 @@ jq -e '.valid == true
invalid="$(qs_for_harness ipc call display-layout-test invalid)"
jq -e 'all(. == false)' <<<"$invalid" >/dev/null || fail "an invalid layout was accepted: $invalid"
# Mirroring is the one arrangement where the position on file is not the
# position on the desk. Hyprland stacks a mirrored output on its target and
# ignores whatever the rule asked for, so the geometry here has to agree:
# a mirrored display contributes nothing to the desktop's bounds, and the
# canvas draws it on top of what it mirrors rather than at stale coordinates.
mirror="$(qs_for_harness ipc call display-layout-test mirror)"
#
# The mirrored record keeps the coordinates it was stored with -- normalize
# shifts everything by the primary's anchor, and applying that to a position
# nothing reads back would be arithmetic for its own sake. It contributes
# nothing to the bounds, so the desktop measures 3000 x 2000: one display.
jq -e '.valid == true
and .normalized == [
{"name":"DP-2","x":0,"y":0,"primary":true,"mirrorOf":""},
{"name":"HDMI-A-1","x":3140,"y":80,"primary":false,"mirrorOf":"DP-2"}]
and .bounds == {"x":0,"y":0,"width":3000,"height":2000}
and (.rects | length) == 2
and .rects[1].mirrorOf == "DP-2" and .rects[1].mirrored == true
and .rects[0].mirrored == false
and .rects[1].x == .rects[0].x and .rects[1].y == .rects[0].y
and .rects[1].width == .rects[0].width' \
<<<"$mirror" >/dev/null || fail "mirrored geometry was wrong: $mirror"
# A mirror that names itself, an absent output, or a display that is itself
# mirroring is not a layout with a cosmetic problem -- it is one the compositor
# will answer in a way nobody predicted.
invalid_mirrors="$(qs_for_harness ipc call display-layout-test invalidMirrors)"
jq -e 'all(. == false)' <<<"$invalid_mirrors" >/dev/null \
|| fail "an impossible mirror was accepted: $invalid_mirrors"
printf 'display layout contract: PASS\n'