mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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 <christopher.waldon.dev@gmail.com>
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user