aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-12-24 21:37:48 -0500
committerGitHub <noreply@github.com>2020-12-24 21:37:48 -0500
commitcfe78159033968d80a83b7f879f8281267cc2751 (patch)
tree03245220fe330b7c307840ffe40db12c1162bd19 /dwl.c
parent7803022d331c87a4d0ec827af3735c0f8b206676 (diff)
parent2616812a7a9b3a4fd72f782cf1bafea0742da590 (diff)
Merge pull request #32 from alex-courtis/24-xwayland-cursor
#24 ensure that xwayland cursor defaults to left_ptr
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 8a03247..1ffae9c 100644
--- a/dwl.c
+++ b/dwl.c
@@ -305,6 +305,10 @@ static struct wlr_xdg_decoration_manager_v1 *xdeco_mgr;
static struct wlr_cursor *cursor;
static struct wlr_xcursor_manager *cursor_mgr;
+#ifdef XWAYLAND
+static struct wlr_xcursor *xcursor;
+static struct wlr_xcursor_manager *xcursor_mgr;
+#endif
static struct wlr_seat *seat;
static struct wl_list keyboards;
@@ -2049,6 +2053,20 @@ setup(void)
wl_signal_add(&xwayland->events.ready, &xwayland_ready);
wl_signal_add(&xwayland->events.new_surface, &new_xwayland_surface);
+ /*
+ * Create the XWayland cursor manager at scale 1, setting its default
+ * pointer to match the rest of dwl.
+ */
+ xcursor_mgr = wlr_xcursor_manager_create(NULL, 24);
+ wlr_xcursor_manager_load(xcursor_mgr, 1);
+ xcursor = wlr_xcursor_manager_get_xcursor(xcursor_mgr, "left_ptr", 1);
+ if (xcursor) {
+ wlr_xwayland_set_cursor(xwayland,
+ xcursor->images[0]->buffer, xcursor->images[0]->width * 4,
+ xcursor->images[0]->width, xcursor->images[0]->height,
+ xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y);
+ }
+
setenv("DISPLAY", xwayland->display_name, true);
} else {
fprintf(stderr, "failed to setup XWayland X server, continuing without it\n");