switch: prevent switches to send the same event twice

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-01-25 13:48:01 +10:00
parent 2a1ed92c51
commit 3f5e9cb636

View file

@ -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,