fix: make sure selmon doesn't get set to disabled mon

This commit is contained in:
Rutherther 2024-05-04 20:59:51 +02:00 committed by Leonardo Hernández Hernández
parent 7a46fccdba
commit 16076ec5a4
No known key found for this signature in database
GPG Key ID: E538897EE11B9624

7
dwl.c
View File

@ -727,6 +727,9 @@ closemon(Monitor *m)
do /* don't switch to disabled mons */ do /* don't switch to disabled mons */
selmon = wl_container_of(mons.next, selmon, link); selmon = wl_container_of(mons.next, selmon, link);
while (!selmon->wlr_output->enabled && i++ < nmons); while (!selmon->wlr_output->enabled && i++ < nmons);
if (!selmon->wlr_output->enabled)
selmon = NULL;
} }
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
@ -2789,6 +2792,10 @@ updatemons(struct wl_listener *listener, void *data)
config_head->state.x = m->m.x; config_head->state.x = m->m.x;
config_head->state.y = m->m.y; config_head->state.y = m->m.y;
if (!selmon) {
selmon = m;
}
} }
if (selmon && selmon->wlr_output->enabled) { if (selmon && selmon->wlr_output->enabled) {