diff options
author | Daniel Stone <daniels@collabora.com> | 2022-01-18 18:17:17 +0000 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2022-03-31 17:15:55 +0000 |
commit | e81b8d7cc92c2bf88c3afd25445022857d9310a8 (patch) | |
tree | 3730890ffd9af033e4da6c61493d7051b6f5f485 /shared | |
parent | d21563360a511e3d0434a8e87e23db83d85d8bb2 (diff) | |
download | weston-e81b8d7cc92c2bf88c3afd25445022857d9310a8.tar.gz |
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>
Diffstat (limited to 'shared')
-rw-r--r-- | shared/shell-utils.c | 13 | ||||
-rw-r--r-- | shared/shell-utils.h | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/shared/shell-utils.c b/shared/shell-utils.c index 51255a5b..d4505f73 100644 --- a/shared/shell-utils.c +++ b/shared/shell-utils.c @@ -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); diff --git a/shared/shell-utils.h b/shared/shell-utils.h index f8c508ff..c5e648f1 100644 --- a/shared/shell-utils.h +++ b/shared/shell-utils.h @@ -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; }; |