diff options
author | Stivvo <stivvo01@gmail.com> | 2020-10-24 23:40:19 +0200 |
---|---|---|
committer | Stivvo <stivvo01@gmail.com> | 2020-10-24 23:40:19 +0200 |
commit | ef7043e4d1445142ab18bf7de886f1963fbade8b (patch) | |
tree | e52a28a90ec84a4fa2276a34b079e573a0522ce2 /dwl.c | |
parent | 7017a0c64d3a58635cb5e088fab890c4efa02737 (diff) |
closemon()
Separate oputput movement from cleanupmon
Diffstat (limited to 'dwl.c')
-rw-r--r-- | dwl.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -204,6 +204,7 @@ static void chvt(const Arg *arg); static void cleanup(void); static void cleanupkeyboard(struct wl_listener *listener, void *data); static void cleanupmon(struct wl_listener *listener, void *data); +static void closemon(Monitor *m); static void commitlayersurfacenotify(struct wl_listener *listener, void *data); static void commitnotify(struct wl_listener *listener, void *data); static void createkeyboard(struct wlr_input_device *device); @@ -687,8 +688,7 @@ void cleanupmon(struct wl_listener *listener, void *data) { struct wlr_output *wlr_output = data; - Monitor *m = wlr_output->data, *newmon; - Client *c; + Monitor *m = wlr_output->data; wl_list_remove(&m->destroy.link); wl_list_remove(&m->frame.link); @@ -696,6 +696,16 @@ cleanupmon(struct wl_listener *listener, void *data) wlr_output_layout_remove(output_layout, m->wlr_output); updatemons(); + closemon(m); + free(m); +} + +void +closemon(Monitor *m) +{ + // move all the clients on a closed monitor to another one + Monitor *newmon; + Client *c; wl_list_for_each(newmon, &mons, link) { wl_list_for_each(c, &clients, link) { @@ -708,7 +718,6 @@ cleanupmon(struct wl_listener *listener, void *data) } break; } - free(m); } void |