wl_backend: fix window_clear to repaint from background pixmap

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.
This commit is contained in:
Window Maker 2026-05-24 14:15:46 +02:00
parent 0d795bc84a
commit 91c49c8631
1 changed files with 16 additions and 7 deletions

View File

@ -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);