aboutsummaryrefslogtreecommitdiff
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorBrian Ashworth <RedSoxFan@users.noreply.github.com>2018-09-21 15:36:08 -0400
committerGitHub <noreply@github.com>2018-09-21 15:36:08 -0400
commitd2a0a3cc0a29b3c3145bfedeb00ec68c1b8c5057 (patch)
tree56f257c17c0d97666c498d2eb35012838c82b451 /swaybar/render.c
parente5542746734ff20793079f89dfd727abebb877be (diff)
parent04862e2121203965dad834b731a5c32b1d1f4e84 (diff)
Merge pull request #2666 from emersion/swaybar-hotplug
swaybar: handle hotplugging
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c5
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 @@
#define _POSIX_C_SOURCE 200809L
+#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <stdint.h>
@@ -480,6 +481,8 @@ static uint32_t render_to_cairo(cairo_t *cairo,
}
void render_frame(struct swaybar *bar, struct swaybar_output *output) {
+ assert(output->surface != NULL);
+
struct swaybar_hotspot *hotspot, *tmp;
wl_list_for_each_safe(hotspot, tmp, &output->hotspots, link) {
if (hotspot->destroy) {
@@ -507,7 +510,6 @@ void render_frame(struct swaybar *bar, struct swaybar_output *output) {
// TODO: this could infinite loop if the compositor assigns us a
// different height than what we asked for
wl_surface_commit(output->surface);
- wl_display_roundtrip(bar->display);
} else if (height > 0) {
// Replay recording into shm and send it off
output->current_buffer = get_next_buffer(bar->shm,
@@ -533,7 +535,6 @@ void render_frame(struct swaybar *bar, struct swaybar_output *output) {
wl_surface_damage(output->surface, 0, 0,
output->width, output->height);
wl_surface_commit(output->surface);
- wl_display_roundtrip(bar->display);
}
cairo_surface_destroy(recorder);
cairo_destroy(cairo);