forked from external/yambar
bar/wayland: don't destroy pointer unnecessarily
We only need to create/destroy the pointer when the POINTER capability changes.
This commit is contained in:
parent
c3b3d6a637
commit
c707b00a2a
1 changed files with 10 additions and 8 deletions
|
@ -235,14 +235,16 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
||||||
{
|
{
|
||||||
struct wayland_backend *backend = data;
|
struct wayland_backend *backend = data;
|
||||||
|
|
||||||
if (backend->pointer.pointer != NULL) {
|
if (caps & WL_SEAT_CAPABILITY_POINTER) {
|
||||||
wl_pointer_release(backend->pointer.pointer);
|
if (backend->pointer.pointer == NULL) {
|
||||||
backend->pointer.pointer = NULL;
|
backend->pointer.pointer = wl_seat_get_pointer(wl_seat);
|
||||||
}
|
wl_pointer_add_listener(backend->pointer.pointer, &pointer_listener, backend);
|
||||||
|
}
|
||||||
if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
|
} else {
|
||||||
backend->pointer.pointer = wl_seat_get_pointer(wl_seat);
|
if (backend->pointer.pointer != NULL) {
|
||||||
wl_pointer_add_listener(backend->pointer.pointer, &pointer_listener, backend);
|
wl_pointer_release(backend->pointer.pointer);
|
||||||
|
backend->pointer.pointer = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue