module/i3: add a 'burst_done()' callback

This callback is called after all received packets have been
processed, before going into a blocking poll() again.
This commit is contained in:
Daniel Eklöf 2019-02-15 22:01:07 +01:00
parent 5e97c77c24
commit f9044ec883
2 changed files with 5 additions and 0 deletions

View file

@ -298,6 +298,9 @@ i3_receive_loop(int abort_fd, int sock,
memmove(buf, &buf[total_size], buf_idx - total_size); memmove(buf, &buf[total_size], buf_idx - total_size);
buf_idx -= total_size; buf_idx -= total_size;
} }
if (cbs->burst_done != NULL)
cbs->burst_done(data);
} }
free(buf); free(buf);

View file

@ -15,6 +15,8 @@ bool i3_send_pkg(int sock, int cmd, char *data);
typedef bool (*i3_ipc_callback_t)(int type, const struct json_object *json, void *data); typedef bool (*i3_ipc_callback_t)(int type, const struct json_object *json, void *data);
struct i3_ipc_callbacks { struct i3_ipc_callbacks {
void (*burst_done)(void *data);
i3_ipc_callback_t reply_command; i3_ipc_callback_t reply_command;
i3_ipc_callback_t reply_workspaces; i3_ipc_callback_t reply_workspaces;
i3_ipc_callback_t reply_subscribe; i3_ipc_callback_t reply_subscribe;