From e8c5838a2ead4abb630d712a445d1f1311a9e825 Mon Sep 17 00:00:00 2001 From: Stivvo Date: Mon, 15 Mar 2021 09:47:44 +0100 Subject: [PATCH] Fix stuttering moving clients across monitors Memorize a pointer to the parent in each subsurface. This way, when that clients is moved to another monitor, that monitor will be damaged instead. --- dwl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dwl.c b/dwl.c index 9c4abf0..45fe8a8 100644 --- a/dwl.c +++ b/dwl.c @@ -122,7 +122,7 @@ typedef struct { struct wl_listener unmap; struct wl_listener destroy; struct wlr_subsurface *subsurface; - Monitor *mon; + Client *c; } Subsurface; typedef struct { @@ -811,7 +811,7 @@ void commitnotify_sub(struct wl_listener *listener, void *data) { Subsurface *s = wl_container_of(listener, s, commit); - wlr_output_damage_add_whole(s->mon->damage); + wlr_output_damage_add_whole(s->c->mon->damage); } void @@ -1070,7 +1070,7 @@ void destroynotify_sub(struct wl_listener *listener, void *data) { Subsurface *s = wl_container_of(listener, s, destroy); - wlr_output_damage_add_whole(s->mon->damage); + wlr_output_damage_add_whole(s->c->mon->damage); wl_list_remove(&s->commit.link); wl_list_remove(&s->map.link); wl_list_remove(&s->unmap.link); @@ -1387,7 +1387,7 @@ void mapnotify_sub(struct wl_listener *listener, void *data) { Subsurface *s = wl_container_of(listener, s, map); - wlr_output_damage_add_whole(s->mon->damage); + wlr_output_damage_add_whole(s->c->mon->damage); } @@ -1568,9 +1568,8 @@ moveresize(const Arg *arg) void new_subnotify(struct wl_listener *listener, void *data) { Subsurface *s = calloc(1, sizeof(Subsurface)); - Client *c = wl_container_of(listener, c, new_sub); + s->c = wl_container_of(listener, s->c, new_sub); s->subsurface = data; - s->mon = c->mon; LISTEN(&s->subsurface->surface->events.commit, &s->commit, commitnotify_sub); LISTEN(&s->subsurface->events.map, &s->map, mapnotify_sub); @@ -2377,7 +2376,7 @@ void unmapnotify_sub(struct wl_listener *listener, void *data) { Subsurface *s = wl_container_of(listener, s, unmap); - wlr_output_damage_add_whole(s->mon->damage); + wlr_output_damage_add_whole(s->c->mon->damage); }