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.
This commit is contained in:
Stivvo 2021-03-15 09:47:44 +01:00
parent 64b5c4c9f9
commit e8c5838a2e

13
dwl.c
View File

@ -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);
}