diff options
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r-- | swaybar/bar.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index 15eab782..5b1213a8 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | ||
2 | #include <assert.h> | 1 | #include <assert.h> |
3 | #include <errno.h> | 2 | #include <errno.h> |
4 | #include <fcntl.h> | 3 | #include <fcntl.h> |
@@ -51,10 +50,6 @@ static void swaybar_output_free(struct swaybar_output *output) { | |||
51 | if (output->surface != NULL) { | 50 | if (output->surface != NULL) { |
52 | wl_surface_destroy(output->surface); | 51 | wl_surface_destroy(output->surface); |
53 | } | 52 | } |
54 | if (output->input_region != NULL) { | ||
55 | wl_region_destroy(output->input_region); | ||
56 | } | ||
57 | zxdg_output_v1_destroy(output->xdg_output); | ||
58 | wl_output_destroy(output->output); | 53 | wl_output_destroy(output->output); |
59 | destroy_buffer(&output->buffers[0]); | 54 | destroy_buffer(&output->buffers[0]); |
60 | destroy_buffer(&output->buffers[1]); | 55 | destroy_buffer(&output->buffers[1]); |
@@ -114,10 +109,9 @@ static void add_layer_surface(struct swaybar_output *output) { | |||
114 | 109 | ||
115 | if (overlay) { | 110 | if (overlay) { |
116 | // Empty input region | 111 | // Empty input region |
117 | output->input_region = wl_compositor_create_region(bar->compositor); | 112 | struct wl_region *region = wl_compositor_create_region(bar->compositor); |
118 | assert(output->input_region); | 113 | wl_surface_set_input_region(output->surface, region); |
119 | 114 | wl_region_destroy(region); | |
120 | wl_surface_set_input_region(output->surface, output->input_region); | ||
121 | } | 115 | } |
122 | 116 | ||
123 | zwlr_layer_surface_v1_set_anchor(output->layer_surface, config->position); | 117 | zwlr_layer_surface_v1_set_anchor(output->layer_surface, config->position); |
@@ -172,7 +166,7 @@ bool determine_bar_visibility(struct swaybar *bar, bool moving_layer) { | |||
172 | if (bar->status) { | 166 | if (bar->status) { |
173 | sway_log(SWAY_DEBUG, "Sending %s signal to status command", | 167 | sway_log(SWAY_DEBUG, "Sending %s signal to status command", |
174 | visible ? "cont" : "stop"); | 168 | visible ? "cont" : "stop"); |
175 | kill(bar->status->pid, visible ? | 169 | kill(-bar->status->pid, visible ? |
176 | bar->status->cont_signal : bar->status->stop_signal); | 170 | bar->status->cont_signal : bar->status->stop_signal); |
177 | } | 171 | } |
178 | } | 172 | } |
@@ -367,6 +361,9 @@ static void handle_global(void *data, struct wl_registry *registry, | |||
367 | } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) { | 361 | } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) { |
368 | bar->xdg_output_manager = wl_registry_bind(registry, name, | 362 | bar->xdg_output_manager = wl_registry_bind(registry, name, |
369 | &zxdg_output_manager_v1_interface, 2); | 363 | &zxdg_output_manager_v1_interface, 2); |
364 | } else if (strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0) { | ||
365 | bar->cursor_shape_manager = wl_registry_bind(registry, name, | ||
366 | &wp_cursor_shape_manager_v1_interface, 1); | ||
370 | } | 367 | } |
371 | } | 368 | } |
372 | 369 | ||
@@ -430,15 +427,17 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) { | |||
430 | // Second roundtrip for xdg-output | 427 | // Second roundtrip for xdg-output |
431 | wl_display_roundtrip(bar->display); | 428 | wl_display_roundtrip(bar->display); |
432 | 429 | ||
433 | struct swaybar_seat *seat; | 430 | if (!bar->cursor_shape_manager) { |
434 | wl_list_for_each(seat, &bar->seats, link) { | 431 | struct swaybar_seat *seat; |
435 | struct swaybar_pointer *pointer = &seat->pointer; | 432 | wl_list_for_each(seat, &bar->seats, link) { |
436 | if (!pointer) { | 433 | struct swaybar_pointer *pointer = &seat->pointer; |
437 | continue; | 434 | if (!pointer) { |
435 | continue; | ||
436 | } | ||
437 | pointer->cursor_surface = | ||
438 | wl_compositor_create_surface(bar->compositor); | ||
439 | assert(pointer->cursor_surface); | ||
438 | } | 440 | } |
439 | pointer->cursor_surface = | ||
440 | wl_compositor_create_surface(bar->compositor); | ||
441 | assert(pointer->cursor_surface); | ||
442 | } | 441 | } |
443 | 442 | ||
444 | if (bar->config->status_command) { | 443 | if (bar->config->status_command) { |