moon-plasma / moonplasma / MoonPlasma / Moon Plasma become chandra / Chandra everywhere: the WIT package (chandra:desktop, chandra:host, chandra:wm), the MoonBit module (chandra/desktop) and generated bindings, the Rust host, identifiers (ChandraCompositor), the session script (chandra-session) and desktop entry (chandra.desktop), config and data paths ($XDG_CONFIG_HOME/chandra, share/chandra/modules), env vars (CHANDRA_*), UI strings, docs and tests. The test fixture components are rebuilt against the renamed WIT. Saved panel.edn and state.edn are still read from the old $XDG_CONFIG_HOME/moon-plasma until the first save writes the new copy. The remote repository keeps its experiments/moon-plasma name for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hi3L9oVBoRd373Qr4n
This commit is contained in:
323 files changed
+1055
-1013
No files matched your search
@@ -27,7 +27,7 @@ pub(all) struct HostPopup {
|
||||
}
|
||||
|
||||
///|
|
||||
pub(all) struct MoonPlasmaCompositor {
|
||||
pub(all) struct ChandraCompositor {
|
||||
/// Open popups, oldest first (the last is topmost).
|
||||
popups : Array[HostPopup]
|
||||
server : @wayland.WaylandServer
|
||||
@@ -74,12 +74,12 @@ pub(all) struct MoonPlasmaCompositor {
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn MoonPlasmaCompositor::new(
|
||||
pub fn ChandraCompositor::new(
|
||||
socket_path : String,
|
||||
theme : @scene.ThemeTokens,
|
||||
output_w : Int,
|
||||
output_h : Int,
|
||||
) -> MoonPlasmaCompositor? {
|
||||
) -> ChandraCompositor? {
|
||||
ignore(@font.install()) // Adwaita Mono; keeps the bitmap font if it's missing
|
||||
let server = match @wayland.WaylandServer::listen(socket_path, output_w, output_h) {
|
||||
Some(s) => s
|
||||
@@ -141,7 +141,7 @@ fn work_area_for(w : Int, h : Int, theme : @scene.ThemeTokens) -> @wm.Rect {
|
||||
|
||||
///| The output changed size (the nested window was resized, maximized or made fullscreen):
|
||||
/// lay the desktop out for the new size, so nothing is drawn past the edge and cropped away.
|
||||
pub fn MoonPlasmaCompositor::resize(self : MoonPlasmaCompositor, w : Int, h : Int) -> Unit {
|
||||
pub fn ChandraCompositor::resize(self : ChandraCompositor, w : Int, h : Int) -> Unit {
|
||||
if w <= 0 || h <= 0 || (w == self.output_w && h == self.output_h) {
|
||||
return
|
||||
}
|
||||
@@ -158,7 +158,7 @@ pub fn MoonPlasmaCompositor::resize(self : MoonPlasmaCompositor, w : Int, h : In
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn MoonPlasmaCompositor::close(self : MoonPlasmaCompositor) -> Unit {
|
||||
pub fn ChandraCompositor::close(self : ChandraCompositor) -> Unit {
|
||||
for _, win in self.windows {
|
||||
release_snapshot(win.surface)
|
||||
}
|
||||
@@ -184,8 +184,8 @@ pub(all) struct FrameSig {
|
||||
}
|
||||
|
||||
///|
|
||||
fn MoonPlasmaCompositor::apply_actions(
|
||||
self : MoonPlasmaCompositor,
|
||||
fn ChandraCompositor::apply_actions(
|
||||
self : ChandraCompositor,
|
||||
actions : Array[@wm.WmAction],
|
||||
) -> Unit {
|
||||
for act in actions {
|
||||
@@ -236,7 +236,7 @@ fn MoonPlasmaCompositor::apply_actions(
|
||||
}
|
||||
|
||||
///| Send the size changes coalesced during a divider drag.
|
||||
fn MoonPlasmaCompositor::flush_configures(self : MoonPlasmaCompositor) -> Unit {
|
||||
fn ChandraCompositor::flush_configures(self : ChandraCompositor) -> Unit {
|
||||
for wid, win in self.windows {
|
||||
if win.cfg_dirty {
|
||||
win.cfg_dirty = false
|
||||
@@ -253,7 +253,7 @@ fn MoonPlasmaCompositor::flush_configures(self : MoonPlasmaCompositor) -> Unit {
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn MoonPlasmaCompositor::step(self : MoonPlasmaCompositor) -> Unit {
|
||||
pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
self.flush_configures()
|
||||
let events = self.server.poll_events()
|
||||
for ev in events {
|
||||
@@ -398,8 +398,8 @@ pub fn MoonPlasmaCompositor::step(self : MoonPlasmaCompositor) -> Unit {
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn MoonPlasmaCompositor::set_layout_mode(
|
||||
self : MoonPlasmaCompositor,
|
||||
pub fn ChandraCompositor::set_layout_mode(
|
||||
self : ChandraCompositor,
|
||||
mode : @wm.LayoutMode,
|
||||
) -> Unit {
|
||||
self.layout_mode = mode
|
||||
@@ -416,7 +416,7 @@ pub fn MoonPlasmaCompositor::set_layout_mode(
|
||||
|
||||
///| Restore what the last session left (layout mode, recent apps) from state.edn. Call once,
|
||||
/// after turning `shell.persist` on; a no-op without persistence.
|
||||
pub fn MoonPlasmaCompositor::restore_state(self : MoonPlasmaCompositor) -> Unit {
|
||||
pub fn ChandraCompositor::restore_state(self : ChandraCompositor) -> Unit {
|
||||
let st = self.shell.load_state()
|
||||
self.shell.apply_state(st)
|
||||
match st.layout {
|
||||
@@ -428,8 +428,8 @@ pub fn MoonPlasmaCompositor::restore_state(self : MoonPlasmaCompositor) -> Unit
|
||||
}
|
||||
|
||||
///|
|
||||
fn MoonPlasmaCompositor::build_scene(
|
||||
self : MoonPlasmaCompositor,
|
||||
fn ChandraCompositor::build_scene(
|
||||
self : ChandraCompositor,
|
||||
) -> (@scene.SceneGraph, Bool) {
|
||||
self.flush_configures()
|
||||
let scene = @scene.SceneGraph::new(self.output_w, self.output_h)
|
||||
@@ -545,8 +545,8 @@ fn MoonPlasmaCompositor::build_scene(
|
||||
|
||||
///| Compose the desktop for the host rasteriser (the wasm compositor): the scene to draw, or None
|
||||
/// when nothing changed since the last one, so an idle desktop costs nothing to draw or present.
|
||||
pub fn MoonPlasmaCompositor::compose_scene(
|
||||
self : MoonPlasmaCompositor,
|
||||
pub fn ChandraCompositor::compose_scene(
|
||||
self : ChandraCompositor,
|
||||
) -> @scene.SceneGraph? {
|
||||
let (scene, changed) = self.build_scene()
|
||||
self.frame_changed = changed
|
||||
@@ -555,8 +555,8 @@ pub fn MoonPlasmaCompositor::compose_scene(
|
||||
|
||||
///| Compose the desktop and draw it with the software renderer (the native build and the tests).
|
||||
/// An unchanged desktop hands back the previous pixels instead of rasterising them again.
|
||||
pub fn MoonPlasmaCompositor::compose_frame(
|
||||
self : MoonPlasmaCompositor,
|
||||
pub fn ChandraCompositor::compose_frame(
|
||||
self : ChandraCompositor,
|
||||
) -> @renderer.Pixmap {
|
||||
let (scene, changed) = self.build_scene()
|
||||
match self.last_frame {
|
||||
@@ -578,8 +578,8 @@ pub fn MoonPlasmaCompositor::compose_frame(
|
||||
///|
|
||||
/// Compose the current desktop GUI frame and present it onto a wasi-gfx
|
||||
/// `SurfaceFrameBufferContext`.
|
||||
pub fn MoonPlasmaCompositor::present_to_gfx(
|
||||
self : MoonPlasmaCompositor,
|
||||
pub fn ChandraCompositor::present_to_gfx(
|
||||
self : ChandraCompositor,
|
||||
ctx : @gfx.SurfaceFrameBufferContext,
|
||||
) -> @renderer.Pixmap {
|
||||
let pixmap = self.compose_frame()
|
||||
@@ -591,8 +591,8 @@ pub fn MoonPlasmaCompositor::present_to_gfx(
|
||||
|
||||
///|
|
||||
/// Process pending wasi-gfx surface input events (pointer clicks for focus).
|
||||
pub fn MoonPlasmaCompositor::handle_gfx_events(
|
||||
self : MoonPlasmaCompositor,
|
||||
pub fn ChandraCompositor::handle_gfx_events(
|
||||
self : ChandraCompositor,
|
||||
surface : @gfx.Surface,
|
||||
) -> Unit {
|
||||
let downs = surface.drain_pointer_down()
|
||||
@@ -624,7 +624,7 @@ pub fn MoonPlasmaCompositor::handle_gfx_events(
|
||||
|
||||
|
||||
///| Content origin of a window or popup.
|
||||
fn MoonPlasmaCompositor::origin_of(self : MoonPlasmaCompositor, wid : UInt64) -> (Int, Int) {
|
||||
fn ChandraCompositor::origin_of(self : ChandraCompositor, wid : UInt64) -> (Int, Int) {
|
||||
match self.windows.get(wid) {
|
||||
Some(win) => (win.geometry.x, win.geometry.y)
|
||||
None => {
|
||||
@@ -640,7 +640,7 @@ fn MoonPlasmaCompositor::origin_of(self : MoonPlasmaCompositor, wid : UInt64) ->
|
||||
}
|
||||
|
||||
///| Absolute rectangle of a popup, nudged to stay on screen.
|
||||
fn MoonPlasmaCompositor::popup_rect(self : MoonPlasmaCompositor, p : HostPopup) -> @scene.Rect {
|
||||
fn ChandraCompositor::popup_rect(self : ChandraCompositor, p : HostPopup) -> @scene.Rect {
|
||||
let (w, h) = match p.surface {
|
||||
Some(s) => (s.width, s.height)
|
||||
None => (p.w, p.h)
|
||||
@@ -654,7 +654,7 @@ fn MoonPlasmaCompositor::popup_rect(self : MoonPlasmaCompositor, p : HostPopup)
|
||||
}
|
||||
|
||||
///|
|
||||
fn MoonPlasmaCompositor::origin_of_parent(self : MoonPlasmaCompositor, p : HostPopup) -> (Int, Int) {
|
||||
fn ChandraCompositor::origin_of_parent(self : ChandraCompositor, p : HostPopup) -> (Int, Int) {
|
||||
if p.parent == p.id {
|
||||
(0, 0)
|
||||
} else {
|
||||
@@ -663,7 +663,7 @@ fn MoonPlasmaCompositor::origin_of_parent(self : MoonPlasmaCompositor, p : HostP
|
||||
}
|
||||
|
||||
///| Top-most popup under (x, y).
|
||||
fn MoonPlasmaCompositor::popup_at(self : MoonPlasmaCompositor, x : Int, y : Int) -> HostPopup? {
|
||||
fn ChandraCompositor::popup_at(self : ChandraCompositor, x : Int, y : Int) -> HostPopup? {
|
||||
let mut i = self.popups.length() - 1
|
||||
while i >= 0 {
|
||||
let p = self.popups[i]
|
||||
@@ -677,7 +677,7 @@ fn MoonPlasmaCompositor::popup_at(self : MoonPlasmaCompositor, x : Int, y : Int)
|
||||
}
|
||||
|
||||
///| The toplevel a popup chain hangs off (for returning keyboard focus).
|
||||
fn MoonPlasmaCompositor::popup_root(self : MoonPlasmaCompositor, wid : UInt64) -> UInt64? {
|
||||
fn ChandraCompositor::popup_root(self : ChandraCompositor, wid : UInt64) -> UInt64? {
|
||||
let mut cur = wid
|
||||
let mut n = 0
|
||||
while n < 16 {
|
||||
@@ -700,7 +700,7 @@ fn MoonPlasmaCompositor::popup_root(self : MoonPlasmaCompositor, wid : UInt64) -
|
||||
}
|
||||
|
||||
///| Forget a popup (and any popups hanging off it); give keyboard focus back to its window.
|
||||
fn MoonPlasmaCompositor::close_popup(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
|
||||
fn ChandraCompositor::close_popup(self : ChandraCompositor, wid : UInt64) -> Unit {
|
||||
let mut found = false
|
||||
for p in self.popups {
|
||||
if p.id == wid {
|
||||
@@ -735,7 +735,7 @@ fn MoonPlasmaCompositor::close_popup(self : MoonPlasmaCompositor, wid : UInt64)
|
||||
}
|
||||
|
||||
///| Send pointer enter/motion for a popup under the pointer.
|
||||
fn MoonPlasmaCompositor::pointer_into_popup(self : MoonPlasmaCompositor, p : HostPopup, time_ms : UInt, motion : Bool) -> Unit {
|
||||
fn ChandraCompositor::pointer_into_popup(self : ChandraCompositor, p : HostPopup, time_ms : UInt, motion : Bool) -> Unit {
|
||||
let r = self.popup_rect(p)
|
||||
let lx = self.ptr_x - r.x.to_double()
|
||||
let ly = self.ptr_y - r.y.to_double()
|
||||
@@ -750,7 +750,7 @@ fn MoonPlasmaCompositor::pointer_into_popup(self : MoonPlasmaCompositor, p : Hos
|
||||
}
|
||||
|
||||
///| Move keyboard focus (wl_keyboard leave/enter + current modifiers).
|
||||
fn MoonPlasmaCompositor::set_kbd_focus(self : MoonPlasmaCompositor, wid : UInt64?) -> Unit {
|
||||
fn ChandraCompositor::set_kbd_focus(self : ChandraCompositor, wid : UInt64?) -> Unit {
|
||||
if self.kbd_win == wid {
|
||||
return
|
||||
}
|
||||
@@ -769,7 +769,7 @@ fn MoonPlasmaCompositor::set_kbd_focus(self : MoonPlasmaCompositor, wid : UInt64
|
||||
}
|
||||
|
||||
///| Top-most window under (x, y): (id, in client area). The titlebar counts as the window but not the client.
|
||||
fn MoonPlasmaCompositor::window_at(self : MoonPlasmaCompositor, x : Int, y : Int) -> (UInt64, Bool)? {
|
||||
fn ChandraCompositor::window_at(self : ChandraCompositor, x : Int, y : Int) -> (UInt64, Bool)? {
|
||||
let order = self.wm.stacking_order()
|
||||
let mut i = order.length() - 1
|
||||
while i >= 0 {
|
||||
@@ -793,8 +793,8 @@ fn MoonPlasmaCompositor::window_at(self : MoonPlasmaCompositor, x : Int, y : Int
|
||||
///| Resize zone under (x, y) on a floating window: its corners (12px) and left/right/bottom
|
||||
/// edges. The first window whose outer box contains the point decides; tiled windows resize
|
||||
/// through the dividers instead.
|
||||
fn MoonPlasmaCompositor::resize_at(
|
||||
self : MoonPlasmaCompositor,
|
||||
fn ChandraCompositor::resize_at(
|
||||
self : ChandraCompositor,
|
||||
x : Int,
|
||||
y : Int,
|
||||
) -> (UInt64, @wm.DragMode)? {
|
||||
@@ -852,8 +852,8 @@ fn MoonPlasmaCompositor::resize_at(
|
||||
|
||||
///| Title-bar button under (x, y) for window `wid`: 1 minimize, 2 maximize, 3 close, 0 none.
|
||||
/// Mirrors the layout in `build_breeze_decoration` (18px buttons, 8px apart, 10px from the right edge).
|
||||
fn MoonPlasmaCompositor::title_button_at(
|
||||
self : MoonPlasmaCompositor,
|
||||
fn ChandraCompositor::title_button_at(
|
||||
self : ChandraCompositor,
|
||||
wid : UInt64,
|
||||
x : Int,
|
||||
y : Int,
|
||||
@@ -887,8 +887,8 @@ fn MoonPlasmaCompositor::title_button_at(
|
||||
}
|
||||
|
||||
///| Activate the title-bar button `btn` of window `wid`.
|
||||
fn MoonPlasmaCompositor::press_title_button(
|
||||
self : MoonPlasmaCompositor,
|
||||
fn ChandraCompositor::press_title_button(
|
||||
self : ChandraCompositor,
|
||||
wid : UInt64,
|
||||
btn : Int,
|
||||
) -> Unit {
|
||||
@@ -920,14 +920,14 @@ fn MoonPlasmaCompositor::press_title_button(
|
||||
|
||||
///| Focus a window and bring it to the front through the window manager, so its stacking
|
||||
/// order (not just the drawing) changes.
|
||||
fn MoonPlasmaCompositor::activate_window(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
|
||||
fn ChandraCompositor::activate_window(self : ChandraCompositor, wid : UInt64) -> Unit {
|
||||
self.apply_actions(
|
||||
self.wm.handle_request(wid, @wm.WindowRequest::Activate, self.work_area),
|
||||
)
|
||||
}
|
||||
|
||||
///| Restore a minimized window (or focus a visible one) from its task-bar pill.
|
||||
fn MoonPlasmaCompositor::activate_task(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
|
||||
fn ChandraCompositor::activate_task(self : ChandraCompositor, wid : UInt64) -> Unit {
|
||||
let minimized = match self.wm.windows.get(wid) {
|
||||
Some(r) => r.minimized
|
||||
None => return
|
||||
@@ -943,7 +943,7 @@ fn MoonPlasmaCompositor::activate_task(self : MoonPlasmaCompositor, wid : UInt64
|
||||
}
|
||||
|
||||
///| Carry out what panel modules asked for: focus a window, switch layout.
|
||||
fn MoonPlasmaCompositor::run_shell_actions(self : MoonPlasmaCompositor) -> Unit {
|
||||
fn ChandraCompositor::run_shell_actions(self : ChandraCompositor) -> Unit {
|
||||
for a in self.shell.take_actions() {
|
||||
match a {
|
||||
@shell.ShellAction::FocusWindow(wid) => self.activate_task(wid)
|
||||
@@ -960,8 +960,8 @@ fn MoonPlasmaCompositor::run_shell_actions(self : MoonPlasmaCompositor) -> Unit
|
||||
}
|
||||
|
||||
///| Tiling divider under (x, y), with a few pixels of slack either side.
|
||||
fn MoonPlasmaCompositor::handle_at(
|
||||
self : MoonPlasmaCompositor,
|
||||
fn ChandraCompositor::handle_at(
|
||||
self : ChandraCompositor,
|
||||
x : Int,
|
||||
y : Int,
|
||||
) -> @wm.SplitHandle? {
|
||||
@@ -982,7 +982,7 @@ fn MoonPlasmaCompositor::handle_at(
|
||||
}
|
||||
|
||||
///|
|
||||
fn MoonPlasmaCompositor::leave_pointer(self : MoonPlasmaCompositor) -> Unit {
|
||||
fn ChandraCompositor::leave_pointer(self : ChandraCompositor) -> Unit {
|
||||
match self.ptr_win {
|
||||
Some(w) => {
|
||||
self.server.pointer_leave(w)
|
||||
@@ -1025,8 +1025,8 @@ fn key_name(code : UInt, shift : Bool) -> String {
|
||||
|
||||
///| Route host input: shell (launcher) first, then the window under the pointer
|
||||
/// / the keyboard-focused window.
|
||||
pub fn MoonPlasmaCompositor::handle_input(
|
||||
self : MoonPlasmaCompositor,
|
||||
pub fn ChandraCompositor::handle_input(
|
||||
self : ChandraCompositor,
|
||||
ev : @nested.InputEvent,
|
||||
time_ms : UInt,
|
||||
) -> Unit {
|
||||
@@ -1307,7 +1307,7 @@ pub fn MoonPlasmaCompositor::handle_input(
|
||||
|
||||
///| Cursor shape (wp_cursor_shape_v1 value) for the current pointer position: shell UI
|
||||
/// decides over the launcher; a client window decides inside its client area; otherwise default.
|
||||
pub fn MoonPlasmaCompositor::desired_cursor(self : MoonPlasmaCompositor) -> UInt {
|
||||
pub fn ChandraCompositor::desired_cursor(self : ChandraCompositor) -> UInt {
|
||||
let shell_shape = self.shell.cursor_at(self.ptr_x.to_int(), self.ptr_y.to_int())
|
||||
if shell_shape != 0U {
|
||||
return shell_shape
|
||||
|
||||
@@ -139,7 +139,7 @@ fn bind_global(
|
||||
|
||||
///|
|
||||
fn open_and_configure_client(
|
||||
comp : @host.MoonPlasmaCompositor,
|
||||
comp : @host.ChandraCompositor,
|
||||
socket_path : String,
|
||||
title : String,
|
||||
app_id : String,
|
||||
@@ -217,7 +217,7 @@ fn open_and_configure_client(
|
||||
|
||||
///|
|
||||
fn commit_shm_frame(
|
||||
comp : @host.MoonPlasmaCompositor,
|
||||
comp : @host.ChandraCompositor,
|
||||
c : TestWaylandClient,
|
||||
shm_id : UInt,
|
||||
surf_id : UInt,
|
||||
@@ -317,11 +317,11 @@ test "e2e pure-moonbit wayland compositor with lib/wm, ssd decorations, and shm
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
|
||||
// Client 1: MoonTerm
|
||||
let (c1, shm1, surf1, xdg1, _tl1, _deco1) = open_and_configure_client(
|
||||
comp, socket_path, "MoonTerm", "org.moonplasma.term",
|
||||
comp, socket_path, "MoonTerm", "org.chandra.term",
|
||||
)
|
||||
assert_eq(c1.deco_mode, Some(2U)) // ServerSide
|
||||
assert_true(c1.configured_w > 1200 && c1.configured_h > 600)
|
||||
@@ -347,7 +347,7 @@ test "e2e pure-moonbit wayland compositor with lib/wm, ssd decorations, and shm
|
||||
|
||||
// Client 2: Files -> verify BSP tiling splits the screen!
|
||||
let (c2, shm2, surf2, xdg2, _tl2, _deco2) = open_and_configure_client(
|
||||
comp, socket_path, "Files", "org.moonplasma.files",
|
||||
comp, socket_path, "Files", "org.chandra.files",
|
||||
)
|
||||
assert_true(c2.configured_w > 0 && c2.configured_w < 700)
|
||||
commit_shm_frame(comp, c2, shm2, surf2, xdg2, 2UL)
|
||||
@@ -369,7 +369,7 @@ test "a buffer stays valid after its wl_shm_pool is destroyed" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(
|
||||
comp, socket_path, "Kwi", "org.kde.kwi",
|
||||
)
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
/// Needs the modules: run scripts/build-modules.sh (just test does).
|
||||
|
||||
///| Rectangle of the panel module `id` (file stem), as last drawn.
|
||||
fn rect_of(comp : @host.MoonPlasmaCompositor, id : String) -> @scene.Rect {
|
||||
fn rect_of(comp : @host.ChandraCompositor, id : String) -> @scene.Rect {
|
||||
comp.shell.slot_rect(comp.shell.slot_of(id))
|
||||
}
|
||||
|
||||
///| Centre of the panel module `id`.
|
||||
fn center_of(comp : @host.MoonPlasmaCompositor, id : String) -> (Double, Double) raise {
|
||||
fn center_of(comp : @host.ChandraCompositor, id : String) -> (Double, Double) raise {
|
||||
let r = rect_of(comp, id)
|
||||
assert_true(r.w > 0)
|
||||
((r.x + r.w / 2).to_double(), (r.y + r.h / 2).to_double())
|
||||
}
|
||||
|
||||
///| Move to (x, y), press and release `btn`, then draw a frame.
|
||||
fn click_at(comp : @host.MoonPlasmaCompositor, x : Int, y : Int, t : UInt, btn? : UInt = 272U) -> Unit {
|
||||
fn click_at(comp : @host.ChandraCompositor, x : Int, y : Int, t : UInt, btn? : UInt = 272U) -> Unit {
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(x.to_double(), y.to_double()), t)
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(btn, true), t + 1U)
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(btn, false), t + 2U)
|
||||
@@ -23,16 +23,16 @@ fn click_at(comp : @host.MoonPlasmaCompositor, x : Int, y : Int, t : UInt, btn?
|
||||
}
|
||||
|
||||
///| Click the centre of panel module `id`.
|
||||
fn click_module(comp : @host.MoonPlasmaCompositor, id : String, t : UInt) -> Unit raise {
|
||||
fn click_module(comp : @host.ChandraCompositor, id : String, t : UInt) -> Unit raise {
|
||||
let (x, y) = center_of(comp, id)
|
||||
click_at(comp, x.to_int(), y.to_int(), t)
|
||||
}
|
||||
|
||||
///| A fresh compositor with the default panel and a first frame drawn.
|
||||
fn new_comp(tag : String) -> @host.MoonPlasmaCompositor {
|
||||
fn new_comp(tag : String) -> @host.ChandraCompositor {
|
||||
let socket_path = "/tmp/wayland-moon-" + tag + "-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
ignore(comp.compose_frame())
|
||||
comp
|
||||
}
|
||||
@@ -80,7 +80,7 @@ test "host input reaches the focused client and the launcher popup opens" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(
|
||||
comp, socket_path, "T", "t",
|
||||
)
|
||||
@@ -169,7 +169,7 @@ test "dragging the divider between two tiled windows resizes them" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let _a = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let _b = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
let left = comp.windows.get(1UL).unwrap().geometry
|
||||
@@ -196,7 +196,7 @@ test "the layout module opens a popup to pick Tiling, Monocle or Floating" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let _a = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let _b = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
ignore(comp.compose_frame())
|
||||
@@ -237,7 +237,7 @@ test "title-bar buttons minimize, maximize and close windows" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let (c, _shm, _surf, _xdg, tl, _deco) = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let _b = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
ignore(comp.compose_frame())
|
||||
@@ -282,7 +282,7 @@ test "the task list module focuses the window whose pill is clicked" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let _a = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let _b = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
ignore(comp.compose_frame())
|
||||
@@ -376,7 +376,7 @@ test "tapping Super toggles the launcher; Super+key does not" {
|
||||
///|
|
||||
test "the panel is saved to panel.edn and restored" {
|
||||
// Never touch the user's real config: only run when a scratch dir is provided.
|
||||
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
|
||||
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let a = @shell.DesktopShell::new("x")
|
||||
a.persist = true
|
||||
@@ -510,7 +510,7 @@ test "Desktop Pulse reads live machine and window state through its granted inte
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let _a = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let _b = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
ignore(comp.compose_frame())
|
||||
@@ -548,7 +548,7 @@ test "Desktop Pulse reads live machine and window state through its granted inte
|
||||
test "the desktop card can be dragged across the wallpaper" {
|
||||
let socket_path = "/tmp/wayland-moon-desk-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
ignore(comp.compose_frame())
|
||||
// Default: top-right, 24px in. Grab it by its body.
|
||||
let gx = 1280 - 260 - 24 + 40
|
||||
@@ -570,7 +570,7 @@ test "the desktop card can be dragged across the wallpaper" {
|
||||
test "an xdg_popup (right-click menu) is placed, drawn, clickable and dismissed from outside" {
|
||||
let socket_path = "/tmp/wayland-moon-popup-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(comp, socket_path, "T", "t")
|
||||
commit_shm_frame(comp, c, shm, surf, xdg, 1UL)
|
||||
let win = comp.windows.get(1UL).unwrap().geometry
|
||||
@@ -726,7 +726,7 @@ fn data_device_for(c : TestWaylandClient) -> (UInt, UInt) {
|
||||
test "copy in one client, paste in another" {
|
||||
let socket_path = "/tmp/wayland-moon-clip-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let (a, _, _, _, _, _) = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let (b, _, _, _, _, _) = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
let (mgr_a, dev_a) = data_device_for(a)
|
||||
@@ -782,7 +782,7 @@ test "dragging a title bar moves the window and floats it" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let _a = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let _b = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
let g0 = comp.windows.get(2UL).unwrap().geometry
|
||||
@@ -806,7 +806,7 @@ test "dragging a floating window's corner resizes it" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let _a = open_and_configure_client(comp, socket_path, "A", "a")
|
||||
let _b = open_and_configure_client(comp, socket_path, "B", "b")
|
||||
// Float window 2 by dragging its title bar a little.
|
||||
@@ -861,7 +861,7 @@ fn read_state_edn() -> String {
|
||||
"" => @sys.getenv("HOME") + "/.config"
|
||||
c => c
|
||||
}
|
||||
let raw = @sys.read_file_bytes(dir + "/moon-plasma/state.edn")
|
||||
let raw = @sys.read_file_bytes(dir + "/chandra/state.edn")
|
||||
let sb = StringBuilder::new()
|
||||
for i = 0; i < raw.length(); i = i + 1 {
|
||||
sb.write_char(Int::unsafe_to_char(raw[i].to_int())) // the file is ASCII
|
||||
@@ -875,14 +875,14 @@ fn write_state_edn(text : String) -> Unit {
|
||||
"" => @sys.getenv("HOME") + "/.config"
|
||||
c => c
|
||||
}
|
||||
ignore(@sys.mkdir_p(dir + "/moon-plasma"))
|
||||
ignore(@sys.write_file_bytes(dir + "/moon-plasma/state.edn", @sys.str_to_utf8_bytes(text)))
|
||||
ignore(@sys.mkdir_p(dir + "/chandra"))
|
||||
ignore(@sys.write_file_bytes(dir + "/chandra/state.edn", @sys.str_to_utf8_bytes(text)))
|
||||
}
|
||||
|
||||
///|
|
||||
test "the layout mode and recent apps are saved to state.edn and restored; other keys survive" {
|
||||
// Never touch the user's real config: only run when the test runner gave us a scratch dir.
|
||||
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
|
||||
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
|
||||
write_state_edn(";; hand-written\n{:note \"keep me\" :layout :tiling}\n")
|
||||
let a = new_comp("state-a")
|
||||
a.shell.persist = true
|
||||
@@ -915,7 +915,7 @@ test "the layout mode and recent apps are saved to state.edn and restored; other
|
||||
|
||||
///|
|
||||
test "the desktop card position is saved when dropped and restored" {
|
||||
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
|
||||
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
|
||||
write_state_edn("{:note \"keep\"}\n")
|
||||
let a = new_comp("card-a")
|
||||
a.shell.persist = true
|
||||
@@ -939,7 +939,7 @@ test "the desktop card position is saved when dropped and restored" {
|
||||
test "clicking a floating window brings it in front of the others" {
|
||||
let socket_path = "/tmp/wayland-moon-z-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
|
||||
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
|
||||
comp.set_layout_mode(@wm.LayoutMode::Floating)
|
||||
@@ -958,11 +958,11 @@ test "clicking a floating window brings it in front of the others" {
|
||||
|
||||
///|
|
||||
test "a window dragged somewhere reopens there, saved per app in state.edn" {
|
||||
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
|
||||
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
|
||||
write_state_edn("{:note \"keep\"}\n")
|
||||
let sock1 = "/tmp/wayland-moon-wp1-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let a = @host.MoonPlasmaCompositor::new(sock1, theme, 1280, 720).unwrap()
|
||||
let a = @host.ChandraCompositor::new(sock1, theme, 1280, 720).unwrap()
|
||||
a.shell.persist = true
|
||||
a.set_layout_mode(@wm.LayoutMode::Floating)
|
||||
ignore(open_and_configure_client(a, sock1, "T", "org.test.app"))
|
||||
@@ -980,7 +980,7 @@ test "a window dragged somewhere reopens there, saved per app in state.edn" {
|
||||
assert_true(text.contains(":note \"keep\""))
|
||||
// A new session: the same app opens where it was left.
|
||||
let sock2 = "/tmp/wayland-moon-wp2-" + @sys.getpid().to_string() + ".sock"
|
||||
let b = @host.MoonPlasmaCompositor::new(sock2, theme, 1280, 720).unwrap()
|
||||
let b = @host.ChandraCompositor::new(sock2, theme, 1280, 720).unwrap()
|
||||
b.shell.persist = true
|
||||
b.restore_state()
|
||||
ignore(open_and_configure_client(b, sock2, "T", "org.test.app"))
|
||||
@@ -995,7 +995,7 @@ test "a window dragged somewhere reopens there, saved per app in state.edn" {
|
||||
test "alt-tab switches to the previous window, tab again goes further back, escape cancels" {
|
||||
let socket_path = "/tmp/wayland-moon-alt-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
|
||||
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
|
||||
ignore(open_and_configure_client(comp, socket_path, "C", "c"))
|
||||
@@ -1047,7 +1047,7 @@ test "alt-tab switches to the previous window, tab again goes further back, esca
|
||||
test "compose_scene hands the host a scene only when something changed" {
|
||||
let socket_path = "/tmp/wayland-moon-scene-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
// The first scene is always drawn; the wallpaper and the desktop card are split out of it.
|
||||
match comp.compose_scene() {
|
||||
Some(sg) => {
|
||||
@@ -1079,7 +1079,7 @@ test "compose_scene hands the host a scene only when something changed" {
|
||||
test "super+d minimizes every window to show the desktop, and again brings them back" {
|
||||
let socket_path = "/tmp/wayland-moon-supd-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
|
||||
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
|
||||
ignore(comp.compose_frame())
|
||||
@@ -1123,7 +1123,7 @@ test "super+d minimizes every window to show the desktop, and again brings them
|
||||
}
|
||||
|
||||
///| Click (x, y) without drawing, then return the next scene's wallpaper op count (0: no new scene).
|
||||
fn click_wallpaper_ops(comp : @host.MoonPlasmaCompositor, x : Int, y : Int, t : UInt) -> Int {
|
||||
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)
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(272U, true), t + 1U)
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(272U, false), t + 2U)
|
||||
@@ -1162,7 +1162,7 @@ test "the wallpaper module lists the wallpapers and switches the desktop to the
|
||||
|
||||
///|
|
||||
test "the chosen wallpaper is saved to state.edn and restored" {
|
||||
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
|
||||
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
|
||||
write_state_edn("{:note \"keep\"}\n")
|
||||
let a = new_comp("wall-a")
|
||||
a.shell.persist = true
|
||||
@@ -1184,3 +1184,29 @@ test "the chosen wallpaper is saved to state.edn and restored" {
|
||||
assert_eq(c.shell.wallpaper_sel, 0)
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
test "state saved by a build from before the rename to Chandra is still read" {
|
||||
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
|
||||
let dir = match @sys.getenv("XDG_CONFIG_HOME") {
|
||||
"" => @sys.getenv("HOME") + "/.config"
|
||||
c => c
|
||||
}
|
||||
@sys.unlink(dir + "/chandra/state.edn")
|
||||
ignore(@sys.mkdir_p(dir + "/moon-plasma"))
|
||||
ignore(
|
||||
@sys.write_file_bytes(
|
||||
dir + "/moon-plasma/state.edn",
|
||||
@sys.str_to_utf8_bytes("{:layout :monocle}\n"),
|
||||
),
|
||||
)
|
||||
let c = new_comp("state-legacy")
|
||||
c.shell.persist = true
|
||||
c.restore_state()
|
||||
assert_eq(c.layout_mode, @wm.LayoutMode::Monocle)
|
||||
// The next save goes to the new place.
|
||||
c.shell.save_state()
|
||||
assert_true(read_state_edn().contains(":layout :monocle"))
|
||||
@sys.unlink(dir + "/moon-plasma/state.edn")
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ test "inspector shows the WIT interface of the hovered component" {
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
||||
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(
|
||||
comp, socket_path, "T", "t",
|
||||
)
|
||||
|
||||
+10
-10
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
"moonbitlang/core/builtin",
|
||||
"moonplasma/desktop/lib/wm" @wm,
|
||||
"moonplasma/desktop/compositor/sys" @sys,
|
||||
"moonplasma/desktop/compositor/scene" @scene,
|
||||
"moonplasma/desktop/compositor/shell" @shell,
|
||||
"moonplasma/desktop/compositor/wasm" @wasm,
|
||||
"moonplasma/desktop/compositor/nested" @nested,
|
||||
"moonplasma/desktop/compositor/font" @font,
|
||||
"moonplasma/desktop/compositor/renderer" @renderer,
|
||||
"moonplasma/desktop/compositor/wayland" @wayland,
|
||||
"moonplasma/desktop/compositor/gfx" @gfx,
|
||||
"chandra/desktop/lib/wm" @wm,
|
||||
"chandra/desktop/compositor/sys" @sys,
|
||||
"chandra/desktop/compositor/scene" @scene,
|
||||
"chandra/desktop/compositor/shell" @shell,
|
||||
"chandra/desktop/compositor/wasm" @wasm,
|
||||
"chandra/desktop/compositor/nested" @nested,
|
||||
"chandra/desktop/compositor/font" @font,
|
||||
"chandra/desktop/compositor/renderer" @renderer,
|
||||
"chandra/desktop/compositor/wayland" @wayland,
|
||||
"chandra/desktop/compositor/gfx" @gfx,
|
||||
}
|
||||
|
||||
supported_targets = "+native+wasm"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
///|
|
||||
test "resize redraws the desktop at the new output size" {
|
||||
let socket_path = "/tmp/wayland-moon-resize-" + @sys.getpid().to_string() + ".sock"
|
||||
let comp = @host.MoonPlasmaCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
|
||||
let comp = @host.ChandraCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
|
||||
let before = comp.compose_frame()
|
||||
assert_eq((before.width, before.height), (1280, 720))
|
||||
comp.resize(900, 560)
|
||||
|
||||
@@ -17,8 +17,8 @@ let key_rsuper : UInt32 = 126
|
||||
|
||||
///|
|
||||
/// Handle a key for Super+D. Returns true when the key is consumed (not for clients).
|
||||
fn MoonPlasmaCompositor::show_desktop_key(
|
||||
self : MoonPlasmaCompositor,
|
||||
fn ChandraCompositor::show_desktop_key(
|
||||
self : ChandraCompositor,
|
||||
code : UInt32,
|
||||
pressed : Bool,
|
||||
) -> Bool {
|
||||
@@ -45,8 +45,8 @@ fn MoonPlasmaCompositor::show_desktop_key(
|
||||
|
||||
///|
|
||||
/// Minimize all visible windows of the active workspace, or restore the ones Super+D hid.
|
||||
pub fn MoonPlasmaCompositor::toggle_show_desktop(
|
||||
self : MoonPlasmaCompositor,
|
||||
pub fn ChandraCompositor::toggle_show_desktop(
|
||||
self : ChandraCompositor,
|
||||
) -> Unit {
|
||||
let visible = self.wm.stacking_order()
|
||||
if visible.length() == 0 {
|
||||
@@ -92,6 +92,6 @@ pub fn MoonPlasmaCompositor::toggle_show_desktop(
|
||||
|
||||
///|
|
||||
/// True while Super+D has windows hidden that another Super+D would bring back.
|
||||
pub fn MoonPlasmaCompositor::desktop_shown(self : MoonPlasmaCompositor) -> Bool {
|
||||
pub fn ChandraCompositor::desktop_shown(self : ChandraCompositor) -> Bool {
|
||||
self.desktop_hidden.length() > 0 && self.wm.stacking_order().length() == 0
|
||||
}
|
||||
@@ -31,7 +31,7 @@ let key_left : UInt = 105
|
||||
let key_right : UInt = 106
|
||||
|
||||
///| Windows of the active workspace, most recently used first (minimized ones included).
|
||||
fn MoonPlasmaCompositor::switcher_candidates(self : MoonPlasmaCompositor) -> Array[UInt64] {
|
||||
fn ChandraCompositor::switcher_candidates(self : ChandraCompositor) -> Array[UInt64] {
|
||||
let out : Array[UInt64] = []
|
||||
for ws in self.wm.workspaces {
|
||||
if ws.id == self.wm.active_workspace {
|
||||
@@ -52,12 +52,12 @@ fn MoonPlasmaCompositor::switcher_candidates(self : MoonPlasmaCompositor) -> Arr
|
||||
}
|
||||
|
||||
///| True while the switcher is on screen.
|
||||
pub fn MoonPlasmaCompositor::switcher_open(self : MoonPlasmaCompositor) -> Bool {
|
||||
pub fn ChandraCompositor::switcher_open(self : ChandraCompositor) -> Bool {
|
||||
self.switcher_on
|
||||
}
|
||||
|
||||
///| Close the switcher; with `commit`, switch to the selected window.
|
||||
fn MoonPlasmaCompositor::switcher_close(self : MoonPlasmaCompositor, commit : Bool) -> Unit {
|
||||
fn ChandraCompositor::switcher_close(self : ChandraCompositor, commit : Bool) -> Unit {
|
||||
if !self.switcher_on {
|
||||
return
|
||||
}
|
||||
@@ -70,7 +70,7 @@ fn MoonPlasmaCompositor::switcher_close(self : MoonPlasmaCompositor, commit : Bo
|
||||
}
|
||||
|
||||
///| Handle a key for the switcher. Returns true when the key is consumed (not for clients).
|
||||
fn MoonPlasmaCompositor::switcher_key(self : MoonPlasmaCompositor, code : UInt, pressed : Bool, time_ms : UInt) -> Bool {
|
||||
fn ChandraCompositor::switcher_key(self : ChandraCompositor, code : UInt, pressed : Bool, time_ms : UInt) -> Bool {
|
||||
if code == key_lalt || code == key_ralt {
|
||||
self.alt_down = pressed
|
||||
if !pressed && self.switcher_on {
|
||||
@@ -124,7 +124,7 @@ fn MoonPlasmaCompositor::switcher_key(self : MoonPlasmaCompositor, code : UInt,
|
||||
}
|
||||
|
||||
///| The switcher's draw ops: a centred list, the selected row lit. Empty when closed.
|
||||
fn MoonPlasmaCompositor::switcher_ops(self : MoonPlasmaCompositor) -> Array[@scene.DrawOp] {
|
||||
fn ChandraCompositor::switcher_ops(self : ChandraCompositor) -> Array[@scene.DrawOp] {
|
||||
let ops : Array[@scene.DrawOp] = []
|
||||
if !self.switcher_on {
|
||||
return ops
|
||||
|
||||
Reference in new issue
Block a user