aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorStivvo <stivvo01@gmail.com>2020-10-31 16:16:22 +0100
committerStivvo <stivvo01@gmail.com>2020-10-31 16:16:22 +0100
commit38606a1d232aca987859808d8c6f68878b394805 (patch)
tree9eb2cc7352d6ddae8c32adcff14e32ad14460914 /dwl.c
parent9f3f15b467a1ea723cd09d9943a27cfb50aa0af8 (diff)
parent9f0b16868a082175508c0c747054f324595d5b67 (diff)
Merge branch 'handleUnplug' into output-management
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/dwl.c b/dwl.c
index 9b8dda2..eeecb75 100644
--- a/dwl.c
+++ b/dwl.c
@@ -205,7 +205,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, Monitor *newmon);
+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);
@@ -695,7 +695,7 @@ void
cleanupmon(struct wl_listener *listener, void *data)
{
struct wlr_output *wlr_output = data;
- Monitor *m = wlr_output->data, *newmon;
+ Monitor *m = wlr_output->data;
wl_list_remove(&m->destroy.link);
wl_list_remove(&m->frame.link);
@@ -703,24 +703,26 @@ cleanupmon(struct wl_listener *listener, void *data)
wlr_output_layout_remove(output_layout, m->wlr_output);
updatemons();
- closemon(m, wl_container_of(mons.next, newmon, link));
+
+ selmon = wl_container_of(mons.next, selmon, link);
+ focusclient(selclient(), focustop(selmon), 1);
+ closemon(m);
+
free(m);
}
void
-closemon(Monitor *m, Monitor *newmon)
+closemon(Monitor *m)
{
- // move all the clients on a closed monitor to another one
+ // move closed monitor's clients to the focused one
Client *c;
- selmon = newmon;
- focusclient(selclient(), focustop(newmon), 1);
wl_list_for_each(c, &clients, link) {
if (c->isfloating && c->geom.x > m->m.width)
resize(c, c->geom.x - m->w.width, c->geom.y,
c->geom.width, c->geom.height, 0);
if (c->mon == m)
- setmon(c, newmon, c->tags);
+ setmon(c, selmon, c->tags);
}
}