aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkolunmi <113054217+kolunmi@users.noreply.github.com>2023-07-23 06:23:56 -0700
committerGitHub <noreply@github.com>2023-07-23 06:23:56 -0700
commitef6e82cc83bbdef9330af87281a4768539625d4a (patch)
tree0c330f279427d191edf0255d11753b642c30b5d2
parent416cbdf29d63673713e06d9bd62d941c14e726f3 (diff)
parentf2e4a19158a41c8b92a0ed28b4e612b391550d91 (diff)
downloaddwlb-ef6e82cc83bbdef9330af87281a4768539625d4a.tar.gz
Merge pull request #17 from NikitaIvanovV/fix-xcursor-theme-size
Fix xcursor theme size
-rw-r--r--dwlb.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/dwlb.c b/dwlb.c
index b445e8b..f512caa 100644
--- a/dwlb.c
+++ b/dwlb.c
@@ -589,6 +589,22 @@ pointer_enter(void *data, struct wl_pointer *pointer,
break;
}
}
+
+ if (!cursor_image) {
+ const char *size_str = getenv("XCURSOR_SIZE");
+ int size = size_str ? atoi(size_str) : 0;
+ if (size == 0)
+ size = 24;
+ struct wl_cursor_theme *cursor_theme = wl_cursor_theme_load(getenv("XCURSOR_THEME"), size * buffer_scale, shm);
+ cursor_image = wl_cursor_theme_get_cursor(cursor_theme, "left_ptr")->images[0];
+ cursor_surface = wl_compositor_create_surface(compositor);
+ wl_surface_set_buffer_scale(cursor_surface, buffer_scale);
+ wl_surface_attach(cursor_surface, wl_cursor_image_get_buffer(cursor_image), 0, 0);
+ wl_surface_commit(cursor_surface);
+ }
+ wl_pointer_set_cursor(pointer, serial, cursor_surface,
+ cursor_image->hotspot_x,
+ cursor_image->hotspot_y);
}
static void