[PATCH libinput 04/11] touchpad: only check keyboards for disable-while-typing

Benjamin Tissoires benjamin.tissoires at gmail.com
Tue May 26 13:43:20 PDT 2015


On Mon, May 25, 2015 at 6:52 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> The keyboard test is a simple one, if we have the first row of alphabetic
> keys, we assume it's a full keyboard.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---

Yep.

I was trying to understand why the Pixel was not able to get the
disable while typing feature and this was because one of the power
button input node was catching the dwt feature before the keyboard.

The whole series is Tested-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>

Cheers,
Benjamin

>  src/evdev-mt-touchpad.c | 22 ++++++++++++----------
>  src/evdev.c             | 20 ++++++++++++++++++++
>  src/evdev.h             |  1 +
>  3 files changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 1ea3bce..7a5c363 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -1006,16 +1006,18 @@ tp_interface_device_added(struct evdev_device *device,
>                                         tp_trackpoint_event, tp);
>         }
>
> -       /* FIXME: detect external keyboard better */
> -       kbd_is_internal = bus_tp != BUS_BLUETOOTH &&
> -                         bus_kbd == bus_tp;
> -       if (tp_is_internal && kbd_is_internal &&
> -           tp->dwt.keyboard == NULL) {
> -               libinput_device_add_event_listener(&added_device->base,
> -                                       &tp->dwt.keyboard_listener,
> -                                       tp_keyboard_event, tp);
> -               tp->dwt.keyboard = added_device;
> -               tp->dwt.keyboard_active = false;
> +       if (added_device->tags & EVDEV_TAG_KEYBOARD) {
> +               /* FIXME: detect external keyboard better */
> +               kbd_is_internal = bus_tp != BUS_BLUETOOTH &&
> +                                 bus_kbd == bus_tp;
> +               if (tp_is_internal && kbd_is_internal &&
> +                   tp->dwt.keyboard == NULL) {
> +                       libinput_device_add_event_listener(&added_device->base,
> +                                               &tp->dwt.keyboard_listener,
> +                                               tp_keyboard_event, tp);
> +                       tp->dwt.keyboard = added_device;
> +                       tp->dwt.keyboard_active = false;
> +               }
>         }
>
>         if (tp->sendevents.current_mode !=
> diff --git a/src/evdev.c b/src/evdev.c
> index 1a71e4c..6fc5bbc 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -734,6 +734,25 @@ evdev_tag_trackpoint(struct evdev_device *device,
>  }
>
>  static void
> +evdev_tag_keyboard(struct evdev_device *device,
> +                  struct udev_device *udev_device)
> +{
> +       int code;
> +
> +       if (!libevdev_has_event_type(device->evdev, EV_KEY))
> +               return;
> +
> +       for (code = KEY_Q; code <= KEY_P; code++) {
> +               if (!libevdev_has_event_code(device->evdev,
> +                                            EV_KEY,
> +                                            code))
> +                       return;
> +       }
> +
> +       device->tags |= EVDEV_TAG_KEYBOARD;
> +}
> +
> +static void
>  fallback_process(struct evdev_dispatch *dispatch,
>                  struct evdev_device *device,
>                  struct input_event *event,
> @@ -831,6 +850,7 @@ fallback_tag_device(struct evdev_device *device,
>  {
>         evdev_tag_external_mouse(device, udev_device);
>         evdev_tag_trackpoint(device, udev_device);
> +       evdev_tag_keyboard(device, udev_device);
>  }
>
>  static int
> diff --git a/src/evdev.h b/src/evdev.h
> index 22e6b01..337097b 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -68,6 +68,7 @@ enum evdev_device_tags {
>         EVDEV_TAG_INTERNAL_TOUCHPAD = (1 << 1),
>         EVDEV_TAG_TRACKPOINT = (1 << 2),
>         EVDEV_TAG_TOUCHPAD_TRACKPOINT = (1 << 3),
> +       EVDEV_TAG_KEYBOARD = (1 << 4),
>  };
>
>  enum evdev_middlebutton_state {
> --
> 2.4.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list