shell: Add alpha to weston_curtain_create

Not all solid-colour views want to be opaque: sometimes we use them with
non-opaque alpha values in order to shade views underneath them.

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

@ -2069,7 +2069,7 @@ create_black_surface(struct weston_compositor *ec,
float x, float y, int w, int h)
{
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0,
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
.x = x, .y = y,
.width = w, .height = h,
.surface_committed = black_surface_committed,

@ -501,6 +501,7 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
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;
curtain_params.a = 1.0;
curtain_params.x = output->x;
curtain_params.y = output->y;

@ -160,11 +160,18 @@ weston_curtain_create(struct weston_compositor *compositor,
surface->committed = params->surface_committed;
surface->committed_private = params->surface_private;
weston_surface_set_color(surface, params->r, params->g, params->b, 1.0);
weston_surface_set_color(surface,
params->r, params->g, params->b, params->a);
weston_surface_set_label_func(surface, params->get_label);
pixman_region32_fini(&surface->opaque);
pixman_region32_init_rect(&surface->opaque, 0, 0,
params->width, params->height);
if (params->a == 1.0) {
pixman_region32_init_rect(&surface->opaque, 0, 0,
params->width, params->height);
} else {
pixman_region32_init(&surface->opaque);
}
pixman_region32_fini(&surface->input);
pixman_region32_init_rect(&surface->input, 0, 0,
params->width, params->height);

@ -31,7 +31,7 @@ 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;
float r, g, b;
float r, g, b, a;
int x, y, width, height;
};

@ -80,7 +80,7 @@ static void
output_create_view(struct test_output *t_output)
{
struct weston_curtain_params curtain_params = {
.r = 0.5, .g = 0.5, .b = 0.5,
.r = 0.5, .g = 0.5, .b = 0.5, .a = 1.0,
.x = 0, .y = 0,
.width = 320, .height = 240,
.get_label = NULL,

Loading…
Cancel
Save