summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@proton.me>2023-06-02 22:08:17 -0600
committerLeonardo Hernández Hernández <leohdz172@proton.me>2023-06-02 22:08:17 -0600
commitf3d017077a1328e7d327304772cf186f2e7ae0de (patch)
treee28437ce767342f16340b54dba3dd403d11ecc96
parent06bc65549f42bcfa2f0b119149eacb7e5adc9073 (diff)
use the new {a,di}ssociate events to handle xwayland commit listener
-rw-r--r--dwl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/dwl.c b/dwl.c
index c28ce42..5edb12c 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1021,6 +1021,7 @@ createnotify(struct wl_listener *listener, void *data)
c->surface.xdg = xdg_surface;
c->bw = borderpx;
+ LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify);
LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify);
LISTEN(&xdg_surface->surface->events.unmap, &c->unmap, unmapnotify);
LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
@@ -1177,6 +1178,7 @@ destroynotify(struct wl_listener *listener, void *data)
} else
#endif
{
+ wl_list_remove(&c->commit.link);
wl_list_remove(&c->map.link);
wl_list_remove(&c->unmap.link);
}
@@ -1541,12 +1543,7 @@ mapnotify(struct wl_listener *listener, void *data)
c->scene_surface = c->type == XDGShell
? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg)
: wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
- if (client_surface(c)) {
- client_surface(c)->data = c->scene;
- /* Ideally we should do this in createnotify{,x11} but at that moment
- * wlr_xwayland_surface doesn't have wlr_surface yet. */
- LISTEN(&client_surface(c)->events.commit, &c->commit, commitnotify);
- }
+ client_surface(c)->data = c->scene;
c->scene->node.data = c->scene_surface->node.data = c;
/* Handle unmanaged clients first so we can return prior create borders */
@@ -2525,7 +2522,6 @@ unmapnotify(struct wl_listener *listener, void *data)
wl_list_remove(&c->flink);
}
- wl_list_remove(&c->commit.link);
wlr_scene_node_destroy(&c->scene->node);
printstatus();
motionnotify(0);
@@ -2747,6 +2743,7 @@ associatex11(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, associate);
+ LISTEN(&client_surface(c)->events.commit, &c->commit, commitnotify);
LISTEN(&client_surface(c)->events.map, &c->map, mapnotify);
LISTEN(&client_surface(c)->events.unmap, &c->unmap, unmapnotify);
}
@@ -2792,6 +2789,7 @@ void
dissociatex11(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, dissociate);
+ wl_list_remove(&c->commit.link);
wl_list_remove(&c->map.link);
wl_list_remove(&c->unmap.link);
}