wayland: fix MakeGhostIcon by handling raw pixman_image_t* drawables

wl_create_rimage_from_drawable only looked up frame_buf IDs, but
icon->pixmap on Wayland is a raw pixman_image_t* from RConvertImage,
not a frame_buf ID. When frame_buf_find fails, fall back to treating
the drawable pointer as a pixman_image_t* directly.

This fixes the ghost dock shadow (semi-transparent overlay shown
during icon drag) which was silently failing because MakeGhostIcon
returned WM_NATIVE_NONE.
This commit is contained in:
lkn 2026-06-21 18:15:36 +02:00
parent 0ace31b8a4
commit 8f45001ffc
1 changed files with 11 additions and 6 deletions

View File

@ -316,12 +316,17 @@ wl_create_rimage_from_drawable(void *rcontext, WMDrawable drawable)
if (!drawable)
return NULL;
pixman_image_t *pimg = NULL;
struct wl_frame_buf *fb = frame_buf_find((WNativeWindow)drawable);
if (!fb || !fb->image)
return NULL;
if (fb && fb->image) {
pimg = fb->image;
} else {
/* drawable may be a raw pixman_image_t* (e.g. icon->pixmap from RConvertImage) */
pimg = (pixman_image_t *)(uintptr_t)drawable;
}
int w = pixman_image_get_width(fb->image);
int h = pixman_image_get_height(fb->image);
int w = pixman_image_get_width(pimg);
int h = pixman_image_get_height(pimg);
if (w <= 0 || h <= 0)
return NULL;
@ -329,8 +334,8 @@ wl_create_rimage_from_drawable(void *rcontext, WMDrawable drawable)
if (!img)
return NULL;
uint32_t *src = (uint32_t *)pixman_image_get_data(fb->image);
int stride = pixman_image_get_stride(fb->image) / 4;
uint32_t *src = (uint32_t *)pixman_image_get_data(pimg);
int stride = pixman_image_get_stride(pimg) / 4;
unsigned char *dst = img->data;
for (int row = 0; row < h; row++) {