diff options
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r-- | swaybar/bar.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index 231c1ad7..15eab782 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -90,7 +90,7 @@ static void layer_surface_closed(void *_output, | |||
90 | swaybar_output_free(output); | 90 | swaybar_output_free(output); |
91 | } | 91 | } |
92 | 92 | ||
93 | struct zwlr_layer_surface_v1_listener layer_surface_listener = { | 93 | static const struct zwlr_layer_surface_v1_listener layer_surface_listener = { |
94 | .configure = layer_surface_configure, | 94 | .configure = layer_surface_configure, |
95 | .closed = layer_surface_closed, | 95 | .closed = layer_surface_closed, |
96 | }; | 96 | }; |
@@ -230,7 +230,7 @@ static void output_scale(void *data, struct wl_output *wl_output, | |||
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | struct wl_output_listener output_listener = { | 233 | static const struct wl_output_listener output_listener = { |
234 | .geometry = output_geometry, | 234 | .geometry = output_geometry, |
235 | .mode = output_mode, | 235 | .mode = output_mode, |
236 | .done = output_done, | 236 | .done = output_done, |
@@ -307,7 +307,7 @@ static void xdg_output_handle_description(void *data, | |||
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
310 | struct zxdg_output_v1_listener xdg_output_listener = { | 310 | static const struct zxdg_output_v1_listener xdg_output_listener = { |
311 | .logical_position = xdg_output_handle_logical_position, | 311 | .logical_position = xdg_output_handle_logical_position, |
312 | .logical_size = xdg_output_handle_logical_size, | 312 | .logical_size = xdg_output_handle_logical_size, |
313 | .done = xdg_output_handle_done, | 313 | .done = xdg_output_handle_done, |
@@ -461,13 +461,28 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) { | |||
461 | 461 | ||
462 | static void display_in(int fd, short mask, void *data) { | 462 | static void display_in(int fd, short mask, void *data) { |
463 | struct swaybar *bar = data; | 463 | struct swaybar *bar = data; |
464 | if (mask & (POLLHUP | POLLERR)) { | ||
465 | if (mask & POLLERR) { | ||
466 | sway_log(SWAY_ERROR, "Wayland display poll error"); | ||
467 | } | ||
468 | bar->running = false; | ||
469 | return; | ||
470 | } | ||
464 | if (wl_display_dispatch(bar->display) == -1) { | 471 | if (wl_display_dispatch(bar->display) == -1) { |
472 | sway_log(SWAY_ERROR, "wl_display_dispatch failed"); | ||
465 | bar->running = false; | 473 | bar->running = false; |
466 | } | 474 | } |
467 | } | 475 | } |
468 | 476 | ||
469 | static void ipc_in(int fd, short mask, void *data) { | 477 | static void ipc_in(int fd, short mask, void *data) { |
470 | struct swaybar *bar = data; | 478 | struct swaybar *bar = data; |
479 | if (mask & (POLLHUP | POLLERR)) { | ||
480 | if (mask & POLLERR) { | ||
481 | sway_log(SWAY_ERROR, "IPC poll error"); | ||
482 | } | ||
483 | bar->running = false; | ||
484 | return; | ||
485 | } | ||
471 | if (handle_ipc_readable(bar)) { | 486 | if (handle_ipc_readable(bar)) { |
472 | set_bar_dirty(bar); | 487 | set_bar_dirty(bar); |
473 | } | 488 | } |