aboutsummaryrefslogtreecommitdiffstats
path: root/swaynag/swaynag.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaynag/swaynag.c')
-rw-r--r--swaynag/swaynag.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c
index f0c6a3c5..eb31da57 100644
--- a/swaynag/swaynag.c
+++ b/swaynag/swaynag.c
@@ -239,10 +239,14 @@ static struct wl_pointer_listener pointer_listener = {
239static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, 239static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
240 enum wl_seat_capability caps) { 240 enum wl_seat_capability caps) {
241 struct swaynag *swaynag = data; 241 struct swaynag *swaynag = data;
242 if ((caps & WL_SEAT_CAPABILITY_POINTER)) { 242 bool cap_pointer = caps & WL_SEAT_CAPABILITY_POINTER;
243 if (cap_pointer && !swaynag->pointer.pointer) {
243 swaynag->pointer.pointer = wl_seat_get_pointer(wl_seat); 244 swaynag->pointer.pointer = wl_seat_get_pointer(wl_seat);
244 wl_pointer_add_listener(swaynag->pointer.pointer, &pointer_listener, 245 wl_pointer_add_listener(swaynag->pointer.pointer, &pointer_listener,
245 swaynag); 246 swaynag);
247 } else if (!cap_pointer && swaynag->pointer.pointer) {
248 wl_pointer_destroy(swaynag->pointer.pointer);
249 swaynag->pointer.pointer = NULL;
246 } 250 }
247} 251}
248 252