diff --git a/dwl.c b/dwl.c index 05c647f..6a2d220 100644 --- a/dwl.c +++ b/dwl.c @@ -383,7 +383,6 @@ static void activatex11(struct wl_listener *listener, void *data); static void configurex11(struct wl_listener *listener, void *data); static void createnotifyx11(struct wl_listener *listener, void *data); void commitnotifyx11(struct wl_listener *listener, void *data); -static void damageallmons(); static Atom getatom(xcb_connection_t *xc, const char *name); static void mapnotify_unmanaged(struct wl_listener *listener, void *data); static void renderindependents(struct wlr_output *output, struct timespec *now); @@ -2622,20 +2621,7 @@ commitnotifyx11(struct wl_listener *listener, void *data) Client *c = wl_container_of(listener, c, commit); // Damage the whole screen - if (c->type == X11Managed) - wlr_output_damage_add_whole(c->mon->damage); - else - damageallmons(); -} - -void -damageallmons() -{ - Monitor *m; - - wl_list_for_each(m, &mons, link) - if (m && m->wlr_output && m->damage) - wlr_output_damage_add_whole(m->damage); + wlr_output_damage_add_whole(c->mon->damage); } Atom @@ -2656,8 +2642,10 @@ mapnotify_unmanaged(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, map); wl_list_insert(&independents, &c->link); + client_get_geometry(c, &c->geom); + c->mon = xytomon(c->geom.x, c->geom.y); LISTEN(&c->surface.xwayland->surface->events.commit, &c->commit, commitnotifyx11); - damageallmons(); + wlr_output_damage_add_whole(c->mon->damage); }