Panel: add a Show Desktop module at the panel's end
- Clicking it hides every window, as Super+D does; it stays lit while the desktop is shown. - A second click brings the hidden windows back. - New show-desktop capability (wit toggle and publish-desktop-shown) for the wasm module. - Added to the default panel after session settings; existing panels are unchanged. - Test covers hiding, the lit state, and restoring the windows.
This commit is contained in:
1 parent
51852f0dac
commit
44bb77871d
31 files changed
+869
-49
No files matched your search
@@ -1460,6 +1460,41 @@ test "super+d minimizes every window to show the desktop, and again brings them
|
||||
assert_false(comp.wm.windows.get(2UL).unwrap().minimized)
|
||||
}
|
||||
|
||||
///|
|
||||
test "the show desktop module hides the windows, lights up, and a second click brings them back" {
|
||||
let socket_path = "/tmp/wayland-moon-showdesk-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
assert_true(comp.shell.load_module("show-desktop"))
|
||||
ignore(comp.compose_frame())
|
||||
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
|
||||
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
|
||||
ignore(comp.compose_frame())
|
||||
// Lit (the accent behind the icon) only while the desktop is shown.
|
||||
let lit = fn() {
|
||||
match comp.shell.slot_ops(comp.shell.slot_of("show-desktop")) {
|
||||
[FillRect(f), ..] => {
|
||||
let a = comp.shell.tokens.palette.accent
|
||||
f.color.r == a.r && f.color.g == a.g && f.color.b == a.b
|
||||
}
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
assert_false(lit())
|
||||
click_module(comp, "show-desktop", 1U)
|
||||
assert_true(comp.wm.windows.get(1UL).unwrap().minimized)
|
||||
assert_true(comp.wm.windows.get(2UL).unwrap().minimized)
|
||||
assert_true(comp.desktop_shown())
|
||||
ignore(comp.compose_frame())
|
||||
assert_true(lit())
|
||||
click_module(comp, "show-desktop", 10U)
|
||||
assert_false(comp.wm.windows.get(1UL).unwrap().minimized)
|
||||
assert_false(comp.wm.windows.get(2UL).unwrap().minimized)
|
||||
assert_false(comp.desktop_shown())
|
||||
ignore(comp.compose_frame())
|
||||
assert_false(lit())
|
||||
}
|
||||
|
||||
///| Click (x, y) without drawing, then return the next scene's wallpaper op count (0: no new scene).
|
||||
fn click_wallpaper_ops(comp : @host.ChandraCompositor, x : Int, y : Int, t : UInt) -> Int {
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(x.to_double(), y.to_double()), t)
|
||||
|
||||
Reference in new issue
Block a user