Hi,

On 09/03/2014 04:03 AM, Peter Hutterer wrote:
> We previously called this function only before device removal, so failing to
> update the button state didn't matter. To make this function generic for the
> device suspend/resume, we need to keep track of the button/key count properly.
> 
> If we have a key down multiple times on suspend though, log a bug.
> The dispatch should release the keys before we even get here (functionality
> added in a subsequent patch).
> 
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

Looks good:

Reviewed-by: Hans de Goede <hdego...@redhat.com>

Regards,

Hans

> ---
>  src/evdev.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index fad9fd9..88b7c9e 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -1201,20 +1201,29 @@ release_pressed_keys(struct evdev_device *device)
>               return;
>  
>       for (code = 0; code < KEY_CNT; code++) {
> -             if (get_key_down_count(device, code) > 0) {
> +             int count = get_key_down_count(device, code);
> +
> +             if (count > 1) {
> +                     log_bug_libinput(libinput,
> +                                      "Key %d is down %d times.\n",
> +                                      code,
> +                                      count);
> +             }
> +
> +             while (get_key_down_count(device, code) > 0) {
>                       switch (get_key_type(code)) {
>                       case EVDEV_KEY_TYPE_NONE:
>                               break;
>                       case EVDEV_KEY_TYPE_KEY:
> -                             keyboard_notify_key(
> -                                     &device->base,
> +                             evdev_keyboard_notify_key(
> +                                     device,
>                                       time,
>                                       code,
>                                       LIBINPUT_KEY_STATE_RELEASED);
>                               break;
>                       case EVDEV_KEY_TYPE_BUTTON:
> -                             pointer_notify_button(
> -                                     &device->base,
> +                             evdev_pointer_notify_button(
> +                                     device,
>                                       time,
>                                       code,
>                                       LIBINPUT_BUTTON_STATE_RELEASED);
> 
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to