diff options
author | Benoit Gschwind <gschwind@gnu-log.net> | 2016-04-28 20:33:11 +0200 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2016-05-04 15:40:56 +0300 |
commit | 244ff799fb7008f5de75050ef922b7c7a7399f37 (patch) | |
tree | c33e8b21d2e198e7070f93d0d48ee8022af0af07 | |
parent | 3a49b51f8ed4429eb7239de3498046a5dcde2b0f (diff) | |
download | weston-244ff799fb7008f5de75050ef922b7c7a7399f37.tar.gz |
compositor-wayland: move config parsing in create_cursor
Move configuration parsing from create_cursor to backend_init. Use newer
configuration structure to initialize the cursor in create_cursor.
Signed-off-by: Benoit Gschwind <gschwind@gnu-log.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r-- | src/compositor-wayland.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 04400579..175bd686 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -57,6 +57,8 @@ struct weston_wayland_backend_config { int sprawl; char *display_name; int fullscreen; + char *cursor_theme; + int cursor_size; }; struct wayland_backend { @@ -2174,25 +2176,19 @@ static const char *left_ptrs[] = { }; static void -create_cursor(struct wayland_backend *b, struct weston_config *config) +create_cursor(struct wayland_backend *b, + struct weston_wayland_backend_config *config) { - struct weston_config_section *s; - int size; - char *theme = NULL; unsigned int i; - 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); - - b->cursor_theme = wl_cursor_theme_load(theme, size, b->parent.shm); + b->cursor_theme = wl_cursor_theme_load(config->cursor_theme, + config->cursor_size, + b->parent.shm); if (!b->cursor_theme) { fprintf(stderr, "could not load cursor theme\n"); return; } - free(theme); - b->cursor = NULL; for (i = 0; !b->cursor && i < ARRAY_LENGTH(left_ptrs); ++i) b->cursor = wl_cursor_theme_get_cursor(b->cursor_theme, @@ -2254,7 +2250,7 @@ wayland_backend_create(struct weston_compositor *compositor, wl_registry_add_listener(b->parent.registry, ®istry_listener, b); wl_display_roundtrip(b->parent.wl_display); - create_cursor(b, config); + create_cursor(b, new_config); b->use_pixman = new_config->use_pixman; @@ -2366,6 +2362,15 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[], parse_options(wayland_options, ARRAY_LENGTH(wayland_options), argc, argv); + new_config.cursor_size = 32; + new_config.cursor_theme = NULL; + + section = weston_config_get_section(config, "shell", NULL, NULL); + weston_config_section_get_string(section, "cursor-theme", + &new_config.cursor_theme, NULL); + weston_config_section_get_int(section, "cursor-size", + &new_config.cursor_size, 32); + b = wayland_backend_create(compositor, &new_config, argc, argv, config); if (!b) @@ -2438,12 +2443,13 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[], weston_compositor_add_key_binding(compositor, KEY_F, MODIFIER_CTRL | MODIFIER_ALT, fullscreen_binding, b); - + free(new_config.cursor_theme); free(new_config.display_name); return 0; err_outputs: wayland_backend_destroy(b); + free(new_config.cursor_theme); free(new_config.display_name); return -1; } |