Compare commits

..

1 Commits

Author SHA1 Message Date
Zuki Air
157aecf12a fix xwayland screenshare 2025-08-05 08:36:19 +01:00
2 changed files with 11 additions and 25 deletions

View File

@ -8,8 +8,8 @@ PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man MANDIR = $(PREFIX)/share/man
DATADIR = $(PREFIX)/share DATADIR = $(PREFIX)/share
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.20` WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.20` WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19`
# Allow using an alternative wlroots installation # Allow using an alternative wlroots installation
# This has to have all the includes required by wlroots, e.g: # This has to have all the includes required by wlroots, e.g:

32
dwl.c
View File

@ -126,11 +126,7 @@ typedef struct {
struct wl_listener commit; struct wl_listener commit;
struct wlr_scene *image_capture_scene; struct wlr_scene *image_capture_scene;
struct wlr_ext_image_capture_source_v1 *image_capture_source; struct wlr_ext_image_capture_source_v1 *image_capture_source;
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel; struct wlr_scene_tree *image_capture_tree;
union {
struct wlr_scene_tree *image_capture_tree;
struct wlr_scene_surface *image_capture_scene_surface;
} capture;
struct wl_listener map; struct wl_listener map;
struct wl_listener maximize; struct wl_listener maximize;
struct wl_listener unmap; struct wl_listener unmap;
@ -140,6 +136,7 @@ typedef struct {
struct wl_listener set_decoration_mode; struct wl_listener set_decoration_mode;
struct wl_listener destroy_decoration; struct wl_listener destroy_decoration;
#ifdef XWAYLAND #ifdef XWAYLAND
struct wlr_scene_surface *image_capture_scene_surface;
struct wl_listener activate; struct wl_listener activate;
struct wl_listener associate; struct wl_listener associate;
struct wl_listener dissociate; struct wl_listener dissociate;
@ -150,6 +147,7 @@ typedef struct {
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen;
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
} Client; } Client;
typedef struct { typedef struct {
@ -1777,11 +1775,9 @@ mapnotify(struct wl_listener *listener, void *data)
c->ext_foreign_toplevel = wlr_ext_foreign_toplevel_handle_v1_create(foreign_toplevel_list,&foreign_toplevel_state); c->ext_foreign_toplevel = wlr_ext_foreign_toplevel_handle_v1_create(foreign_toplevel_list,&foreign_toplevel_state);
c->ext_foreign_toplevel->data = c; c->ext_foreign_toplevel->data = c;
if (c->type == XDGShell) { if (c->type == XDGShell) {
c->capture.image_capture_tree = wlr_scene_xdg_surface_create(&c->image_capture_scene->tree, c->surface.xdg); c->image_capture_tree = wlr_scene_xdg_surface_create(&c->image_capture_scene->tree, c->surface.xdg);
#ifdef XWAYLAND
} else { /* xwayland */ } else { /* xwayland */
c->capture.image_capture_scene_surface = wlr_scene_surface_create(&c->image_capture_scene->tree, c->surface.xwayland->surface); c->image_capture_scene_surface = wlr_scene_surface_create(&c->image_capture_scene->tree, c->surface.xwayland->surface);
#endif
} }
@ -2884,16 +2880,13 @@ unmapnotify(struct wl_listener *listener, void *data)
setmon(c, NULL, 0); setmon(c, NULL, 0);
wl_list_remove(&c->flink); wl_list_remove(&c->flink);
} }
if (c->ext_foreign_toplevel != NULL) { if (c->ext_foreign_toplevel) {
wlr_ext_foreign_toplevel_handle_v1_destroy(c->ext_foreign_toplevel); wlr_ext_foreign_toplevel_handle_v1_destroy(c->ext_foreign_toplevel);
c->ext_foreign_toplevel = NULL;
} }
#ifdef XWAYLAND if (c->image_capture_scene_surface) {
if (c->type != XDGShell && c->capture.image_capture_scene_surface) { wlr_scene_node_destroy(&c->image_capture_scene_surface->buffer->node);
wlr_scene_node_destroy(&c->capture.image_capture_scene_surface->buffer->node); c->image_capture_scene_surface = NULL;
c->capture.image_capture_scene_surface = NULL;
} }
#endif
wlr_scene_node_destroy(&c->image_capture_scene->tree.node); wlr_scene_node_destroy(&c->image_capture_scene->tree.node);
wlr_scene_node_destroy(&c->scene->node); wlr_scene_node_destroy(&c->scene->node);
@ -3013,13 +3006,6 @@ updatetitle(struct wl_listener *listener, void *data)
Client *c = wl_container_of(listener, c, set_title); Client *c = wl_container_of(listener, c, set_title);
if (c == focustop(c->mon)) if (c == focustop(c->mon))
printstatus(); printstatus();
if (c->ext_foreign_toplevel != NULL) {
struct wlr_ext_foreign_toplevel_handle_v1_state foreign_toplevel_state = {
.app_id = client_get_appid(c),
.title = client_get_title(c),
};
wlr_ext_foreign_toplevel_handle_v1_update_state(c->ext_foreign_toplevel,&foreign_toplevel_state);
}
} }
void void