aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-10-12 20:32:48 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-10-14 13:33:12 +0100
commitbcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b (patch)
tree873a09eca473242c15299ea1053966e9d163f6c6 /swaybar/render.c
parentswaybar: streamline ipc handling (diff)
downloadsway-bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b.tar.gz
sway-bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b.tar.zst
sway-bcc61e5147fb57a3b4bfb9a2a33065a0cf6da67b.zip
swaybar: handle mode/hidden_state changes
As well as adding the hidden_state property to the bar config struct, this commit handles barconfig_update events when the mode or hidden_state changes, and uses a new function determine_bar_visibility to hide or show the bar as required, using, respectively, destroy_layer_surface, which is also newly added, and add_layer_surface, which has been changed to allow dynamically adding the surface.
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index d226ba32..670630cf 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -494,6 +494,9 @@ static const struct wl_callback_listener output_frame_listener = {
494 494
495void render_frame(struct swaybar_output *output) { 495void render_frame(struct swaybar_output *output) {
496 assert(output->surface != NULL); 496 assert(output->surface != NULL);
497 if (!output->layer_surface) {
498 return;
499 }
497 500
498 free_hotspots(&output->hotspots); 501 free_hotspots(&output->hotspots);
499 502
@@ -519,7 +522,9 @@ void render_frame(struct swaybar_output *output) {
519 if (height != output->height) { 522 if (height != output->height) {
520 // Reconfigure surface 523 // Reconfigure surface
521 zwlr_layer_surface_v1_set_size(output->layer_surface, 0, height); 524 zwlr_layer_surface_v1_set_size(output->layer_surface, 0, height);
522 zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, height); 525 if (strcmp(output->bar->config->mode, "dock") == 0) {
526 zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, height);
527 }
523 // TODO: this could infinite loop if the compositor assigns us a 528 // TODO: this could infinite loop if the compositor assigns us a
524 // different height than what we asked for 529 // different height than what we asked for
525 wl_surface_commit(output->surface); 530 wl_surface_commit(output->surface);