From 3a298b0b05c015682e4da129bed1bb85e5bb7a86 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 17 Jan 2022 13:58:16 +0000 Subject: [PATCH] shell: Rename weston_solid_color_surface to weston_curtain_params The name implied that it was a surface in and of itself, rather than parameters used by a helper to create a surface and view. Rename it now that we have weston_curtain as a name, and clean up initialisers. Signed-off-by: Daniel Stone --- desktop-shell/shell.c | 18 +++++++----------- kiosk-shell/kiosk-shell.c | 16 ++++++++-------- shared/shell-utils.c | 10 +++++----- shared/shell-utils.h | 4 ++-- tests/safe-signal-output-removal-test.c | 18 ++++++++---------- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 0597261a..3eee0bc6 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2068,18 +2068,14 @@ create_black_surface(struct weston_compositor *ec, struct weston_view *fs_view, float x, float y, int w, int h) { - struct weston_solid_color_surface surface_data = {}; + struct weston_curtain_params curtain_params = { + .r = 0.0, .g = 0.0, .b = 0.0, + .surface_committed = black_surface_committed, + .get_label = black_surface_get_label, + .surface_private = fs_view, + }; struct weston_view *view; - - surface_data.surface_committed = black_surface_committed; - surface_data.get_label = black_surface_get_label; - surface_data.surface_private = fs_view; - - surface_data.r = 0; - surface_data.g = 0; - surface_data.b = 0; - - view = weston_curtain_create(ec, &surface_data, x, y, w, h); + view = weston_curtain_create(ec, &curtain_params, x, y, w, h); return view; } diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c index 9f2c1fa6..245cde86 100644 --- a/kiosk-shell/kiosk-shell.c +++ b/kiosk-shell/kiosk-shell.c @@ -484,7 +484,7 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput) struct weston_output *output = shoutput->output; struct weston_config_section *shell_section = NULL; uint32_t bg_color = 0x0; - struct weston_solid_color_surface solid_surface = {}; + struct weston_curtain_params curtain_params = {}; if (shoutput->background_view) weston_surface_destroy(shoutput->background_view->surface); @@ -498,15 +498,15 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput) weston_config_section_get_color(shell_section, "background-color", &bg_color, 0x00000000); - solid_surface.r = ((bg_color >> 16) & 0xff) / 255.0; - solid_surface.g = ((bg_color >> 8) & 0xff) / 255.0; - solid_surface.b = ((bg_color >> 0) & 0xff) / 255.0; + curtain_params.r = ((bg_color >> 16) & 0xff) / 255.0; + curtain_params.g = ((bg_color >> 8) & 0xff) / 255.0; + curtain_params.b = ((bg_color >> 0) & 0xff) / 255.0; - solid_surface.get_label = kiosk_shell_background_surface_get_label; - solid_surface.surface_committed = NULL; - solid_surface.surface_private = NULL; + curtain_params.get_label = kiosk_shell_background_surface_get_label; + curtain_params.surface_committed = NULL; + curtain_params.surface_private = NULL; - shoutput->background_view = weston_curtain_create(ec, &solid_surface, + shoutput->background_view = weston_curtain_create(ec, &curtain_params, output->x, output->y, output->width, output->height); diff --git a/shared/shell-utils.c b/shared/shell-utils.c index 57b54d63..b4d93e43 100644 --- a/shared/shell-utils.c +++ b/shared/shell-utils.c @@ -140,7 +140,7 @@ surface_get_label(struct weston_surface *surface, char *buf, size_t len) struct weston_view * weston_curtain_create(struct weston_compositor *compositor, - struct weston_solid_color_surface *ss, + struct weston_curtain_params *params, float x, float y, int w, int h) { struct weston_surface *surface = NULL; @@ -158,11 +158,11 @@ weston_curtain_create(struct weston_compositor *compositor, return NULL; } - surface->committed = ss->surface_committed; - surface->committed_private = ss->surface_private; + surface->committed = params->surface_committed; + surface->committed_private = params->surface_private; - weston_surface_set_color(surface, ss->r, ss->g, ss->b, 1.0); - weston_surface_set_label_func(surface, ss->get_label); + weston_surface_set_color(surface, params->r, params->g, params->b, 1.0); + weston_surface_set_label_func(surface, params->get_label); pixman_region32_fini(&surface->opaque); pixman_region32_init_rect(&surface->opaque, 0, 0, w, h); pixman_region32_fini(&surface->input); diff --git a/shared/shell-utils.h b/shared/shell-utils.h index 0bfd480c..9932957b 100644 --- a/shared/shell-utils.h +++ b/shared/shell-utils.h @@ -27,7 +27,7 @@ #include /* parameter for weston_curtain_create() */ -struct weston_solid_color_surface { +struct weston_curtain_params { int (*get_label)(struct weston_surface *es, char *buf, size_t len); void (*surface_committed)(struct weston_surface *es, int32_t sx, int32_t sy); void *surface_private; @@ -54,5 +54,5 @@ surface_get_label(struct weston_surface *surface, char *buf, size_t len); */ struct weston_view * weston_curtain_create(struct weston_compositor *compositor, - struct weston_solid_color_surface *ss, + struct weston_curtain_params *ss, float x, float y, int w, int h); diff --git a/tests/safe-signal-output-removal-test.c b/tests/safe-signal-output-removal-test.c index 3aacbe84..a9f9dbca 100644 --- a/tests/safe-signal-output-removal-test.c +++ b/tests/safe-signal-output-removal-test.c @@ -79,18 +79,16 @@ notify_output_destroy(struct wl_listener *listener, void *data) static void output_create_view(struct test_output *t_output) { - struct weston_solid_color_surface solid_surface = {}; - - solid_surface.r = 0.5; - solid_surface.g = 0.5; - solid_surface.b = 0.5; - - solid_surface.get_label = NULL; - solid_surface.surface_committed = NULL; - solid_surface.surface_private = NULL; + struct weston_curtain_params curtain_params = { + .r = 0.5, .g = 0.5, .b = 0.5, + .get_label = NULL, + .surface_committed = NULL, + .surface_private = NULL, + }; t_output->view = weston_curtain_create(t_output->compositor, - &solid_surface, 0, 0, 320, 240); + &curtain_params, + 0, 0, 320, 240); weston_view_set_output(t_output->view, t_output->output); /* weston_compositor_remove_output() has to be patched with