diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-12-11 05:14:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 05:14:40 -0500 |
commit | 301850ec5d1a65aed87734583ed0868694f1913a (patch) | |
tree | b5cc088bb7e6e97e1a9c43ee6d1a955b95bdd27d /rootston | |
parent | 8ccb5b0b6674999f83775cd583cc610a2e03fb54 (diff) | |
parent | 925497fbeaed9a2eb8420490e6cdfa4fd162e79e (diff) |
Merge pull request #480 from emersion/default-cursor-image
Set default cursor image in rootston
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/config.c | 4 | ||||
-rw-r--r-- | rootston/cursor.c | 3 | ||||
-rw-r--r-- | rootston/desktop.c | 6 | ||||
-rw-r--r-- | rootston/seat.c | 5 |
4 files changed, 15 insertions, 3 deletions
diff --git a/rootston/config.c b/rootston/config.c index 6e596852..db77506f 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -176,6 +176,9 @@ static void config_handle_cursor(struct roots_config *config, } else if (strcmp(name, "theme") == 0) { free(cc->theme); cc->theme = strdup(value); + } else if (strcmp(name, "default-image") == 0) { + free(cc->default_image); + cc->default_image = strdup(value); } else { wlr_log(L_ERROR, "got unknown cursor config: %s", name); } @@ -454,6 +457,7 @@ void roots_config_destroy(struct roots_config *config) { free(cc->mapped_output); free(cc->mapped_box); free(cc->theme); + free(cc->default_image); free(cc); } diff --git a/rootston/cursor.c b/rootston/cursor.c index d38e40a1..95e8ce2a 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -22,6 +22,7 @@ struct roots_cursor *roots_cursor_create(struct roots_seat *seat) { free(cursor); return NULL; } + cursor->default_xcursor = ROOTS_XCURSOR_DEFAULT; return cursor; } @@ -48,7 +49,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor, } if (set_compositor_cursor) { wlr_xcursor_manager_set_cursor_image(cursor->xcursor_manager, - ROOTS_XCURSOR_DEFAULT, cursor->cursor); + cursor->default_xcursor, cursor->cursor); cursor->cursor_client = NULL; } if (view) { diff --git a/rootston/desktop.c b/rootston/desktop.c index 244f7c94..ef459e69 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -408,10 +408,14 @@ struct roots_desktop *desktop_create(struct roots_server *server, desktop->config = config; const char *cursor_theme = NULL; + const char *cursor_default = ROOTS_XCURSOR_DEFAULT; struct roots_cursor_config *cc = roots_config_get_cursor(config, ROOTS_CONFIG_DEFAULT_SEAT_NAME); if (cc != NULL) { cursor_theme = cc->theme; + if (cc->default_image != NULL) { + cursor_default = cc->default_image; + } } desktop->xcursor_manager = wlr_xcursor_manager_create(cursor_theme, @@ -449,7 +453,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, wlr_log(L_ERROR, "Cannot load XWayland XCursor theme"); } struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor( - desktop->xcursor_manager, ROOTS_XCURSOR_DEFAULT, 1); + desktop->xcursor_manager, cursor_default, 1); if (xcursor != NULL) { struct wlr_xcursor_image *image = xcursor->images[0]; wlr_xwayland_set_cursor(desktop->xwayland, image->buffer, diff --git a/rootston/seat.c b/rootston/seat.c index cb245ca8..8a581157 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -442,6 +442,9 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) { roots_config_get_cursor(seat->input->config, seat->seat->name); if (cc != NULL) { cursor_theme = cc->theme; + if (cc->default_image != NULL) { + seat->cursor->default_xcursor = cc->default_image; + } } if (!seat->cursor->xcursor_manager) { @@ -465,7 +468,7 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) { } wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager, - ROOTS_XCURSOR_DEFAULT, seat->cursor->cursor); + seat->cursor->default_xcursor, seat->cursor->cursor); wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x, seat->cursor->cursor->y); } |