aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStivvo <stivvo01@gmail.com>2020-10-30 23:31:46 +0100
committerStivvo <stivvo01@gmail.com>2020-10-30 23:31:46 +0100
commit806ebffe7d7eb040c94e4bed871e525aa80b7a9b (patch)
treee51e198e4ee5796561728f70e4b12a9b7898ec02
parent4deeddceffde88bd117411fb856e86a7d92e456a (diff)
parentfbbc1fd65658db1634926bc65be7174cd141b64e (diff)
Merge branch 'handleUnplug' into output-management
-rw-r--r--dwl.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/dwl.c b/dwl.c
index 715cb5e..182c097 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);
+static void closemon(Monitor *m, Monitor *newmon);
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;
+ Monitor *m = wlr_output->data, *newmon;
wl_list_remove(&m->destroy.link);
wl_list_remove(&m->frame.link);
@@ -703,27 +703,23 @@ cleanupmon(struct wl_listener *listener, void *data)
wlr_output_layout_remove(output_layout, m->wlr_output);
updatemons();
- closemon(m);
+ closemon(m, wl_container_of(mons.next, newmon, link));
free(m);
}
void
-closemon(Monitor *m)
+closemon(Monitor *m, Monitor *newmon)
{
// move all the clients on a closed monitor to another one
- Monitor *newmon;
Client *c;
focusclient(selclient(), focustop(dirtomon(-1)), 1);
- wl_list_for_each(newmon, &mons, link) {
- 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);
- }
- break;
+ 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);
}
}