Add dock module: dock-style quick launcher with magnifying app tiles
CI / test (push) Failing after 23s

- lib/dock: tile layout, hit-testing, magnification, per-app colours (tested)
- components/dock: plasmoid module (imports only app-catalog + app-launch)
- shell: panel widgets now get pointer-move / pointer-leave while hovered

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Sonnet 5.5 committed 2026-11-25 00:14:29 -08:00
1 parent 79321790a1
commit 6fc921b431
15 files changed
+930

No files matched your search

+20
View File
@@ -677,3 +677,23 @@ test "an xdg_popup (right-click menu) is placed, drawn, clickable and dismissed
}
assert_eq(comp.popups.length(), 0)
}
///|
test "the dock module magnifies the tile under the pointer and shows nothing when the pointer leaves" {
let comp = new_comp("dock")
assert_true(comp.shell.load_path("build/components/dock.wasm") is Some(_))
ignore(comp.compose_frame())
let slot = comp.shell.slots()[comp.shell.slots().length() - 1]
let r = comp.shell.slot_rect(slot)
assert_true(r.w > 0)
let frame = fn() {
ignore(comp.compose_frame())
}
// Pointer over the dock: it becomes the hovered widget.
comp.handle_input(@nested.InputEvent::PointerMove((r.x + 14).to_double(), (r.y + r.h / 2).to_double()), 1U)
frame()
assert_eq(comp.shell.hover_slot, slot)
// Off the panel: the dock gets a leave.
comp.handle_input(@nested.InputEvent::PointerMove(640.0, 300.0), 2U)
assert_eq(comp.shell.hover_slot, "")
}
+28
View File
@@ -225,6 +225,8 @@ pub(all) struct DesktopShell {
mut menu_slot : String
/// Panel widget being dragged (slot id, "" if none), press point, and whether it moved past the click threshold.
mut drag_slot : String
/// Panel widget the pointer is over (it gets pointer-move / pointer-leave), "" for none.
mut hover_slot : String
mut drag_x0 : Int
mut drag_y0 : Int
mut drag_active : Bool
@@ -293,6 +295,7 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
menu_anchor_x: 0,
menu_slot: "",
drag_slot: "",
hover_slot: "",
drag_x0: 0,
drag_y0: 0,
drag_active: false,
@@ -456,6 +459,11 @@ fn DesktopShell::widget_by_slot(self : DesktopShell, slot : String) -> Widget? {
None
}
///| True when (x, y) is inside some widget's open popup.
fn DesktopShell::popup_covers(self : DesktopShell, x : Int, y : Int) -> Bool {
self.popup_at(x, y) is Some(_)
}
///| Widget whose popup contains (x, y).
fn DesktopShell::popup_at(self : DesktopShell, x : Int, y : Int) -> Widget? {
for w in self.widgets {
@@ -654,6 +662,26 @@ pub fn DesktopShell::pointer_move(self : DesktopShell, x : Int, y : Int) -> Bool
if self.menu_open {
return self.menu_pointer_move(x, y)
}
// Hover: the widget under the pointer sees moves, the one it left sees a leave.
let hovered = match self.widget_at(x, y) {
Some(w) if !self.popup_covers(x, y) => Some(w)
_ => None
}
let hslot = match hovered {
Some(w) => w.slot
None => ""
}
if hslot != self.hover_slot {
match self.widget_by_slot(self.hover_slot) {
Some(old) => ignore(self.deliver(old, false, PointerLeave))
None => ()
}
self.hover_slot = hslot
}
match hovered {
Some(w) => ignore(self.deliver(w, false, PointerMove(x - w.rect.x, y - w.rect.y)))
None => ()
}
let mut over = false
for w in self.widgets.copy() {
if w.popup_rect.w > 0 {