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