Rollback ipc event throttling in swaybar

This commit is contained in:
Ilya Lukyanov 2017-08-04 23:18:06 +03:00
parent de5bf64bfc
commit 94829ae846
No known key found for this signature in database
GPG key ID: 382C32164F3D37D4
2 changed files with 3 additions and 16 deletions

View file

@ -15,8 +15,6 @@ struct bar {
int ipc_socketfd; int ipc_socketfd;
int status_read_fd; int status_read_fd;
pid_t status_command_pid; pid_t status_command_pid;
int pending_ipc_requests;
}; };
struct output { struct output {

View file

@ -250,25 +250,14 @@ static void ipc_parse_config(struct config *config, const char *payload) {
} }
static void ipc_update_workspaces_request(struct bar *bar) { static void ipc_update_workspaces_request(struct bar *bar) {
sway_log(L_DEBUG, "Sending update request");
uint32_t len = 0; uint32_t len = 0;
if (bar->pending_ipc_requests >= 10) {
sway_log(L_DEBUG, "Ignoring update request");
return;
}
bar->pending_ipc_requests++;
sway_log(L_DEBUG, "Sending update request, %d pending", bar->pending_ipc_requests);
ipc_single_command_no_response(bar->ipc_socketfd, IPC_GET_WORKSPACES, NULL, &len); ipc_single_command_no_response(bar->ipc_socketfd, IPC_GET_WORKSPACES, NULL, &len);
} }
static void ipc_update_workspaces_response(struct bar *bar, char *res) { static void ipc_update_workspaces_response(struct bar *bar, char *res) {
bar->pending_ipc_requests--; sway_log(L_DEBUG, "Got update response");
sway_log(L_DEBUG, "Got update response, %d pending", bar->pending_ipc_requests);
if (bar->pending_ipc_requests < 0) {
sway_log(L_DEBUG, "Unexpected update response");
bar->pending_ipc_requests = 0;
}
int i; int i;
for (i = 0; i < bar->outputs->length; ++i) { for (i = 0; i < bar->outputs->length; ++i) {