Task manager: right-click a window's pill for Minimize/Restore, Maximize, Quit
CI / test (push) Failing after 16s

- Right-clicking a pill in the task manager opens that window's menu (titled with the window's
  title): Minimize (Restore when minimized), Maximize (Restore size when maximized) and Quit,
  which asks the app to close the window (xdg_toplevel close, like the title-bar close button).
  Empty task-bar space keeps the module's own menu (Module settings, Replace with, Remove widget).
- Modules only get left clicks, so the shell draws the menu and hit-tests the pills itself: the
  pill geometry moved to lib/panel/tasks.mbt, shared by the tasks module and the shell. No WIT
  change, so every host works as before.
- New menu row kind 6 and ShellAction::Window(id, WindowCommand); the compositor runs it through
  the same WM requests as the title-bar buttons. WinInfo carries `maximized`.
- Tests: native end-to-end (menu rows, minimize/restore, maximize/restore size, Quit sends close,
  empty space keeps the module menu) and lib/panel pill geometry tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiX13fXK1eMboRe5oQ
This commit is contained in:
Claude committed 2026-11-25 20:13:38 +00:00
1 parent f33f84c35b
commit f844ac66ff
9 files changed
+238 -35

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
///| Where the task manager (components/tasks) puts its window pills. It lives here, not in the
/// module, because the shell needs the same geometry to know which window a right-click hit: the
/// shell draws that window's menu (Quit, Minimize, Maximize) itself, since modules only get left
/// clicks.
///| Widest a pill gets, the gap between pills, and the narrowest before titles stop being readable.
pub let task_pill_max : Int = 140
///|
pub let task_pill_gap : Int = 6
///|
pub let task_pill_min : Int = 56
///| Pill width for `n` windows in a task bar `w` wide.
pub fn task_pill_w(n : Int, w : Int) -> Int {
if n <= 0 {
return task_pill_max
}
let fit = (w - task_pill_gap * (n - 1)) / n
if fit > task_pill_max {
task_pill_max
} else if fit < task_pill_min {
task_pill_min
} else {
fit
}
}
///| The pill (an index into the windows in opening order) under a task-bar-local `x`, or -1, for
/// `n` windows in a bar `w` wide. Pills that would start past the bar's end aren't drawn.
pub fn task_pill_at(x : Int, n : Int, w : Int) -> Int {
let pw = task_pill_w(n, w)
if x < 0 || x >= w {
return -1
}
let i = x / (pw + task_pill_gap)
if i < n && x - i * (pw + task_pill_gap) < pw {
i
} else {
-1
}
}