forked from external/yambar
module/i3: delay bar refresh until all received events have been processed
This fixes an issue where switching between empty workspaces (or one empty, one non-empty) momentarily flashed two workspaces. I.e. we immediately rendered the new workspace, and then re-rendered when the first workspace was destroyed.
This commit is contained in:
parent
6562cb61df
commit
70499654a3
1 changed files with 7 additions and 2 deletions
|
@ -504,6 +504,8 @@ run(struct module *mod)
|
||||||
buf_idx += bytes;
|
buf_idx += bytes;
|
||||||
|
|
||||||
bool err = false;
|
bool err = false;
|
||||||
|
bool need_bar_refresh = false;
|
||||||
|
|
||||||
while (!err && buf_idx >= sizeof(i3_ipc_header_t)) {
|
while (!err && buf_idx >= sizeof(i3_ipc_header_t)) {
|
||||||
const i3_ipc_header_t *hdr = (const i3_ipc_header_t *)buf;
|
const i3_ipc_header_t *hdr = (const i3_ipc_header_t *)buf;
|
||||||
if (strncmp(hdr->magic, I3_IPC_MAGIC, sizeof(hdr->magic)) != 0) {
|
if (strncmp(hdr->magic, I3_IPC_MAGIC, sizeof(hdr->magic)) != 0) {
|
||||||
|
@ -551,12 +553,12 @@ run(struct module *mod)
|
||||||
|
|
||||||
case I3_IPC_REPLY_TYPE_WORKSPACES:
|
case I3_IPC_REPLY_TYPE_WORKSPACES:
|
||||||
handle_get_workspaces_reply(m, json);
|
handle_get_workspaces_reply(m, json);
|
||||||
mod->bar->refresh(mod->bar);
|
need_bar_refresh = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case I3_IPC_EVENT_WORKSPACE:
|
case I3_IPC_EVENT_WORKSPACE:
|
||||||
handle_workspace_event(m, json);
|
handle_workspace_event(m, json);
|
||||||
mod->bar->refresh(mod->bar);
|
need_bar_refresh = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case I3_IPC_EVENT_OUTPUT:
|
case I3_IPC_EVENT_OUTPUT:
|
||||||
|
@ -583,6 +585,9 @@ run(struct module *mod)
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (need_bar_refresh)
|
||||||
|
mod->bar->refresh(mod->bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
Loading…
Add table
Reference in a new issue