diff options
author | 2018-09-21 15:36:08 -0400 | |
---|---|---|
committer | 2018-09-21 15:36:08 -0400 | |
commit | d2a0a3cc0a29b3c3145bfedeb00ec68c1b8c5057 (patch) | |
tree | 56f257c17c0d97666c498d2eb35012838c82b451 /swaybar/render.c | |
parent | Merge pull request #2672 from ianyfan/swaybar (diff) | |
parent | Merge branch 'master' into swaybar-hotplug (diff) | |
download | sway-d2a0a3cc0a29b3c3145bfedeb00ec68c1b8c5057.tar.gz sway-d2a0a3cc0a29b3c3145bfedeb00ec68c1b8c5057.tar.zst sway-d2a0a3cc0a29b3c3145bfedeb00ec68c1b8c5057.zip |
Merge pull request #2666 from emersion/swaybar-hotplug
swaybar: handle hotplugging
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 97690338..26db80cb 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #include <assert.h> | ||
2 | #include <limits.h> | 3 | #include <limits.h> |
3 | #include <stdlib.h> | 4 | #include <stdlib.h> |
4 | #include <stdint.h> | 5 | #include <stdint.h> |
@@ -480,6 +481,8 @@ static uint32_t render_to_cairo(cairo_t *cairo, | |||
480 | } | 481 | } |
481 | 482 | ||
482 | void render_frame(struct swaybar *bar, struct swaybar_output *output) { | 483 | void render_frame(struct swaybar *bar, struct swaybar_output *output) { |
484 | assert(output->surface != NULL); | ||
485 | |||
483 | struct swaybar_hotspot *hotspot, *tmp; | 486 | struct swaybar_hotspot *hotspot, *tmp; |
484 | wl_list_for_each_safe(hotspot, tmp, &output->hotspots, link) { | 487 | wl_list_for_each_safe(hotspot, tmp, &output->hotspots, link) { |
485 | if (hotspot->destroy) { | 488 | if (hotspot->destroy) { |
@@ -507,7 +510,6 @@ void render_frame(struct swaybar *bar, struct swaybar_output *output) { | |||
507 | // TODO: this could infinite loop if the compositor assigns us a | 510 | // TODO: this could infinite loop if the compositor assigns us a |
508 | // different height than what we asked for | 511 | // different height than what we asked for |
509 | wl_surface_commit(output->surface); | 512 | wl_surface_commit(output->surface); |
510 | wl_display_roundtrip(bar->display); | ||
511 | } else if (height > 0) { | 513 | } else if (height > 0) { |
512 | // Replay recording into shm and send it off | 514 | // Replay recording into shm and send it off |
513 | output->current_buffer = get_next_buffer(bar->shm, | 515 | output->current_buffer = get_next_buffer(bar->shm, |
@@ -533,7 +535,6 @@ void render_frame(struct swaybar *bar, struct swaybar_output *output) { | |||
533 | wl_surface_damage(output->surface, 0, 0, | 535 | wl_surface_damage(output->surface, 0, 0, |
534 | output->width, output->height); | 536 | output->width, output->height); |
535 | wl_surface_commit(output->surface); | 537 | wl_surface_commit(output->surface); |
536 | wl_display_roundtrip(bar->display); | ||
537 | } | 538 | } |
538 | cairo_surface_destroy(recorder); | 539 | cairo_surface_destroy(recorder); |
539 | cairo_destroy(cairo); | 540 | cairo_destroy(cairo); |