shell: Move weston_curtain_create params into the struct

Given that we have a struct for argument params, we might as well use it
rather than have them split between the struct and native params. For
consistency between the implementations, this also includes a shift from
float to int positioning for the base offset within the compositor's
global co-ordinate space.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent 3a298b0b05
commit d21563360a
  1. 5
      desktop-shell/shell.c
  2. 10
      kiosk-shell/kiosk-shell.c
  3. 13
      shared/shell-utils.c
  4. 4
      shared/shell-utils.h
  5. 5
      tests/safe-signal-output-removal-test.c

@ -2070,12 +2070,13 @@ create_black_surface(struct weston_compositor *ec,
{
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0,
.x = x, .y = y,
.width = w, .height = h,
.surface_committed = black_surface_committed,
.get_label = black_surface_get_label,
.surface_private = fs_view,
};
struct weston_view *view;
view = weston_curtain_create(ec, &curtain_params, x, y, w, h);
struct weston_view *view = weston_curtain_create(ec, &curtain_params);
return view;
}

@ -502,14 +502,16 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
curtain_params.g = ((bg_color >> 8) & 0xff) / 255.0;
curtain_params.b = ((bg_color >> 0) & 0xff) / 255.0;
curtain_params.x = output->x;
curtain_params.y = output->y;
curtain_params.width = output->width;
curtain_params.height = output->height;
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, &curtain_params,
output->x, output->y,
output->width,
output->height);
shoutput->background_view = weston_curtain_create(ec, &curtain_params);
weston_surface_set_role(shoutput->background_view->surface,
"kiosk-shell-background", NULL, 0);

@ -140,8 +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_curtain_params *params,
float x, float y, int w, int h)
struct weston_curtain_params *params)
{
struct weston_surface *surface = NULL;
struct weston_view *view;
@ -164,12 +163,14 @@ weston_curtain_create(struct weston_compositor *compositor,
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_init_rect(&surface->opaque, 0, 0,
params->width, params->height);
pixman_region32_fini(&surface->input);
pixman_region32_init_rect(&surface->input, 0, 0, w, h);
pixman_region32_init_rect(&surface->input, 0, 0,
params->width, params->height);
weston_surface_set_size(surface, w, h);
weston_view_set_position(view, x, y);
weston_surface_set_size(surface, params->width, params->height);
weston_view_set_position(view, params->x, params->y);
return view;
}

@ -32,6 +32,7 @@ struct weston_curtain_params {
void (*surface_committed)(struct weston_surface *es, int32_t sx, int32_t sy);
void *surface_private;
float r, g, b;
int x, y, width, height;
};
struct weston_output *
@ -54,5 +55,4 @@ surface_get_label(struct weston_surface *surface, char *buf, size_t len);
*/
struct weston_view *
weston_curtain_create(struct weston_compositor *compositor,
struct weston_curtain_params *ss,
float x, float y, int w, int h);
struct weston_curtain_params *params);

@ -81,14 +81,15 @@ output_create_view(struct test_output *t_output)
{
struct weston_curtain_params curtain_params = {
.r = 0.5, .g = 0.5, .b = 0.5,
.x = 0, .y = 0,
.width = 320, .height = 240,
.get_label = NULL,
.surface_committed = NULL,
.surface_private = NULL,
};
t_output->view = weston_curtain_create(t_output->compositor,
&curtain_params,
0, 0, 320, 240);
&curtain_params);
weston_view_set_output(t_output->view, t_output->output);
/* weston_compositor_remove_output() has to be patched with

Loading…
Cancel
Save