- timefmt.hhmm12 + render_digital(hour12=); compositor panel shows '7:51 PM' (wasm clock component keeps 24h by default) - wp_cursor_shape_v1: server lets clients pick their cursor; nested window forwards the shape to the host. Launcher button/entries show a hand, the search field a text cursor, client windows what the client asked for. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a63f65806d
commit
59ea224d38
8 files changed
+146
-3
No files matched your search
@@ -502,3 +502,16 @@ 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 {
|
||||
let shell_shape = self.shell.cursor_at(self.ptr_x.to_int(), self.ptr_y.to_int())
|
||||
if shell_shape != 0U {
|
||||
return shell_shape
|
||||
}
|
||||
match self.ptr_win {
|
||||
Some(w) => self.server.client_cursor_shape(w)
|
||||
None => 1U
|
||||
}
|
||||
}
|
||||
@@ -78,15 +78,36 @@ test "host input reaches the focused client and the launcher popup opens" {
|
||||
assert_true(has_msg(msgs, ptr_id, 3U)) // button
|
||||
assert_true(has_msg(msgs, kbd_id, 3U)) // wl_keyboard.key
|
||||
|
||||
// Cursor: a client that asks for a text cursor gets it inside its window...
|
||||
let shape_mgr = bind_global(c, reg_id, "wp_cursor_shape_manager_v1", 1U)
|
||||
let shape_dev = c.alloc_id()
|
||||
let w3 = @wayland.WireWriter::new()
|
||||
w3.u32(shape_dev)
|
||||
w3.u32(ptr_id)
|
||||
c.send(w3.finish_msg(shape_mgr, 1U))
|
||||
let w4 = @wayland.WireWriter::new()
|
||||
w4.u32(1U) // serial
|
||||
w4.u32(9U) // text
|
||||
c.send(w4.finish_msg(shape_dev, 1U))
|
||||
for _i = 0; _i < 5; _i = _i + 1 {
|
||||
comp.step()
|
||||
@sys.sleep_ms(2)
|
||||
}
|
||||
assert_eq(comp.desired_cursor(), 9U)
|
||||
|
||||
// Launcher: click the button -> popup opens and swallows keys.
|
||||
ignore(comp.compose_frame()) // lays out the panel
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(60.0, 700.0), 20U)
|
||||
assert_eq(comp.desired_cursor(), 4U) // ...but the launcher button always shows a hand
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(0x110U, true), 21U)
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(0x110U, false), 22U)
|
||||
assert_true(comp.shell.popup_open())
|
||||
comp.handle_input(@nested.InputEvent::Key(30U, true), 23U)
|
||||
let after = drain_msgs(c)
|
||||
assert_false(has_msg(after, kbd_id, 3U)) // swallowed by the launcher
|
||||
// Off the shell and off any window: default arrow.
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(1270.0, 5.0), 25U)
|
||||
assert_eq(comp.desired_cursor(), 1U)
|
||||
// Escape closes it.
|
||||
comp.handle_input(@nested.InputEvent::Key(1U, true), 24U)
|
||||
assert_false(comp.shell.popup_open())
|
||||
|
||||
Reference in new issue
Block a user