summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-08-18 16:51:15 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-08-18 16:55:13 -0500
commit174919ec5342af19504661b30359068af5fcf1c1 (patch)
treee23f0d8886bd93fcb30a19483fe96e38d9ad170e
parenta7f77160d1b36029b496384087c0d71d27d73079 (diff)
set monitor for clients that don't have one on monitor creation
-rw-r--r--dwl.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/dwl.c b/dwl.c
index 212afd1..cf7d307 100644
--- a/dwl.c
+++ b/dwl.c
@@ -896,6 +896,7 @@ createmon(struct wl_listener *listener, void *data)
* monitor) becomes available. */
struct wlr_output *wlr_output = data;
const MonitorRule *r;
+ Client *c;
Monitor *m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output;
@@ -944,15 +945,10 @@ createmon(struct wl_listener *listener, void *data)
m->scene_output = wlr_scene_output_create(scene, wlr_output);
wlr_output_layout_add_auto(output_layout, wlr_output);
- /* If length == 1 we need update selmon.
- * Maybe it will change in run(). */
- if (wl_list_length(&mons) == 1) {
- Client *c;
- selmon = m;
- /* If there is any client, set c->mon to this monitor */
- wl_list_for_each(c, &clients, link)
+ /* If there are clients without monitor set this as their monitor */
+ wl_list_for_each(c, &clients, link)
+ if (!c->mon)
setmon(c, m, c->tags);
- }
}
void