no need to manage unmapped clients

is there?
This commit is contained in:
Devin J. Pohly 2020-04-21 20:55:06 -05:00
parent c37aa00aec
commit 97f29ec67f

15
dwl.c
View file

@ -57,7 +57,6 @@ typedef struct {
struct wl_listener destroy; struct wl_listener destroy;
struct wl_listener request_move; struct wl_listener request_move;
struct wl_listener request_resize; struct wl_listener request_resize;
bool mapped;
int x, y; int x, y;
} Client; } Client;
@ -289,9 +288,6 @@ createnotify(struct wl_listener *listener, void *data)
wl_signal_add(&xdg_surface->events.unmap, &c->unmap); wl_signal_add(&xdg_surface->events.unmap, &c->unmap);
c->destroy.notify = destroynotify; c->destroy.notify = destroynotify;
wl_signal_add(&xdg_surface->events.destroy, &c->destroy); wl_signal_add(&xdg_surface->events.destroy, &c->destroy);
/* Add it to the list of clients. */
wl_list_insert(&clients, &c->link);
} }
void void
@ -320,7 +316,6 @@ destroynotify(struct wl_listener *listener, void *data)
{ {
/* Called when the surface is destroyed and should never be shown again. */ /* Called when the surface is destroyed and should never be shown again. */
Client *c = wl_container_of(listener, c, destroy); Client *c = wl_container_of(listener, c, destroy);
wl_list_remove(&c->link);
free(c); free(c);
} }
@ -477,7 +472,9 @@ maprequest(struct wl_listener *listener, void *data)
{ {
/* Called when the surface is mapped, or ready to display on-screen. */ /* Called when the surface is mapped, or ready to display on-screen. */
Client *c = wl_container_of(listener, c, map); Client *c = wl_container_of(listener, c, map);
c->mapped = true;
/* Insert this client into the list and focus it. */
wl_list_insert(&clients, &c->link);
focus(c, c->xdg_surface->surface); focus(c, c->xdg_surface->surface);
} }
@ -702,10 +699,6 @@ rendermon(struct wl_listener *listener, void *data)
* our client list is ordered front-to-back, we iterate over it backwards. */ * our client list is ordered front-to-back, we iterate over it backwards. */
Client *c; Client *c;
wl_list_for_each_reverse(c, &clients, link) { wl_list_for_each_reverse(c, &clients, link) {
if (!c->mapped) {
/* An unmapped client should not be rendered. */
continue;
}
struct render_data rdata = { struct render_data rdata = {
.output = m->wlr_output, .output = m->wlr_output,
.when = &now, .when = &now,
@ -940,7 +933,7 @@ unmapnotify(struct wl_listener *listener, void *data)
{ {
/* Called when the surface is unmapped, and should no longer be shown. */ /* Called when the surface is unmapped, and should no longer be shown. */
Client *c = wl_container_of(listener, c, unmap); Client *c = wl_container_of(listener, c, unmap);
c->mapped = false; wl_list_remove(&c->link);
} }
Client * Client *