Hi Peter,

> On Jun 6, 2016, at 1:50 AM, Peter Hutterer <peter.hutte...@who-t.net> wrote:
> 
> This is only set on button events so use the same approach as for rings and
> strips. No functional changes.
> 
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
> src/libinput.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/src/libinput.c b/src/libinput.c
> index 89fa594..0f676a3 100644
> --- a/src/libinput.c
> +++ b/src/libinput.c
> @@ -140,10 +140,12 @@ struct libinput_event_tablet_tool {
> 
> struct libinput_event_tablet_pad {
>       struct libinput_event base;
> -     uint32_t button;
> -     enum libinput_button_state state;
>       uint64_t time;
>       struct {
> +             uint32_t button;

Curious, why did you choose 'button' here instead of 'id' or 'number'?
The semantics would be a little cleaner, especially below, when
returning `button.button` rather than, say, `button.number`.


> +             enum libinput_button_state state;
> +     } button;
> +     struct {
>               enum libinput_tablet_pad_ring_axis_source source;
>               double position;
>               int number;
> @@ -2408,8 +2410,8 @@ tablet_pad_notify_button(struct libinput_device *device,
> 
>       *button_event = (struct libinput_event_tablet_pad) {
>               .time = time,
> -             .button = button,
> -             .state = state,
> +             .button.button = button,
> +             .button.state = state,
>       };
> 
>       post_device_event(device,
> @@ -2973,7 +2975,7 @@ libinput_event_tablet_pad_get_button_number(struct 
> libinput_event_tablet_pad *ev
>                          0,
>                          LIBINPUT_EVENT_TABLET_PAD_BUTTON);
> 
> -     return event->button;
> +     return event->button.button;

^ Per my comment above.

yong


> }
> 
> LIBINPUT_EXPORT enum libinput_button_state
> @@ -2984,7 +2986,7 @@ libinput_event_tablet_pad_get_button_state(struct 
> libinput_event_tablet_pad *eve
>                          LIBINPUT_BUTTON_STATE_RELEASED,
>                          LIBINPUT_EVENT_TABLET_PAD_BUTTON);
> 
> -     return event->state;
> +     return event->button.state;
> }
> 
> LIBINPUT_EXPORT uint32_t
> -- 
> 2.7.4


_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to