From 3d1008529b5284838067859e5ca0ba87f3f42a06 Mon Sep 17 00:00:00 2001 From: lkn Date: Sat, 23 May 2026 13:58:23 +0200 Subject: [PATCH] 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. --- src/backend/wayland/wl_backend.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 0e97e46..bc5c870 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -7092,6 +7092,33 @@ wl_screen_create_internals(WScreen *scr) 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. * The WM's dock logic (dock.c) creates X11 windows on the XWayland * Display* and draws on them with Xlib — the compositor composites