From f593820edee096dc62e296af9d7514cdf4268ce4 Mon Sep 17 00:00:00 2001
From: Alexander Courtis <alex@courtis.org>
Date: Tue, 4 Aug 2020 11:53:23 +1000
Subject: #24 ensure that xwayland cursor defaults to left_ptr

---
 dwl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/dwl.c b/dwl.c
index fbdfbe0..fa59ede 100644
--- a/dwl.c
+++ b/dwl.c
@@ -243,7 +243,9 @@ static struct wl_list independents;
 static struct wlr_xdg_decoration_manager_v1 *xdeco_mgr;
 
 static struct wlr_cursor *cursor;
+static struct wlr_xcursor *xcursor;
 static struct wlr_xcursor_manager *cursor_mgr;
+static struct wlr_xcursor_manager *xcursor_mgr;
 
 static struct wlr_seat *seat;
 static struct wl_list keyboards;
@@ -1588,6 +1590,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");
-- 
cgit v1.2.3


From 2616812a7a9b3a4fd72f782cf1bafea0742da590 Mon Sep 17 00:00:00 2001
From: Alexander Courtis <alex@courtis.org>
Date: Tue, 11 Aug 2020 11:29:32 +1000
Subject: #24 ensure that xwayland cursor defaults to left_ptr

---
 dwl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dwl.c b/dwl.c
index 767b9af..4b0e144 100644
--- a/dwl.c
+++ b/dwl.c
@@ -251,9 +251,11 @@ static struct wl_list independents;
 static struct wlr_xdg_decoration_manager_v1 *xdeco_mgr;
 
 static struct wlr_cursor *cursor;
-static struct wlr_xcursor *xcursor;
 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;
-- 
cgit v1.2.3