fix xwayland screenshare

This commit is contained in:
Zuki Air 2025-08-05 08:28:10 +01:00
parent 4087f8a3c8
commit 32126eb87b

15
dwl.c
View File

@ -136,6 +136,7 @@ typedef struct {
struct wl_listener set_decoration_mode;
struct wl_listener destroy_decoration;
#ifdef XWAYLAND
struct wlr_scene_surface *image_capture_scene_surface;
struct wl_listener activate;
struct wl_listener associate;
struct wl_listener dissociate;
@ -1773,7 +1774,13 @@ mapnotify(struct wl_listener *listener, void *data)
c->image_capture_scene = wlr_scene_create();
c->ext_foreign_toplevel = wlr_ext_foreign_toplevel_handle_v1_create(foreign_toplevel_list,&foreign_toplevel_state);
c->ext_foreign_toplevel->data = c;
c->image_capture_tree = wlr_scene_xdg_surface_create(&c->image_capture_scene->tree, c->surface.xdg);
if (c->type == XDGShell) {
c->image_capture_tree = wlr_scene_xdg_surface_create(&c->image_capture_scene->tree, c->surface.xdg);
#ifdef XWAYLAND
} else { /* xwayland */
c->image_capture_scene_surface = wlr_scene_surface_create(&c->image_capture_scene->tree, c->surface.xwayland->surface);
#endif
}
client_get_geometry(c, &c->geom);
@ -2878,6 +2885,12 @@ unmapnotify(struct wl_listener *listener, void *data)
if (c->ext_foreign_toplevel) {
wlr_ext_foreign_toplevel_handle_v1_destroy(c->ext_foreign_toplevel);
}
#ifdef XWAYLAND
if (c->image_capture_scene_surface) {
wlr_scene_node_destroy(&c->image_capture_scene_surface->buffer->node);
c->image_capture_scene_surface = NULL;
}
#endif
wlr_scene_node_destroy(&c->image_capture_scene->tree.node);
wlr_scene_node_destroy(&c->scene->node);