]> git.mdlowis.com Git - proto/labwc.git/commitdiff
ssd: work around the translucent titlebar in pixman renderer
authortokyo4j <hrak1529@gmail.com>
Thu, 26 Jun 2025 10:39:36 +0000 (19:39 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Fri, 27 Jun 2025 07:21:25 +0000 (16:21 +0900)
Due to wlroots/pixman bug, the widened 1px buffer for the gradient
titlebar become translucent with WLR_RENDERER=pixman and
WLR_SCALE_FILTER_BILINEAR filter mode. This patch works around this
problem by using WLR_SCALE_FILTER_NEAREST filter mode if pixman
renderer is used.

src/ssd/ssd-titlebar.c

index e57134ad4afd99a5553e5ccdca13d81a5884f9f0..d44adf419dcbaac9a0136ff1930138c2d215c5b2 100644 (file)
@@ -3,6 +3,7 @@
 #define _POSIX_C_SOURCE 200809L
 #include <assert.h>
 #include <string.h>
+#include <wlr/render/pixman.h>
 #include "buffer.h"
 #include "config.h"
 #include "common/mem.h"
@@ -57,8 +58,23 @@ ssd_titlebar_create(struct ssd *ssd)
                wl_list_init(&subtree->parts);
 
                /* Background */
-               add_scene_buffer(&subtree->parts, LAB_SSD_PART_TITLEBAR, parent,
-                       titlebar_fill, corner_width, 0);
+               struct wlr_scene_buffer *bg_scene_buffer =
+                       wlr_scene_buffer_create(parent, titlebar_fill);
+               /*
+                * Work around the wlroots/pixman bug that widened 1px buffer
+                * becomes translucent when bilinear filtering is used.
+                * TODO: remove once https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3990
+                * is solved
+                */
+               if (wlr_renderer_is_pixman(view->server->renderer)) {
+                       wlr_scene_buffer_set_filter_mode(
+                               bg_scene_buffer, WLR_SCALE_FILTER_NEAREST);
+               }
+               struct ssd_part *bg_part =
+                       add_scene_part(&subtree->parts, LAB_SSD_PART_TITLEBAR);
+               bg_part->node = &bg_scene_buffer->node;
+               wlr_scene_node_set_position(bg_part->node, corner_width, 0);
+
                add_scene_buffer(&subtree->parts, LAB_SSD_PART_TITLEBAR_CORNER_LEFT, parent,
                        corner_top_left, -rc.theme->border_width, -rc.theme->border_width);
                add_scene_buffer(&subtree->parts, LAB_SSD_PART_TITLEBAR_CORNER_RIGHT, parent,