private void HandleDeviceRemoved(IntPtr context, IntPtr device) { if (LibInput.DeviceHasCapability(device, DeviceCapability.Keyboard)) { int id = GetId(device); Keyboards.TryRemove(id); KeyboardCandidates.TryRemove(id); } if (LibInput.DeviceHasCapability(device, DeviceCapability.Mouse)) { int id = GetId(device); Mice.TryRemove(id); MouseCandidates.TryRemove(id); } }