Desktop card: click and drag it around the wallpaper
Press on the card (when no window covers it) to grab it; it follows the pointer, clamped to the screen, with a hand cursor on hover and grabbing while dragged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
783618b89f
commit
bca69d8c90
4 files changed
+100
-6
No files matched your search
@@ -531,3 +531,25 @@ test "Desktop Pulse reads live machine and window state through its granted inte
|
||||
assert_eq(others_focused, 0)
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
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()
|
||||
ignore(comp.compose_frame())
|
||||
// Default: top-right, 24px in. Grab it by its body.
|
||||
let gx = 1280 - 260 - 24 + 40
|
||||
let gy = 24 + 30
|
||||
assert_true(comp.shell.desk_hit(gx, gy))
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(gx.to_double(), gy.to_double()), 1U)
|
||||
assert_eq(comp.desired_cursor(), 4U)
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(272U, true), 2U)
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(300.0, 300.0), 3U)
|
||||
assert_eq(comp.desired_cursor(), 17U)
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(272U, false), 4U)
|
||||
// It moved: new top-left is pointer minus the grab offset.
|
||||
assert_true(comp.shell.desk_hit(300, 300))
|
||||
assert_true(!comp.shell.desk_hit(gx, gy))
|
||||
assert_true(!comp.shell.desk_dragging())
|
||||
}
|
||||
Reference in new issue
Block a user