Compare commits

...

5 Commits

Author SHA1 Message Date
Zuki Air
61e198d7a1 fix crashes with windows changing their title after unmapnotify is called 2025-08-05 20:35:15 +01:00
Zuki Air
9859268ca3 switch to wlroots-0.20 in config.mk 2025-08-05 16:48:36 +01:00
Zuki Air
f43772a20d update foreign_toplevel_state on title change
this commit means that in the xdg-desktop-portal-wlr picker it should
show up to date title names rather then the one the client spawned with
2025-08-05 14:30:38 +01:00
Zuki Air
8b27e5c859 switch to using union for *image_capture_tree and *image_capture_scene_surface in screencapture
only image_capture_tree is needed for screensharing single wayland
windows and only image_capture_scene_surface is needed for screensharing
single xwayland windows. Making them into a union makes sense for
reducing memory usage.
2025-08-05 14:09:11 +01:00
Zuki Air
32126eb87b fix xwayland screenshare 2025-08-05 13:52:58 +01:00
2 changed files with 29 additions and 6 deletions

View File

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

31
dwl.c
View File

@ -126,7 +126,11 @@ typedef struct {
struct wl_listener commit;
struct wlr_scene *image_capture_scene;
struct wlr_ext_image_capture_source_v1 *image_capture_source;
struct wlr_scene_tree *image_capture_tree;
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
union {
struct wlr_scene_tree *image_capture_tree;
struct wlr_scene_surface *image_capture_scene_surface;
} capture;
struct wl_listener map;
struct wl_listener maximize;
struct wl_listener unmap;
@ -146,7 +150,6 @@ typedef struct {
uint32_t tags;
int isfloating, isurgent, isfullscreen;
uint32_t resize; /* configure serial of a pending resize */
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
} Client;
typedef struct {
@ -1773,7 +1776,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->capture.image_capture_tree = wlr_scene_xdg_surface_create(&c->image_capture_scene->tree, c->surface.xdg);
#ifdef XWAYLAND
} else { /* xwayland */
c->capture.image_capture_scene_surface = wlr_scene_surface_create(&c->image_capture_scene->tree, c->surface.xwayland->surface);
#endif
}
client_get_geometry(c, &c->geom);
@ -2875,9 +2884,16 @@ unmapnotify(struct wl_listener *listener, void *data)
setmon(c, NULL, 0);
wl_list_remove(&c->flink);
}
if (c->ext_foreign_toplevel) {
if (c->ext_foreign_toplevel != NULL) {
wlr_ext_foreign_toplevel_handle_v1_destroy(c->ext_foreign_toplevel);
c->ext_foreign_toplevel = NULL;
}
#ifdef XWAYLAND
if (c->type != XDGShell && c->capture.image_capture_scene_surface) {
wlr_scene_node_destroy(&c->capture.image_capture_scene_surface->buffer->node);
c->capture.image_capture_scene_surface = NULL;
}
#endif
wlr_scene_node_destroy(&c->image_capture_scene->tree.node);
wlr_scene_node_destroy(&c->scene->node);
@ -2997,6 +3013,13 @@ updatetitle(struct wl_listener *listener, void *data)
Client *c = wl_container_of(listener, c, set_title);
if (c == focustop(c->mon))
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