fix(core): focus the activated stashed window over a focused cover dialog
- commit
- 1a341291fb69cfeec52d2600778c49b3d5a972f1
- author
- brice · · 2026-10-12 18:34 UTC
- parent
- 699102b
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +20 -2
M internal/core/floating_test.go +18 -0
| @@ -542,3 +542,21 @@ func TestActivateStashKeepsFullscreenFloat(t *testing.T) { | |||
| 542 | 542 | t.Fatalf("back: focused %d shown %v fullscreen %d", id, w.stashShown(), w.fullscreen) | |
| 543 | 543 | } | |
| 544 | 544 | } | |
| 545 | + | ||
| 546 | + | // With the stash already over the cover and a dialog of the cover | |
| 547 | + | // focused, activating a stashed window focuses it. | |
| 548 | + | func TestActivateStashOverCoverFromCoverDialog(t *testing.T) { | |
| 549 | + | w := workspace() | |
| 550 | + | w.AddWindow(14) | |
| 551 | + | w.ToggleWindowStash() | |
| 552 | + | w.ToggleStashVisible() | |
| 553 | + | w.AddWindow(1) | |
| 554 | + | w.SetFullscreen(1, true) | |
| 555 | + | w.ToggleStashVisible() | |
| 556 | + | w.AddDialog(9, 1, 20, 10) | |
| 557 | + | w.FocusID(9) | |
| 558 | + | w.Activate(14) | |
| 559 | + | if id, _ := w.Focused(); id != 14 || !w.stashOverCover() || w.fullscreen != 1 { | |
| 560 | + | t.Fatalf("focused %d over %v fullscreen %d", id, w.stashOverCover(), w.fullscreen) | |
| 561 | + | } | |
| 562 | + | } | |
| @@ -542,3 +542,21 @@ func TestActivateStashKeepsFullscreenFloat(t *testing.T) { | |||||
| 542 | t.Fatalf("back: focused %d shown %v fullscreen %d", id, w.stashShown(), w.fullscreen) | 542 | t.Fatalf("back: focused %d shown %v fullscreen %d", id, w.stashShown(), w.fullscreen) | ||
| 543 | } | 543 | } | ||
| 544 | } | 544 | } | ||
| 545 | + | ||||
| 546 | + | // With the stash already over the cover and a dialog of the cover | |||
| 547 | + | // focused, activating a stashed window focuses it. | |||
| 548 | + | func TestActivateStashOverCoverFromCoverDialog(t *testing.T) { | |||
| 549 | + | w := workspace() | |||
| 550 | + | w.AddWindow(14) | |||
| 551 | + | w.ToggleWindowStash() | |||
| 552 | + | w.ToggleStashVisible() | |||
| 553 | + | w.AddWindow(1) | |||
| 554 | + | w.SetFullscreen(1, true) | |||
| 555 | + | w.ToggleStashVisible() | |||
| 556 | + | w.AddDialog(9, 1, 20, 10) | |||
| 557 | + | w.FocusID(9) | |||
| 558 | + | w.Activate(14) | |||
| 559 | + | if id, _ := w.Focused(); id != 14 || !w.stashOverCover() || w.fullscreen != 1 { | |||
| 560 | + | t.Fatalf("focused %d over %v fullscreen %d", id, w.stashOverCover(), w.fullscreen) | |||
| 561 | + | } | |||
| 562 | + | } | |||
M internal/core/layout.go +2 -2
| @@ -1240,9 +1240,9 @@ func (w *Workspace) leaveFullscreen() { | |||
| 1240 | 1240 | func (w *Workspace) Activate(id WindowID) { | |
| 1241 | 1241 | if i := w.stashIndex(id); i >= 0 && w.coverStays(id) { | |
| 1242 | 1242 | if !w.stashOverCover() { | |
| 1243 | - | w.stashOver, w.stashHidden, w.floatFocus = w.cover(), false, false | |
| 1243 | + | w.stashOver, w.stashHidden = w.cover(), false | |
| 1244 | 1244 | } | |
| 1245 | - | w.stashAt, w.stashFocus = i, true | |
| 1245 | + | w.stashAt, w.stashFocus, w.floatFocus = i, true, false | |
| 1246 | 1246 | w.focusModal(0) | |
| 1247 | 1247 | return | |
| 1248 | 1248 | } | |
| @@ -1240,9 +1240,9 @@ func (w *Workspace) leaveFullscreen() { | |||||
| 1240 | func (w *Workspace) Activate(id WindowID) { | 1240 | func (w *Workspace) Activate(id WindowID) { | ||
| 1241 | if i := w.stashIndex(id); i >= 0 && w.coverStays(id) { | 1241 | if i := w.stashIndex(id); i >= 0 && w.coverStays(id) { | ||
| 1242 | if !w.stashOverCover() { | 1242 | if !w.stashOverCover() { | ||
| 1243 | - | w.stashOver, w.stashHidden, w.floatFocus = w.cover(), false, false | 1243 | + | w.stashOver, w.stashHidden = w.cover(), false |
| 1244 | } | 1244 | } | ||
| 1245 | - | w.stashAt, w.stashFocus = i, true | 1245 | + | w.stashAt, w.stashFocus, w.floatFocus = i, true, false |
| 1246 | w.focusModal(0) | 1246 | w.focusModal(0) | ||
| 1247 | return | 1247 | return | ||
| 1248 | } | 1248 | } | ||