moduel/river: at startup, don't instantiate seat-status before binding outputs

This commit is contained in:
Daniel Eklöf 2020-07-24 17:44:35 +02:00
parent 7b2d524598
commit 06c2a69120
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -48,7 +48,8 @@ struct private {
struct zriver_status_manager_v1 *status_manager; struct zriver_status_manager_v1 *status_manager;
struct particle *template; struct particle *template;
struct particle *title; struct particle *title;
bool is_starting_up;
tll(struct output) outputs; tll(struct output) outputs;
tll(struct seat) seats; tll(struct seat) seats;
}; };
@ -81,17 +82,12 @@ content(struct module *mod)
output_focused |= output->focused; output_focused |= output->focused;
occupied |= output->occupied; occupied |= output->occupied;
#if 0
/* TODO: river bug */
tll_foreach(m->seats, it2) { tll_foreach(m->seats, it2) {
const struct seat *seat = &it2->item; const struct seat *seat = &it2->item;
if (seat->output == output) { if (seat->output == output) {
seat_focused |= output->focused; seat_focused |= output->focused;
} }
} }
#else
seat_focused |= output->focused;
#endif
} }
const size_t seat_count = m->title != NULL ? tll_length(m->seats) : 0; const size_t seat_count = m->title != NULL ? tll_length(m->seats) : 0;
@ -279,6 +275,9 @@ static struct zxdg_output_v1_listener xdg_output_listener = {
static void static void
instantiate_output(struct output *output) instantiate_output(struct output *output)
{ {
if (output->m->is_starting_up)
return;
assert(output->wl_output != NULL); assert(output->wl_output != NULL);
if (output->m->status_manager != NULL && output->status == NULL) { if (output->m->status_manager != NULL && output->status == NULL) {
@ -306,8 +305,6 @@ static void
focused_output(void *data, struct zriver_seat_status_v1 *zriver_seat_status_v1, focused_output(void *data, struct zriver_seat_status_v1 *zriver_seat_status_v1,
struct wl_output *wl_output) struct wl_output *wl_output)
{ {
/* TODO: never called by river */
abort();
struct seat *seat = data; struct seat *seat = data;
struct private *m = seat->m; struct private *m = seat->m;
struct module *mod = m->mod; struct module *mod = m->mod;
@ -417,6 +414,9 @@ instantiate_seat(struct seat *seat)
{ {
assert(seat->wl_seat != NULL); assert(seat->wl_seat != NULL);
if (seat->m->is_starting_up)
return;
if (seat->m->status_manager == NULL) if (seat->m->status_manager == NULL)
return; return;
@ -564,6 +564,14 @@ run(struct module *mod)
goto out; goto out;
} }
wl_display_roundtrip(display);
m->is_starting_up = false;
tll_foreach(m->outputs, it)
instantiate_output(&it->item);
tll_foreach(m->seats, it)
instantiate_seat(&it->item);
while (true) { while (true) {
wl_display_flush(display); wl_display_flush(display);
@ -619,6 +627,7 @@ river_new(struct particle *template, struct particle *title)
struct private *m = calloc(1, sizeof(*m)); struct private *m = calloc(1, sizeof(*m));
m->template = template; m->template = template;
m->title = title; m->title = title;
m->is_starting_up = true;
struct module *mod = module_common_new(); struct module *mod = module_common_new();
mod->private = m; mod->private = m;