aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-02 08:40:38 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-05-02 08:40:38 +1000
commitdaab8e35038e74f9b21b62cc2d7f74635fb5a34b (patch)
tree7ae5f7973d3aeef506252c1b9f72e1b110ffbcfe /sway/desktop/output.c
parentc82a04e110b55c37a24fb5175e35ab8e5bec534c (diff)
Support alpha in border colours
The alpha component is merged with the container's opacity. Completes #1882.
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index e0a211d1..4fff8cd3 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -232,10 +232,10 @@ static void render_container_simple_border_normal(struct sway_output *output,
wlr_backend_get_renderer(output->wlr_output->backend);
struct wlr_box box;
float color[4];
- color[3] = con->alpha;
// Child border - left edge
- memcpy(&color, colors->child_border, sizeof(float) * 3);
+ memcpy(&color, colors->child_border, sizeof(float) * 4);
+ color[3] *= con->alpha;
box.x = con->x;
box.y = con->y + 1;
box.width = con->sway_view->border_thickness;
@@ -246,10 +246,11 @@ static void render_container_simple_border_normal(struct sway_output *output,
// Child border - right edge
if (con->parent->children->length == 1 && con->parent->layout == L_HORIZ) {
- memcpy(&color, colors->indicator, sizeof(float) * 3);
+ memcpy(&color, colors->indicator, sizeof(float) * 4);
} else {
- memcpy(&color, colors->child_border, sizeof(float) * 3);
+ memcpy(&color, colors->child_border, sizeof(float) * 4);
}
+ color[3] *= con->alpha;
box.x = con->x + con->width - con->sway_view->border_thickness;
box.y = con->y + 1;
box.width = con->sway_view->border_thickness;
@@ -260,10 +261,11 @@ static void render_container_simple_border_normal(struct sway_output *output,
// Child border - bottom edge
if (con->parent->children->length == 1 && con->parent->layout == L_VERT) {
- memcpy(&color, colors->indicator, sizeof(float) * 3);
+ memcpy(&color, colors->indicator, sizeof(float) * 4);
} else {
- memcpy(&color, colors->child_border, sizeof(float) * 3);
+ memcpy(&color, colors->child_border, sizeof(float) * 4);
}
+ color[3] *= con->alpha;
box.x = con->x;
box.y = con->y + con->height - con->sway_view->border_thickness;
box.width = con->width;
@@ -273,7 +275,8 @@ static void render_container_simple_border_normal(struct sway_output *output,
output->wlr_output->transform_matrix);
// Single pixel bar above title
- memcpy(&color, colors->border, sizeof(float) * 3);
+ memcpy(&color, colors->border, sizeof(float) * 4);
+ color[3] *= con->alpha;
box.x = con->x;
box.y = con->y;
box.width = con->width;
@@ -292,7 +295,8 @@ static void render_container_simple_border_normal(struct sway_output *output,
output->wlr_output->transform_matrix);
// Title background
- memcpy(&color, colors->background, sizeof(float) * 3);
+ memcpy(&color, colors->background, sizeof(float) * 4);
+ color[3] *= con->alpha;
box.x = con->x + con->sway_view->border_thickness;
box.y = con->y + 1;
box.width = con->width - con->sway_view->border_thickness * 2;
@@ -314,10 +318,10 @@ static void render_container_simple_border_pixel(struct sway_output *output,
wlr_backend_get_renderer(output->wlr_output->backend);
struct wlr_box box;
float color[4];
- color[3] = con->alpha;
// Child border - left edge
- memcpy(&color, colors->child_border, sizeof(float) * 3);
+ memcpy(&color, colors->child_border, sizeof(float) * 4);
+ color[3] *= con->alpha;
box.x = con->x;
box.y = con->y;
box.width = con->sway_view->border_thickness;
@@ -328,10 +332,11 @@ static void render_container_simple_border_pixel(struct sway_output *output,
// Child border - right edge
if (con->parent->children->length == 1 && con->parent->layout == L_HORIZ) {
- memcpy(&color, colors->indicator, sizeof(float) * 3);
+ memcpy(&color, colors->indicator, sizeof(float) * 4);
} else {
- memcpy(&color, colors->child_border, sizeof(float) * 3);
+ memcpy(&color, colors->child_border, sizeof(float) * 4);
}
+ color[3] *= con->alpha;
box.x = con->x + con->width - con->sway_view->border_thickness;
box.y = con->y;
box.width = con->sway_view->border_thickness;
@@ -351,10 +356,11 @@ static void render_container_simple_border_pixel(struct sway_output *output,
// Child border - bottom edge
if (con->parent->children->length == 1 && con->parent->layout == L_VERT) {
- memcpy(&color, colors->indicator, sizeof(float) * 3);
+ memcpy(&color, colors->indicator, sizeof(float) * 4);
} else {
- memcpy(&color, colors->child_border, sizeof(float) * 3);
+ memcpy(&color, colors->child_border, sizeof(float) * 4);
}
+ color[3] *= con->alpha;
box.x = con->x;
box.y = con->y + con->height - con->sway_view->border_thickness;
box.width = con->width;