From a5f8aa35e1268b9070d4e9e959452e5b721a7405 Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Thu, 30 Jun 2022 16:30:05 -0400 Subject: [PATCH] app: [Wayland] scale pointer hotspot coordinates This commit updates the way that we change cursors so that the hotspot of the cursor is properly set to surface-local coordinates. The previous raw hotspot coordinates are relative to the cursor image buffer data, and do not take the buffer's scaling factor into account. Signed-off-by: Chris Waldon --- app/os_wayland.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/os_wayland.go b/app/os_wayland.go index dc5da440..69c5ced4 100644 --- a/app/os_wayland.go +++ b/app/os_wayland.go @@ -1143,7 +1143,7 @@ func (w *window) setCursor(pointer *C.struct_wl_pointer, serial C.uint32_t) { if buf == nil { return } - C.wl_pointer_set_cursor(pointer, serial, w.cursor.surf, C.int32_t(img.hotspot_x), C.int32_t(img.hotspot_y)) + C.wl_pointer_set_cursor(pointer, serial, w.cursor.surf, C.int32_t(img.hotspot_x/C.uint(w.scale)), C.int32_t(img.hotspot_y/C.uint(w.scale))) C.wl_surface_attach(w.cursor.surf, buf, 0, 0) C.wl_surface_damage(w.cursor.surf, 0, 0, C.int32_t(img.width), C.int32_t(img.height)) C.wl_surface_commit(w.cursor.surf)