set monitor for clients that don't have one on monitor creation

This commit is contained in:
Leonardo Hernández Hernández 2022-08-18 16:51:15 -05:00
parent a7f77160d1
commit 174919ec53
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
1 changed files with 4 additions and 8 deletions

12
dwl.c
View File

@ -896,6 +896,7 @@ createmon(struct wl_listener *listener, void *data)
* monitor) becomes available. */ * monitor) becomes available. */
struct wlr_output *wlr_output = data; struct wlr_output *wlr_output = data;
const MonitorRule *r; const MonitorRule *r;
Client *c;
Monitor *m = wlr_output->data = ecalloc(1, sizeof(*m)); Monitor *m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output; 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); m->scene_output = wlr_scene_output_create(scene, wlr_output);
wlr_output_layout_add_auto(output_layout, wlr_output); wlr_output_layout_add_auto(output_layout, wlr_output);
/* If length == 1 we need update selmon. /* If there are clients without monitor set this as their monitor */
* Maybe it will change in run(). */ wl_list_for_each(c, &clients, link)
if (wl_list_length(&mons) == 1) { if (!c->mon)
Client *c;
selmon = m;
/* If there is any client, set c->mon to this monitor */
wl_list_for_each(c, &clients, link)
setmon(c, m, c->tags); setmon(c, m, c->tags);
}
} }
void void