aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-10 10:06:55 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-10 10:06:55 +0000
commitbf62519d8330204b12e9e3743fb332e3abde0ed0 (patch)
tree2a78f621b8121895e47691c7a1cfb212faa75551
parentseat: use separate 'enter' serials for keyboard and mouse (diff)
wayland: read XCURSOR_{THEME,SIZE} in reload_xcursor theme
-rw-r--r--render.c3
-rw-r--r--wayland.c42
-rw-r--r--wayland.h5
3 files changed, 16 insertions, 34 deletions
diff --git a/render.c b/render.c
index 603f9c2d..670b9282 100644
--- a/render.c
+++ b/render.c
@@ -1956,8 +1956,7 @@ render_xcursor_update(struct seat *seat)
seat->pointer.theme, seat->pointer.xcursor);
if (seat->pointer.cursor == NULL) {
- LOG_ERR("%s: failed to load xcursor pointer '%s'",
- seat->pointer.theme_name, seat->pointer.xcursor);
+ LOG_ERR("failed to load xcursor pointer '%s'", seat->pointer.xcursor);
return;
}
diff --git a/wayland.c b/wayland.c
index 38ef57f0..2ba385fa 100644
--- a/wayland.c
+++ b/wayland.c
@@ -96,7 +96,6 @@ seat_destroy(struct seat *seat)
if (seat->kbd.repeat.fd >= 0)
fdm_del(seat->wayl->fdm, seat->kbd.repeat.fd);
- free(seat->pointer.theme_name);
if (seat->pointer.theme != NULL)
wl_cursor_theme_destroy(seat->pointer.theme);
if (seat->pointer.surface != NULL)
@@ -718,8 +717,6 @@ handle_global(void *data, struct wl_registry *registry,
},
.pointer = {
.surface = pointer_surf,
- .size = wayl->xcursor_size,
- .theme_name = wayl->xcursor_theme != NULL ? strdup(wayl->xcursor_theme) : NULL,
},
.data_device = data_device,
.primary_selection_device = primary_selection_device,
@@ -926,23 +923,6 @@ wayl_init(const struct config *conf, struct fdm *fdm)
wayl->fdm = fdm;
wayl->fd = -1;
- /* XCursor */
- const char *xcursor_theme = getenv("XCURSOR_THEME");
- if (xcursor_theme != NULL)
- wayl->xcursor_theme = strdup(xcursor_theme);
- wayl->xcursor_size = 24;
-
- {
- const char *env_cursor_size = getenv("XCURSOR_SIZE");
- if (env_cursor_size != NULL) {
- unsigned size;
- if (sscanf(env_cursor_size, "%u", &size) == 1)
- wayl->xcursor_size = size;
- }
- }
-
- LOG_INFO("XCURSOR_THEME=%s, XCURSOR_SIZE=%u", wayl->xcursor_theme, wayl->xcursor_size);
-
if (!fdm_hook_add(fdm, &fdm_hook, wayl, FDM_HOOK_PRIORITY_LOW)) {
LOG_ERR("failed to add FDM hook");
goto out;
@@ -1085,7 +1065,6 @@ wayl_destroy(struct wayland *wayl)
if (wayl->display != NULL)
wl_display_disconnect(wayl->display);
- free(wayl->xcursor_theme);
free(wayl);
}
@@ -1223,9 +1202,6 @@ wayl_win_destroy(struct wl_window *win)
bool
wayl_reload_xcursor_theme(struct seat *seat, int new_scale)
{
- if (seat->pointer.size == 0)
- return true;
-
if (seat->pointer.theme != NULL && seat->pointer.scale == new_scale) {
/* We already have a theme loaded, and the scale hasn't changed */
return true;
@@ -1238,11 +1214,23 @@ wayl_reload_xcursor_theme(struct seat *seat, int new_scale)
seat->pointer.cursor = NULL;
}
- LOG_DBG("reloading cursor theme: %s@%d",
- seat->pointer.theme_name, seat->pointer.size);
+ const char *xcursor_theme = getenv("XCURSOR_THEME");
+ int xcursor_size = 24;
+
+ {
+ const char *env_cursor_size = getenv("XCURSOR_SIZE");
+ if (env_cursor_size != NULL) {
+ unsigned size;
+ if (sscanf(env_cursor_size, "%u", &size) == 1)
+ xcursor_size = size;
+ }
+ }
+
+ LOG_INFO("cursor theme: %s, size: %u, scale: %d",
+ xcursor_theme, xcursor_size, new_scale);
seat->pointer.theme = wl_cursor_theme_load(
- seat->pointer.theme_name, seat->pointer.size * new_scale, seat->wayl->shm);
+ xcursor_theme, xcursor_size * new_scale, seat->wayl->shm);
if (seat->pointer.theme == NULL) {
LOG_ERR("failed to load cursor theme");
diff --git a/wayland.h b/wayland.h
index 0b136c04..224853a6 100644
--- a/wayland.h
+++ b/wayland.h
@@ -147,9 +147,7 @@ struct seat {
struct wl_surface *surface;
struct wl_cursor_theme *theme;
struct wl_cursor *cursor;
- int size;
int scale;
- char *theme_name;
const char *xcursor;
struct wl_callback *xcursor_callback;
@@ -318,9 +316,6 @@ struct wayland {
tll(struct seat) seats;
tll(struct terminal *) terms;
-
- char *xcursor_theme;
- unsigned xcursor_size;
};
struct wayland *wayl_init(const struct config *conf, struct fdm *fdm);