B2: create dock_shadow frame_buf for icon drag ghost overlay

The dock icon drag code (appicon.c, dock.c) uses scr->dock_shadow as a
visual ghost showing the target dock slot. On X11 this is an InputOutput
window; on Wayland it was never created, making all drag shadow
operations no-ops.

Create dock_shadow as a wl_frame_buf with a scene_buffer in the overlay
layer, starting disabled. All existing vtable ops (window_move, map,
unmap, set_background_pixmap, stacking_restack) already handle
frame_bufs, so no additional plumbing needed.
This commit is contained in:
lkn 2026-05-23 13:58:23 +02:00
parent 403ee93ec4
commit 3d1008529b
1 changed files with 27 additions and 0 deletions

View File

@ -7092,6 +7092,33 @@ wl_screen_create_internals(WScreen *scr)
scr->info_window = (WNativeWindow)xwin; scr->info_window = (WNativeWindow)xwin;
} }
/* Create dock_shadow: scene_buffer used as ghost overlay during icon drag */
if (wl_state.scene) {
int sz = wPreferences.icon_size;
struct wl_frame_buf *dsfb = wmalloc(sizeof(*dsfb));
memset(dsfb, 0, sizeof(*dsfb));
dsfb->image = pixman_image_create_bits(PIXMAN_a8r8g8b8, sz, sz, NULL, sz * 4);
if (dsfb->image) {
wlr_buffer_init(&dsfb->base, &frame_buf_impl, sz, sz);
dsfb->id = wl_state.next_synthetic_id++;
dsfb->width = sz;
dsfb->height = sz;
struct wlr_scene_tree *ds_parent = wl_state.level_trees[WL_LAYER_OVERLAY]
? wl_state.level_trees[WL_LAYER_OVERLAY] : &wl_state.scene->tree;
dsfb->tree = wlr_scene_tree_create(ds_parent);
if (dsfb->tree) {
dsfb->scene_buf = wlr_scene_buffer_create(dsfb->tree, &dsfb->base);
if (dsfb->scene_buf)
wlr_scene_node_set_enabled(&dsfb->scene_buf->node, false);
wlr_scene_node_set_enabled(&dsfb->tree->node, false);
}
wl_list_insert(&wl_state.frame_list, &dsfb->link);
scr->dock_shadow = dsfb->id;
} else {
wfree(dsfb);
}
}
/* Phase 30: dock/clip now uses XWayland windows for rendering. /* Phase 30: dock/clip now uses XWayland windows for rendering.
* The WM's dock logic (dock.c) creates X11 windows on the XWayland * The WM's dock logic (dock.c) creates X11 windows on the XWayland
* Display* and draws on them with Xlib — the compositor composites * Display* and draws on them with Xlib — the compositor composites