[PATCH libinput 09/14] switch: prevent switches to send the same event twice
Peter Hutterer
peter.hutterer at who-t.net
Wed Jan 25 23:44:19 UTC 2017
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/evdev.c b/src/evdev.c
index 2e0402b..50c8abd 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1317,10 +1317,16 @@ lid_switch_process_switch(struct lid_switch_dispatch *dispatch,
struct input_event *e,
uint64_t time)
{
+ bool is_closed;
+
switch (e->code) {
case SW_LID:
- dispatch->lid_is_closed = !!e->value;
+ is_closed = !!e->value;
+ if (dispatch->lid_is_closed == is_closed)
+ return;
+
+ dispatch->lid_is_closed = is_closed;
switch_notify_toggle(&device->base,
time,
LIBINPUT_SWITCH_LID,
--
2.9.3
More information about the wayland-devel
mailing list