mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-08 02:45:38 +00:00
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:
+4
-1
@@ -116,6 +116,8 @@ type wlSeat struct {
|
|||||||
|
|
||||||
// The most recent input serial.
|
// The most recent input serial.
|
||||||
serial C.uint32_t
|
serial C.uint32_t
|
||||||
|
// The most recent pointer enter serial.
|
||||||
|
pointerSerial C.uint32_t
|
||||||
|
|
||||||
pointerFocus *window
|
pointerFocus *window
|
||||||
keyboardFocus *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) {
|
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 := callbackLoad(data).(*wlSeat)
|
||||||
s.serial = serial
|
s.serial = serial
|
||||||
|
s.pointerSerial = serial
|
||||||
w := callbackLoad(unsafe.Pointer(surf)).(*window)
|
w := callbackLoad(unsafe.Pointer(surf)).(*window)
|
||||||
w.seat = s
|
w.seat = s
|
||||||
s.pointerFocus = w
|
s.pointerFocus = w
|
||||||
@@ -1169,7 +1172,7 @@ func (w *window) updateCursor() {
|
|||||||
if ptr == nil {
|
if ptr == nil {
|
||||||
return
|
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) {
|
func (w *window) setCursor(pointer *C.struct_wl_pointer, serial C.uint32_t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user