app: [Wayland] use correct serial for wl_pointer_set_cursor, take 2

To fix #644 the serial passed to wl_pointer_set_cursor must come from
the pointer enter event. To do this we need a place to keep the serial
so I've added a field to the wlSeat struct to hold on to it.

Ref: https://wayland.app/protocols/wayland#wl_pointer:request:set_cursor
Ref: https://wayland-book.com/seat/pointer.html

Fixes: https://todo.sr.ht/~eliasnaur/gio/644
Signed-off-by: Dave Akers <dave@dazoe.net>
This commit is contained in:
Dave Akers
2025-04-03 21:31:59 +00:00
committed by Elias Naur
parent a3117d3823
commit 016714a668
+4 -1
View File
@@ -116,6 +116,8 @@ type wlSeat struct {
// The most recent input serial.
serial C.uint32_t
// The most recent pointer enter serial.
pointerSerial C.uint32_t
pointerFocus *window
keyboardFocus *window
@@ -851,6 +853,7 @@ func gio_onTouchCancel(data unsafe.Pointer, touch *C.struct_wl_touch) {
func gio_onPointerEnter(data unsafe.Pointer, pointer *C.struct_wl_pointer, serial C.uint32_t, surf *C.struct_wl_surface, x, y C.wl_fixed_t) {
s := callbackLoad(data).(*wlSeat)
s.serial = serial
s.pointerSerial = serial
w := callbackLoad(unsafe.Pointer(surf)).(*window)
w.seat = s
s.pointerFocus = w
@@ -1169,7 +1172,7 @@ func (w *window) updateCursor() {
if ptr == nil {
return
}
w.setCursor(ptr, w.seat.serial)
w.setCursor(ptr, w.seat.pointerSerial)
}
func (w *window) setCursor(pointer *C.struct_wl_pointer, serial C.uint32_t) {