mirror of
https://github.com/swaywm/sway.git
synced 2026-04-29 06:46:22 -04:00
Rollback ipc event throttling in swaybar
This commit is contained in:
parent
de5bf64bfc
commit
94829ae846
2 changed files with 3 additions and 16 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue