weston: fix boolean wayland backend options

Surprisingly, WESTON_OPTION_BOOLEAN uses the type int32_t, not bool.
Passing in a pointer bool does not end well. Fix this to pass in
pointers as parse_options() expects.

This fixes a bug where 'weston --use-pixman --sprawl' would work but
'weston --sprawl --use-pixman' would ignore the --sprawl option.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
dev
Pekka Paalanen 7 years ago
parent efade28db9
commit aedcd8ebb0
  1. 15
      compositor/main.c

@ -1612,6 +1612,9 @@ load_wayland_backend(struct weston_compositor *c,
int count = 1; int count = 1;
int ret = 0; int ret = 0;
int i; int i;
int32_t use_pixman_ = 0;
int32_t sprawl_ = 0;
int32_t fullscreen_ = 0;
struct wet_output_config *parsed_options = wet_init_parsed_options(c); struct wet_output_config *parsed_options = wet_init_parsed_options(c);
if (!parsed_options) if (!parsed_options)
@ -1620,22 +1623,22 @@ load_wayland_backend(struct weston_compositor *c,
config.cursor_size = 32; config.cursor_size = 32;
config.cursor_theme = NULL; config.cursor_theme = NULL;
config.display_name = NULL; config.display_name = NULL;
config.fullscreen = false;
config.sprawl = false;
config.use_pixman = false;
const struct weston_option wayland_options[] = { const struct weston_option wayland_options[] = {
{ WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width }, { WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
{ WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height }, { WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
{ WESTON_OPTION_INTEGER, "scale", 0, &parsed_options->scale }, { WESTON_OPTION_INTEGER, "scale", 0, &parsed_options->scale },
{ WESTON_OPTION_STRING, "display", 0, &config.display_name }, { WESTON_OPTION_STRING, "display", 0, &config.display_name },
{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman }, { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
{ WESTON_OPTION_INTEGER, "output-count", 0, &count }, { WESTON_OPTION_INTEGER, "output-count", 0, &count },
{ WESTON_OPTION_BOOLEAN, "fullscreen", 0, &config.fullscreen }, { WESTON_OPTION_BOOLEAN, "fullscreen", 0, &fullscreen_ },
{ WESTON_OPTION_BOOLEAN, "sprawl", 0, &config.sprawl }, { WESTON_OPTION_BOOLEAN, "sprawl", 0, &sprawl_ },
}; };
parse_options(wayland_options, ARRAY_LENGTH(wayland_options), argc, argv); parse_options(wayland_options, ARRAY_LENGTH(wayland_options), argc, argv);
config.sprawl = sprawl_;
config.use_pixman = use_pixman_;
config.fullscreen = fullscreen_;
section = weston_config_get_section(wc, "shell", NULL, NULL); section = weston_config_get_section(wc, "shell", NULL, NULL);
weston_config_section_get_string(section, "cursor-theme", weston_config_section_get_string(section, "cursor-theme",

Loading…
Cancel
Save