- 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
@@ -17,6 +17,10 @@ pub(all) struct NestedWindow {
|
||||
fds : Array[Int]
|
||||
mut keymap : Bytes
|
||||
mut keyboard_id : UInt
|
||||
mut shape_mgr_id : UInt
|
||||
mut shape_dev_id : UInt
|
||||
mut enter_serial : UInt
|
||||
mut shape_applied : UInt
|
||||
fd : Int
|
||||
rx : Array[Byte]
|
||||
globals : Map[String, (UInt, UInt)]
|
||||
@@ -168,6 +172,14 @@ fn NestedWindow::dispatch(
|
||||
w.u32(id)
|
||||
self.send(w.finish_msg(self.seat_id, 0U))
|
||||
self.pointer_id = id
|
||||
if self.shape_mgr_id != 0U {
|
||||
let dev = self.alloc()
|
||||
let wd = @wayland.WireWriter::new()
|
||||
wd.u32(dev)
|
||||
wd.u32(id)
|
||||
self.send(wd.finish_msg(self.shape_mgr_id, 1U))
|
||||
self.shape_dev_id = dev
|
||||
}
|
||||
}
|
||||
if (caps & 2U) != 0U && self.keyboard_id == 0U {
|
||||
let id = self.alloc()
|
||||
@@ -209,7 +221,8 @@ fn NestedWindow::dispatch(
|
||||
} else if self.pointer_id != 0U && obj == self.pointer_id {
|
||||
match op {
|
||||
0U => {
|
||||
let _serial = r.u32()
|
||||
self.enter_serial = r.u32()
|
||||
self.shape_applied = 0U // host resets the cursor on enter
|
||||
let _surf = r.u32()
|
||||
self.px = r.i32().to_double() / 256.0
|
||||
self.py = r.i32().to_double() / 256.0
|
||||
@@ -282,6 +295,10 @@ pub fn NestedWindow::open(
|
||||
fds: [],
|
||||
keymap: Bytes::from_array([]),
|
||||
keyboard_id: 0U,
|
||||
shape_mgr_id: 0U,
|
||||
shape_dev_id: 0U,
|
||||
enter_serial: 0U,
|
||||
shape_applied: 0U,
|
||||
rx: [],
|
||||
globals: {},
|
||||
live_buffers: {},
|
||||
@@ -313,6 +330,7 @@ pub fn NestedWindow::open(
|
||||
self.shm_id = self.bind("wl_shm", 1U)
|
||||
self.wm_id = self.bind("xdg_wm_base", 2U)
|
||||
self.seat_id = self.bind("wl_seat", 5U)
|
||||
self.shape_mgr_id = self.bind("wp_cursor_shape_manager_v1", 1U)
|
||||
if self.comp_id == 0U || self.shm_id == 0U || self.wm_id == 0U {
|
||||
println("nested: host compositor lacks wl_compositor/wl_shm/xdg_wm_base")
|
||||
return None
|
||||
@@ -442,3 +460,16 @@ pub fn NestedWindow::close(self : NestedWindow) -> Unit {
|
||||
pub fn NestedWindow::frame_ready(self : NestedWindow) -> Bool {
|
||||
!self.frame_pending && !self.closed
|
||||
}
|
||||
|
||||
///| Ask the host to show cursor `shape` (wp_cursor_shape_v1 enum value) over our
|
||||
/// window. No-op if unchanged, unsupported by the host, or the pointer is outside.
|
||||
pub fn NestedWindow::set_cursor_shape(self : NestedWindow, shape : UInt) -> Unit {
|
||||
if self.shape_dev_id == 0U || self.enter_serial == 0U || shape == self.shape_applied {
|
||||
return
|
||||
}
|
||||
let w = @wayland.WireWriter::new()
|
||||
w.u32(self.enter_serial)
|
||||
w.u32(shape)
|
||||
self.send(w.finish_msg(self.shape_dev_id, 1U))
|
||||
self.shape_applied = shape
|
||||
}
|
||||
Reference in new issue
Block a user