[PATCH weston 1/2] libinput: Ignore non seat wide pointer button events

Daniel Stone daniel at fooishbar.org
Thu Jan 29 06:32:29 PST 2015


Hi,

On 28 January 2015 at 04:18, Jonas Ådahl <jadahl at gmail.com> wrote:
> Pointer button events will be received from a device where a button has
> been pressed, even though an equivalent button has been pressed (same
> button code) on a device connected to the same seat. notify_button()
> expects to only be called as if there was only one pointer device
> associated with the given seat, so to achieve this, ignore every event
> where forwarding it would result in multiple 'pressed' or 'released'
> notifications.

I agree with the rationale. I see Bill's point, but this is what X11
does today, and allowing multiple presses/etc for the same button to
bubble through would be enormously confusing both to the compositor
and to clients. In particular, it deviates from X11's behaviour. I'd
consider allowing this to be a protocol change, and an undesirable one
at that.

That being said, the commit message should be better - something about
only the first press and last release rather than 'seat-wide', which
initially threw me into thinking it was more of a device configuration
than event processing issue. With that fixed, for both patches:
Reviewed-by: Daniel Stone <daniels at collabora.com>

Cheers,
Daniel

> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>
> These two should be safe for the upcoming stable release IMO.
>
>
> Jonas
>
>  src/libinput-device.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/src/libinput-device.c b/src/libinput-device.c
> index 3ce74b8..5c5b9b9 100644
> --- a/src/libinput-device.c
> +++ b/src/libinput-device.c
> @@ -119,6 +119,17 @@ handle_pointer_button(struct libinput_device *libinput_device,
>  {
>         struct evdev_device *device =
>                 libinput_device_get_user_data(libinput_device);
> +       int button_state =
> +               libinput_event_pointer_get_button_state(pointer_event);
> +       int seat_button_count =
> +               libinput_event_pointer_get_seat_button_count(pointer_event);
> +
> +       /* Ignore button events that are not seat wide state changes. */
> +       if ((button_state == LIBINPUT_BUTTON_STATE_PRESSED &&
> +            seat_button_count != 1) ||
> +           (button_state == LIBINPUT_BUTTON_STATE_RELEASED &&
> +            seat_button_count != 0))
> +               return;
>
>         notify_button(device->seat,
>                       libinput_event_pointer_get_time(pointer_event),
> --
> 2.1.0
>
> _______________________________________________
> 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