From 9bdca0441c1a3e3469449e3713b977629971549e Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Mon, 4 Nov 2024 22:14:01 +0100 Subject: [PATCH] recreate wl_{pointer,keyboard} on capability event this should fix #88 --- input-capture/src/wayland.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/input-capture/src/wayland.rs b/input-capture/src/wayland.rs index 6f2e498f..22e588e7 100644 --- a/input-capture/src/wayland.rs +++ b/input-capture/src/wayland.rs @@ -648,10 +648,16 @@ impl Dispatch for State { capabilities: WEnum::Value(capabilities), } = event { - if capabilities.contains(wl_seat::Capability::Pointer) && state.pointer.is_none() { + if capabilities.contains(wl_seat::Capability::Pointer) { + if let Some(p) = state.pointer.take() { + p.release(); + } state.pointer.replace(seat.get_pointer(qh, ())); } - if capabilities.contains(wl_seat::Capability::Keyboard) && state.keyboard.is_none() { + if capabilities.contains(wl_seat::Capability::Keyboard) { + if let Some(k) = state.keyboard.take() { + k.release(); + } seat.get_keyboard(qh, ()); } }