From 414a91c49e272677f66b635f1daf8858cd1f80f7 Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Thu, 23 Jun 2022 17:16:20 -0400 Subject: [PATCH] app: [Wayland] use HiDPI cursor on HiDPI screen This commit scales both the loaded cursor theme and the cursor surface appropriately so that the cursor image is not blurry on HiDPI screens. References: https://todo.sr.ht/~eliasnaur/gio/382 Signed-off-by: Chris Waldon --- app/os_wayland.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/os_wayland.go b/app/os_wayland.go index 9473d98e..fe9daa7d 100644 --- a/app/os_wayland.go +++ b/app/os_wayland.go @@ -374,7 +374,7 @@ func (d *wlDisplay) createNativeWindow(options []Option) (*window, error) { w.destroy() return nil, errors.New("wayland: xdg_surface_get_toplevel failed") } - w.cursor.theme = C.wl_cursor_theme_load(nil, 32, d.shm) + w.cursor.theme = C.wl_cursor_theme_load(nil, C.int(32*w.scale), d.shm) if w.cursor.theme == nil { w.destroy() return nil, errors.New("wayland: wl_cursor_theme_load failed") @@ -390,6 +390,7 @@ func (d *wlDisplay) createNativeWindow(options []Option) (*window, error) { w.destroy() return nil, errors.New("wayland: wl_compositor_create_surface failed") } + C.wl_surface_set_buffer_scale(w.cursor.surf, C.int32_t(w.scale)) C.xdg_wm_base_add_listener(d.wm, &C.gio_xdg_wm_base_listener, unsafe.Pointer(w.surf)) C.wl_surface_add_listener(w.surf, &C.gio_surface_listener, unsafe.Pointer(w.surf)) C.xdg_surface_add_listener(w.wmSurf, &C.gio_xdg_surface_listener, unsafe.Pointer(w.surf))