aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-23 19:12:58 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-23 19:12:58 -0500
commite447cd0215c0418e848251ba20483b844be659c7 (patch)
tree573d61b9206bc4e877a8b7fef68ca85ddec27c7b
parent623867a367ba8c3ee9ac1582015dcf1d6991a78f (diff)
load scaled cursor theme with each output
-rw-r--r--dwl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/dwl.c b/dwl.c
index 6f117c1..58dd523 100644
--- a/dwl.c
+++ b/dwl.c
@@ -295,6 +295,7 @@ createmon(struct wl_listener *listener, void *data)
m->mfact = monrules[i].mfact;
m->nmaster = monrules[i].nmaster;
wlr_output_set_scale(wlr_output, monrules[i].scale);
+ wlr_xcursor_manager_load(cursor_mgr, monrules[i].scale);
m->lt[0] = m->lt[1] = monrules[i].lt;
break;
}
@@ -826,9 +827,14 @@ run(char *startup_cmd)
}
/* Now that outputs are initialized, choose initial selmon based on
- * cursor position */
+ * cursor position, and set default cursor image */
selmon = xytomon(cursor->x, cursor->y);
+ /* XXX hack to get cursor to display in its initial location (100, 100)
+ * instead of (0, 0) and then jumping */
+ wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y);
+ wlr_xcursor_manager_set_cursor_image(cursor_mgr, "left_ptr", cursor);
+
/* Set the WAYLAND_DISPLAY environment variable to our socket and run the
* startup command if requested. */
setenv("WAYLAND_DISPLAY", socket, true);
@@ -957,9 +963,8 @@ setup(void)
/* Creates an xcursor manager, another wlroots utility which loads up
* Xcursor themes to source cursor images from and makes sure that cursor
* images are available at all scale factors on the screen (necessary for
- * HiDPI support). We add a cursor theme at scale factor 1 to begin with. */
+ * HiDPI support). Scaled cursors will be loaded with each output. */
cursor_mgr = wlr_xcursor_manager_create(NULL, 24);
- wlr_xcursor_manager_load(cursor_mgr, 1);
/*
* wlr_cursor *only* displays an image on screen. It does not move around