bar: call refresh() after all modules have been loaded

This also means that modules do *not* have to call bar->refresh() just
before/after calling module_signal_ready().

As long as the module's initial state has been correctly/completely
set up before it calls module_signal_ready(), the module *only* has to
call bar->refresh() when it's state changes.
This commit is contained in:
Daniel Eklöf 2018-12-26 11:48:09 +01:00
parent 3af0280304
commit 5306ebd4ed
3 changed files with 6 additions and 3 deletions

View file

@ -384,7 +384,6 @@ static bool
talk_to_xkb(struct module_run_context *ctx, xcb_connection_t *conn)
{
struct private *m = ctx->module->private;
const struct bar *bar = ctx->module->bar;
if (!xkb_enable(conn))
goto err;
@ -412,7 +411,6 @@ talk_to_xkb(struct module_run_context *ctx, xcb_connection_t *conn)
m->layouts = layouts;
m->current = current;
bar->refresh(bar);
module_signal_ready(ctx);
return event_loop(ctx, conn, xkb_event_base);

View file

@ -14,6 +14,8 @@
#include <xcb/xcb.h>
#include <xcb/xcb_event.h>
#define LOG_MODULE "xkb"
#include "../../log.h"
#include "../../bar.h"
#include "../../xcb.h"
@ -212,7 +214,6 @@ run(struct module_run_context *ctx)
update_active_window(m);
update_application(mod);
update_title(mod);
mod->bar->refresh(mod->bar);
module_signal_ready(ctx);