From 91c49c8631158701aa822e09e926c5e05d9f142e Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sun, 24 May 2026 14:15:46 +0200 Subject: [PATCH] wl_backend: fix window_clear to repaint from background pixmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wl_window_clear was filling with transparent black, which made dock/clip icons disappear after a theme change. On X11, XClearWindow repaints the window with its background pixmap — the Wayland backend now does the same. Added bg_pixmap field to frame_buf, set in window_set_background_pixmap, and used in window_clear to composite the background back into the buffer. --- src/backend/wayland/wl_backend.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index db05304..005481e 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -318,6 +318,7 @@ struct wl_frame_buf { int x, y; /* position in output coords */ int rel_x, rel_y; /* position relative to parent */ int width, height; + pixman_image_t *bg_pixmap; /* background pixmap for window_clear */ struct wl_list link; /* wl_state.frame_list */ }; @@ -6824,6 +6825,7 @@ static void wl_window_set_background_pixmap(WNativeWindow win, unsigned long pix if (fb && fb->image) { dst_img = fb->image; + fb->bg_pixmap = (pixman_image_t *)(uintptr_t)pixmap; } else { dst_img = (pixman_image_t *)W_GetViewBacking(win); } @@ -6865,15 +6867,22 @@ static void wl_window_clear(WNativeWindow win) } if (!img) return; - /* Fill with transparent black (ARGB 0x00000000) */ int width = pixman_image_get_width(img); int height = pixman_image_get_height(img); - int stride = pixman_image_get_stride(img); - uint32_t *data = (uint32_t *)pixman_image_get_data(img); - - /* Simple memset for transparent black */ - memset(data, 0, stride * height); - + + /* If a background pixmap is set, repaint from it (like XClearWindow) */ + if (fb && fb->bg_pixmap) { + pixman_image_composite32(PIXMAN_OP_SRC, + fb->bg_pixmap, NULL, img, + 0, 0, 0, 0, 0, 0, + width, height); + } else { + /* No background pixmap — fill with transparent black */ + int stride = pixman_image_get_stride(img); + uint32_t *data = (uint32_t *)pixman_image_get_data(img); + memset(data, 0, stride * height); + } + /* Notify the scene buffer of the update */ if (fb) wlr_scene_buffer_set_buffer_with_damage(fb->scene_buf, &fb->base, NULL);