mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-23 20:35:42 +02:00
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;
|
||||
|
||||
if (backend->pointer.pointer != NULL) {
|
||||
wl_pointer_release(backend->pointer.pointer);
|
||||
backend->pointer.pointer = NULL;
|
||||
}
|
||||
|
||||
if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
|
||||
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) {
|
||||
if (backend->pointer.pointer == NULL) {
|
||||
backend->pointer.pointer = wl_seat_get_pointer(wl_seat);
|
||||
wl_pointer_add_listener(backend->pointer.pointer, &pointer_listener, backend);
|
||||
}
|
||||
} else {
|
||||
if (backend->pointer.pointer != NULL) {
|
||||
wl_pointer_release(backend->pointer.pointer);
|
||||
backend->pointer.pointer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue