diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index cd5d251..f7e423f 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -7885,8 +7885,14 @@ wl_client_reparent(WNativeWindow client, WNativeWindow new_parent, int x, int y) fprintf(stderr, "reparent_framebuf: client=0x%lx fb=%p new_parent=0x%lx parent_fb=%p\n", (unsigned long)client, (void*)fb, (unsigned long)new_parent, (void*)parent_fb); - if (fb) fprintf(stderr, " fb: tree=%p scene_buf=%p\n", (void*)fb->tree, (void*)fb->scene_buf); - if (parent_fb) fprintf(stderr, " parent_fb: tree=%p\n", (void*)parent_fb->tree); + if (fb) fprintf(stderr, " fb: tree=%p scene_buf=%p pos=(%d,%d)\n", + (void*)fb->tree, (void*)fb->scene_buf, + fb->tree ? fb->tree->node.x : -1, + fb->tree ? fb->tree->node.y : -1); + if (parent_fb) fprintf(stderr, " parent_fb: tree=%p pos=(%d,%d)\n", + (void*)parent_fb->tree, + parent_fb->tree ? parent_fb->tree->node.x : -1, + parent_fb->tree ? parent_fb->tree->node.y : -1); if (fb && parent_fb) { fb->parent_id = new_parent; fb->rel_x = x; @@ -7994,10 +8000,12 @@ void wl_view_commit_backing_impl(unsigned long id) if (fb && fb->scene_buf) { /* Sync position from the WINGs view — it may have moved since * the frame_buf was created (e.g. switch panel is positioned - * after widget creation via WMMoveWidget). */ + * after widget creation via WMMoveWidget). + * When reparented (parent_id set), use the relative offset + * instead of the view's absolute position. */ extern W_View *W_GetViewForWindow(unsigned long id); W_View *v = W_GetViewForWindow((unsigned long)id); - if (v) { + if (v && !fb->parent_id) { if (fb->x != v->pos.x || fb->y != v->pos.y) { fb->x = v->pos.x; fb->y = v->pos.y;