From 3dffe7f3a641848b246b7c543c0c3ec183823cdb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 14 Mar 2022 17:44:49 +0100 Subject: [PATCH] swaybar: set opaque region When the background color is fully opaque, set the surface's opaque region to the whole surface. --- swaybar/render.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/swaybar/render.c b/swaybar/render.c index dcde6b9e..7e2f97b7 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -831,6 +831,15 @@ void render_frame(struct swaybar_output *output) { wl_surface_damage(output->surface, 0, 0, output->width, output->height); + uint32_t bg_alpha = ctx.background_color & 0xFF; + if (bg_alpha == 0xFF) { + struct wl_region *region = + wl_compositor_create_region(output->bar->compositor); + wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX); + wl_surface_set_opaque_region(output->surface, region); + wl_region_destroy(region); + } + struct wl_callback *frame_callback = wl_surface_frame(output->surface); wl_callback_add_listener(frame_callback, &output_frame_listener, output); output->frame_scheduled = true;