aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-10-06 19:11:33 +0200
committeremersion <contact@emersion.fr>2018-10-06 19:13:44 +0200
commitd50f54fa42712dcdf670d407a88e736fd83f0581 (patch)
tree602906bb5d72f0d6a03f7f764b0c1b04e93818f8
parent176832fe30576ccfbb7dee3d9e600e56abf21da1 (diff)
downloadsway-d50f54fa42712dcdf670d407a88e736fd83f0581.zip
sway-d50f54fa42712dcdf670d407a88e736fd83f0581.tar.gz
sway-d50f54fa42712dcdf670d407a88e736fd83f0581.tar.bz2
swaybar: fix binding to wl_pointer multiple times
-rw-r--r--swaybar/bar.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 388c24c..c86e71b 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -283,6 +283,10 @@ struct wl_pointer_listener pointer_listener = {
static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
enum wl_seat_capability caps) {
struct swaybar *bar = data;
+ if (bar->pointer.pointer != NULL) {
+ wl_pointer_release(bar->pointer.pointer);
+ bar->pointer.pointer = NULL;
+ }
if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
bar->pointer.pointer = wl_seat_get_pointer(wl_seat);
wl_pointer_add_listener(bar->pointer.pointer, &pointer_listener, bar);
@@ -429,7 +433,7 @@ static void handle_global(void *data, struct wl_registry *registry,
&wl_compositor_interface, 3);
} else if (strcmp(interface, wl_seat_interface.name) == 0) {
bar->seat = wl_registry_bind(registry, name,
- &wl_seat_interface, 1);
+ &wl_seat_interface, 3);
wl_seat_add_listener(bar->seat, &seat_listener, bar);
} else if (strcmp(interface, wl_shm_interface.name) == 0) {
bar->shm = wl_registry_bind(registry, name,