diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-16 20:09:23 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-16 20:09:23 -0500 |
commit | adadb109a766ce70791fad38b02cc62a7b2e6b54 (patch) | |
tree | 1a743f5fa0a61cd4f5efb4f270e6816455f4c182 /swaybar/main.c | |
parent | 5a9cc9644648c70b330b9b3dc866ddb2a7e57a7a (diff) |
Only re-render swaybar when it has changed
Fixes #345
Diffstat (limited to 'swaybar/main.c')
-rw-r--r-- | swaybar/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index 65d2a493..60687bc5 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -51,6 +51,7 @@ FILE *command; char *line, *output, *status_command; struct registry *registry; struct window *window; +bool dirty = true; struct colors colors = { .background = 0x000000FF, @@ -278,6 +279,7 @@ void update() { if (line[l] == '\n') { line[l] = '\0'; } + dirty = true; } } if (ioctl(socketfd, FIONREAD, &pending) != -1 && pending > 0) { @@ -285,6 +287,7 @@ void update() { char *buf = ipc_recv_response(socketfd, &len); free(buf); ipc_update_workspaces(); + dirty = true; } } @@ -425,8 +428,8 @@ int main(int argc, char **argv) { window->height = height + MARGIN * 2; do { - if (window_prerender(window) && window->cairo) { - update(); + update(); + if (dirty && window_prerender(window) && window->cairo) { render(); window_render(window); } |