test(core): keep the cascade overview stash inside the area on every output size
- commit
- bafc122c49b1dc28d58a03698ec34ca8ef9dda41
- author
- brice · · 2026-10-14 19:53 UTC
- parent
- 594ac4d
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +20 -1
M internal/core/overview.go +3 -1
| @@ -847,7 +847,9 @@ func (w *Workspace) pile(axis layoutAxis, slot Rect, dim bool, front int) []Plac | |||
| 847 | 847 | var x0, y0 int | |
| 848 | 848 | if axis == horizontalAxis { | |
| 849 | 849 | // Centred on the row, across the bottom edge of the selected | |
| 850 | - | // lane, which is centred in the slot. | |
| 850 | + | // lane, which is centred in the slot. Both scale with the area | |
| 851 | + | // (the lane at most overviewMaxZoom of it), so the pile stays | |
| 852 | + | // inside whatever its size. | |
| 851 | 853 | x0 = slot.X + (slot.W-cw)/2 | |
| 852 | 854 | y0 = slot.Y + (slot.H-rowH)/2 + rowH - ch/2 | |
| 853 | 855 | } else { | |
| @@ -847,7 +847,9 @@ func (w *Workspace) pile(axis layoutAxis, slot Rect, dim bool, front int) []Plac | |||||
| 847 | var x0, y0 int | 847 | var x0, y0 int | ||
| 848 | if axis == horizontalAxis { | 848 | if axis == horizontalAxis { | ||
| 849 | // Centred on the row, across the bottom edge of the selected | 849 | // Centred on the row, across the bottom edge of the selected | ||
| 850 | - | // lane, which is centred in the slot. | 850 | + | // lane, which is centred in the slot. Both scale with the area |
| 851 | + | // (the lane at most overviewMaxZoom of it), so the pile stays | |||
| 852 | + | // inside whatever its size. | |||
| 851 | x0 = slot.X + (slot.W-cw)/2 | 853 | x0 = slot.X + (slot.W-cw)/2 | ||
| 852 | y0 = slot.Y + (slot.H-rowH)/2 + rowH - ch/2 | 854 | y0 = slot.Y + (slot.H-rowH)/2 + rowH - ch/2 | ||
| 853 | } else { | 855 | } else { | ||
M internal/core/overview_cascade_test.go +17 -0
| @@ -538,6 +538,23 @@ func TestOverviewCascadeNamedDivider(t *testing.T) { | |||
| 538 | 538 | } | |
| 539 | 539 | } | |
| 540 | 540 | ||
| 541 | + | // The pile stays inside the area, down to a tiny output. | |
| 542 | + | func TestOverviewCascadeStashInsideArea(t *testing.T) { | |
| 543 | + | for _, size := range [][2]int{{300, 200}, {1920, 1080}, {1080, 1920}, {3440, 1440}, {60, 40}} { | |
| 544 | + | m := cascadeOverview() | |
| 545 | + | m.SetOutput(size[0], size[1]) | |
| 546 | + | withStash(m, 4) | |
| 547 | + | m.ToggleOverview() | |
| 548 | + | u := m.Current().overviewArea() | |
| 549 | + | for _, id := range []WindowID{40, 41, 42, 43} { | |
| 550 | + | p := previewOf(t, m.Layout(), id) | |
| 551 | + | if !p.Hidden && (p.Rect.Y < u.Y || p.Rect.Y+p.Rect.H > u.Y+u.H || p.Rect.X < u.X || p.Rect.X+p.Rect.W > u.X+u.W) { | |
| 552 | + | t.Fatalf("%v: card %d %v outside %v", size, id, p.Rect, u) | |
| 553 | + | } | |
| 554 | + | } | |
| 555 | + | } | |
| 556 | + | } | |
| 557 | + | ||
| 541 | 558 | // A stash takes no room in a cascade overview, on a neighbor either: a | |
| 542 | 559 | // wide scroll workspace beside it keeps its zoom and slot. | |
| 543 | 560 | func TestOverviewCascadeNeighborStashKeepsSlot(t *testing.T) { | |
| @@ -538,6 +538,23 @@ func TestOverviewCascadeNamedDivider(t *testing.T) { | |||||
| 538 | } | 538 | } | ||
| 539 | } | 539 | } | ||
| 540 | 540 | ||||
| 541 | + | // The pile stays inside the area, down to a tiny output. | |||
| 542 | + | func TestOverviewCascadeStashInsideArea(t *testing.T) { | |||
| 543 | + | for _, size := range [][2]int{{300, 200}, {1920, 1080}, {1080, 1920}, {3440, 1440}, {60, 40}} { | |||
| 544 | + | m := cascadeOverview() | |||
| 545 | + | m.SetOutput(size[0], size[1]) | |||
| 546 | + | withStash(m, 4) | |||
| 547 | + | m.ToggleOverview() | |||
| 548 | + | u := m.Current().overviewArea() | |||
| 549 | + | for _, id := range []WindowID{40, 41, 42, 43} { | |||
| 550 | + | p := previewOf(t, m.Layout(), id) | |||
| 551 | + | if !p.Hidden && (p.Rect.Y < u.Y || p.Rect.Y+p.Rect.H > u.Y+u.H || p.Rect.X < u.X || p.Rect.X+p.Rect.W > u.X+u.W) { | |||
| 552 | + | t.Fatalf("%v: card %d %v outside %v", size, id, p.Rect, u) | |||
| 553 | + | } | |||
| 554 | + | } | |||
| 555 | + | } | |||
| 556 | + | } | |||
| 557 | + | ||||
| 541 | // A stash takes no room in a cascade overview, on a neighbor either: a | 558 | // A stash takes no room in a cascade overview, on a neighbor either: a | ||
| 542 | // wide scroll workspace beside it keeps its zoom and slot. | 559 | // wide scroll workspace beside it keeps its zoom and slot. | ||
| 543 | func TestOverviewCascadeNeighborStashKeepsSlot(t *testing.T) { | 560 | func TestOverviewCascadeNeighborStashKeepsSlot(t *testing.T) { | ||