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
@@ -172,6 +172,8 @@ pub(all) enum ShellAction {
|
||||
SetOskVisible(Bool)
|
||||
/// The Rotate panel module asked to set display rotation (0..3).
|
||||
SetRotation(Int)
|
||||
/// The Show Desktop module was clicked: hide the windows, or bring them back (as Super+D).
|
||||
ToggleDesktop
|
||||
} derive(Eq, Debug)
|
||||
|
||||
///| One wasm module loaded into the panel.
|
||||
@@ -289,6 +291,9 @@ pub(all) struct DesktopShell {
|
||||
mut osk_visible : Bool
|
||||
/// Current display rotation 0..3 (published to `rotation`).
|
||||
mut rotation : Int
|
||||
/// What the Show Desktop module is told (the compositor sets it every frame): the windows are
|
||||
/// hidden and another toggle would bring them back.
|
||||
mut desktop_shown : Bool
|
||||
/// The network service (network.mbt), while a module imports `network`.
|
||||
mut net : @network.NetService?
|
||||
mut remember_windows : Bool
|
||||
@@ -468,6 +473,7 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
|
||||
screenshot_state: 2,
|
||||
osk_visible: false,
|
||||
rotation: 0,
|
||||
desktop_shown: false,
|
||||
net: None,
|
||||
remember_windows: true,
|
||||
native_auth_agent: true,
|
||||
|
||||
@@ -855,6 +855,9 @@ fn DesktopShell::publish_host_data(self : DesktopShell) -> Unit {
|
||||
if self.any_cap("rotation") {
|
||||
@wasm.publish_rotation(self.rotation)
|
||||
}
|
||||
if self.any_cap("show-desktop") {
|
||||
@wasm.publish_desktop_shown(self.desktop_shown)
|
||||
}
|
||||
if self.any_cap("battery") {
|
||||
let b = self.battery.refresh()
|
||||
@wasm.publish_battery(b.percent, b.state, b.secs_left)
|
||||
@@ -1033,6 +1036,7 @@ fn DesktopShell::process_requests(self : DesktopShell) -> Unit {
|
||||
Some(GameLibrary(code, game, mode)) => self.gamelib.request(code, game, mode)
|
||||
Some(SetOskVisible(v)) => self.actions.push(SetOskVisible(v))
|
||||
Some(SetRotation(r)) => self.actions.push(SetRotation(r))
|
||||
Some(ToggleDesktop) => self.actions.push(ToggleDesktop)
|
||||
Some(PowerAction(a)) => if a >= 0 && a <= 2 { self.actions.push(SystemPower(a)) }
|
||||
Some(Network(code, ssid, password)) => self.network_request(code, ssid, password)
|
||||
Some(SetInspector(on)) => self.set_inspecting(on)
|
||||
|
||||
Reference in new issue
Block a user