From 807cd2e589140e069cd1c4863650d8019c997d57 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 10 Oct 2018 09:46:12 +0200 Subject: [PATCH] clients: configure cursor theme from XCURSOR_* env If XCURSOR_THEME or XCURSOR_SIZE is set, use it as the cursor theme or cursor size. This is similar to what Qt and some X11 apps do. --- clients/window.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clients/window.c b/clients/window.c index b64e96cf..12939cb7 100644 --- a/clients/window.c +++ b/clients/window.c @@ -1340,16 +1340,20 @@ create_cursors(struct display *display) const char *config_file; struct weston_config *config; struct weston_config_section *s; - int size; + int size = 32; char *theme = NULL; unsigned int i, j; struct wl_cursor *cursor; + theme = getenv("XCURSOR_THEME"); + if (getenv("XCURSOR_SIZE")) + size = atoi(getenv("XCURSOR_SIZE")); + config_file = weston_config_get_name_from_env(); config = weston_config_parse(config_file); s = weston_config_get_section(config, "shell", NULL, NULL); - weston_config_section_get_string(s, "cursor-theme", &theme, NULL); - weston_config_section_get_int(s, "cursor-size", &size, 32); + weston_config_section_get_string(s, "cursor-theme", &theme, theme); + weston_config_section_get_int(s, "cursor-size", &size, size); weston_config_destroy(config); display->cursor_theme = wl_cursor_theme_load(theme, size, display->shm);