mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-04-17 14:26:49 +02:00
fix seat_handle_capabilities
seat_handle_capabilities may be called more than once with different caps. In the current implementation, wl_{pointer,touch}_add_listener can be called multiple times for the same seat, causing the buttons to be pressed more than once in a single tap. This commit implements seat_handle_capabilities correctly and avoids setting duplicate handlers, and also handles the removal of capabilities. Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
parent
9e03e120c3
commit
21045044ba
12
main.c
12
main.c
@ -276,13 +276,25 @@ void
|
||||
seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
||||
enum wl_seat_capability caps) {
|
||||
if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
|
||||
if (pointer == NULL) {
|
||||
pointer = wl_seat_get_pointer(wl_seat);
|
||||
wl_pointer_add_listener(pointer, &pointer_listener, NULL);
|
||||
}
|
||||
} else {
|
||||
if (pointer != NULL) {
|
||||
wl_pointer_destroy(pointer);
|
||||
}
|
||||
}
|
||||
if ((caps & WL_SEAT_CAPABILITY_TOUCH)) {
|
||||
if (touch == NULL) {
|
||||
touch = wl_seat_get_touch(wl_seat);
|
||||
wl_touch_add_listener(touch, &touch_listener, NULL);
|
||||
}
|
||||
} else {
|
||||
if (touch != NULL) {
|
||||
wl_touch_destroy(touch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user