aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/bar.c
diff options
context:
space:
mode:
authorLibravatar Alexander Orzechowski <alex@ozal.ski>2023-07-30 16:07:28 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2023-07-31 10:34:11 +0200
commitf436de920097963a6c73e250ea4a01b89be31321 (patch)
treef5957adacfa52e77ac49ff7fda958b5f385a96af /swaybar/bar.c
parentAdd support for cursor-shape-v1 (diff)
downloadsway-f436de920097963a6c73e250ea4a01b89be31321.tar.gz
sway-f436de920097963a6c73e250ea4a01b89be31321.tar.zst
sway-f436de920097963a6c73e250ea4a01b89be31321.zip
swaybar: Implement wp_cursor_shape_v1
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r--swaybar/bar.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 5e4ebd97..021fc3bd 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -362,6 +362,9 @@ static void handle_global(void *data, struct wl_registry *registry,
362 } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) { 362 } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) {
363 bar->xdg_output_manager = wl_registry_bind(registry, name, 363 bar->xdg_output_manager = wl_registry_bind(registry, name,
364 &zxdg_output_manager_v1_interface, 2); 364 &zxdg_output_manager_v1_interface, 2);
365 } else if (strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0) {
366 bar->cursor_shape_manager = wl_registry_bind(registry, name,
367 &wp_cursor_shape_manager_v1_interface, 1);
365 } 368 }
366} 369}
367 370
@@ -425,15 +428,17 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
425 // Second roundtrip for xdg-output 428 // Second roundtrip for xdg-output
426 wl_display_roundtrip(bar->display); 429 wl_display_roundtrip(bar->display);
427 430
428 struct swaybar_seat *seat; 431 if (!bar->cursor_shape_manager) {
429 wl_list_for_each(seat, &bar->seats, link) { 432 struct swaybar_seat *seat;
430 struct swaybar_pointer *pointer = &seat->pointer; 433 wl_list_for_each(seat, &bar->seats, link) {
431 if (!pointer) { 434 struct swaybar_pointer *pointer = &seat->pointer;
432 continue; 435 if (!pointer) {
436 continue;
437 }
438 pointer->cursor_surface =
439 wl_compositor_create_surface(bar->compositor);
440 assert(pointer->cursor_surface);
433 } 441 }
434 pointer->cursor_surface =
435 wl_compositor_create_surface(bar->compositor);
436 assert(pointer->cursor_surface);
437 } 442 }
438 443
439 if (bar->config->status_command) { 444 if (bar->config->status_command) {