handlers: Tiny rework of output_destroyed logic

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2016-05-07 12:19:45 +02:00
parent c7c2bf542a
commit db8dacf76e

View file

@ -97,14 +97,17 @@ static void handle_output_destroyed(wlc_handle output) {
break; break;
} }
} }
if (i < list->length) { if (i == list->length) {
destroy_output(list->items[i]); // No container for this output, we're done
} else {
return; return;
} }
destroy_output(list->items[i]);
if (list->length > 0) { if (list->length > 0) {
swayc_t *c = (swayc_t *)list->items[0];
// switch to other outputs active workspace // switch to other outputs active workspace
workspace_switch(((swayc_t *)root_container.children->items[0])->focused); workspace_switch(c->focused);
} }
} }