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