On Wed, Jun 04, 2014 at 12:54:58PM +1000, Peter Hutterer wrote: > On Tue, Jun 03, 2014 at 08:08:02PM -0400, Stephen Chandler Paul wrote: > > Button states are applicable to more then just the pointer, so having a > > non-generic name name for a generic enumerator value like > > libinput_pointer_button_state doesn't make sense. Changing it to something > > generic like libinput_button_state allows it to be reused by other devices > > that > > may potentially be added to libinput in the future. > > > > Signed-off-by: Stephen Chandler Paul <[email protected]> > > this looks good to me, and saves us from introducing a separate but same > enum for the tablet buttons.
Looks good to me too, but would like to wait with pushing until I have patches to avoid breaking at least weston and GNOME builders. Jonas > > Reviewed-by: Peter Hutterer <[email protected]> > > Cheers, > Peter > > > --- > > src/evdev-mt-touchpad-buttons.c | 18 +++++++++--------- > > src/evdev-mt-touchpad-tap.c | 34 +++++++++++++++++----------------- > > src/evdev.c | 4 ++-- > > src/libinput-private.h | 2 +- > > src/libinput.c | 12 ++++++------ > > src/libinput.h | 8 ++++---- > > test/pointer.c | 8 ++++---- > > test/touchpad.c | 30 +++++++++++++++--------------- > > tools/event-debug.c | 4 ++-- > > 9 files changed, 60 insertions(+), 60 deletions(-) > > > > diff --git a/src/evdev-mt-touchpad-buttons.c > > b/src/evdev-mt-touchpad-buttons.c > > index faf04b7..7680334 100644 > > --- a/src/evdev-mt-touchpad-buttons.c > > +++ b/src/evdev-mt-touchpad-buttons.c > > @@ -687,7 +687,7 @@ static int > > tp_post_clickfinger_buttons(struct tp_dispatch *tp, uint64_t time) > > { > > uint32_t current, old, button; > > - enum libinput_pointer_button_state state; > > + enum libinput_button_state state; > > > > current = tp->buttons.state; > > old = tp->buttons.old_state; > > @@ -704,11 +704,11 @@ tp_post_clickfinger_buttons(struct tp_dispatch *tp, > > uint64_t time) > > return 0; > > } > > tp->buttons.active = button; > > - state = LIBINPUT_POINTER_BUTTON_STATE_PRESSED; > > + state = LIBINPUT_BUTTON_STATE_PRESSED; > > } else { > > button = tp->buttons.active; > > tp->buttons.active = 0; > > - state = LIBINPUT_POINTER_BUTTON_STATE_RELEASED; > > + state = LIBINPUT_BUTTON_STATE_RELEASED; > > } > > > > if (button) > > @@ -729,13 +729,13 @@ tp_post_physical_buttons(struct tp_dispatch *tp, > > uint64_t time) > > button = BTN_LEFT; > > > > while (current || old) { > > - enum libinput_pointer_button_state state; > > + enum libinput_button_state state; > > > > if ((current & 0x1) ^ (old & 0x1)) { > > if (!!(current & 0x1)) > > - state = LIBINPUT_POINTER_BUTTON_STATE_PRESSED; > > + state = LIBINPUT_BUTTON_STATE_PRESSED; > > else > > - state = LIBINPUT_POINTER_BUTTON_STATE_RELEASED; > > + state = LIBINPUT_BUTTON_STATE_RELEASED; > > > > pointer_notify_button(&tp->device->base, > > time, > > @@ -755,7 +755,7 @@ static int > > tp_post_softbutton_buttons(struct tp_dispatch *tp, uint64_t time) > > { > > uint32_t current, old, button; > > - enum libinput_pointer_button_state state; > > + enum libinput_button_state state; > > enum { AREA = 0x01, LEFT = 0x02, MIDDLE = 0x04, RIGHT = 0x08 }; > > > > current = tp->buttons.state; > > @@ -803,11 +803,11 @@ tp_post_softbutton_buttons(struct tp_dispatch *tp, > > uint64_t time) > > button = BTN_LEFT; > > > > tp->buttons.active = button; > > - state = LIBINPUT_POINTER_BUTTON_STATE_PRESSED; > > + state = LIBINPUT_BUTTON_STATE_PRESSED; > > } else { > > button = tp->buttons.active; > > tp->buttons.active = 0; > > - state = LIBINPUT_POINTER_BUTTON_STATE_RELEASED; > > + state = LIBINPUT_BUTTON_STATE_RELEASED; > > } > > > > tp->buttons.click_pending = false; > > diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c > > index eee334f..69829bb 100644 > > --- a/src/evdev-mt-touchpad-tap.c > > +++ b/src/evdev-mt-touchpad-tap.c > > @@ -99,7 +99,7 @@ static void > > tp_tap_notify(struct tp_dispatch *tp, > > uint64_t time, > > int nfingers, > > - enum libinput_pointer_button_state state) > > + enum libinput_button_state state) > > { > > int32_t button; > > > > @@ -170,7 +170,7 @@ tp_tap_touch_handle_event(struct tp_dispatch *tp, enum > > tap_event event, uint64_t > > break; > > case TAP_EVENT_RELEASE: > > tp->tap.state = TAP_STATE_TAPPED; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED); > > tp_tap_set_timer(tp, time); > > break; > > case TAP_EVENT_TIMEOUT: > > @@ -220,11 +220,11 @@ tp_tap_tapped_handle_event(struct tp_dispatch *tp, > > enum tap_event event, uint64_ > > break; > > case TAP_EVENT_TIMEOUT: > > tp->tap.state = TAP_STATE_IDLE; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > case TAP_EVENT_BUTTON: > > tp->tap.state = TAP_STATE_DEAD; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > } > > } > > @@ -240,8 +240,8 @@ tp_tap_touch2_handle_event(struct tp_dispatch *tp, enum > > tap_event event, uint64_ > > break; > > case TAP_EVENT_RELEASE: > > tp->tap.state = TAP_STATE_HOLD; > > - tp_tap_notify(tp, time, 2, > > LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > - tp_tap_notify(tp, time, 2, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 2, LIBINPUT_BUTTON_STATE_PRESSED); > > + tp_tap_notify(tp, time, 2, LIBINPUT_BUTTON_STATE_RELEASED); > > tp_tap_clear_timer(tp); > > break; > > case TAP_EVENT_MOTION: > > @@ -293,8 +293,8 @@ tp_tap_touch3_handle_event(struct tp_dispatch *tp, enum > > tap_event event, uint64_ > > break; > > case TAP_EVENT_RELEASE: > > tp->tap.state = TAP_STATE_TOUCH_2_HOLD; > > - tp_tap_notify(tp, time, 3, > > LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > - tp_tap_notify(tp, time, 3, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 3, LIBINPUT_BUTTON_STATE_PRESSED); > > + tp_tap_notify(tp, time, 3, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > case TAP_EVENT_BUTTON: > > tp->tap.state = TAP_STATE_DEAD; > > @@ -332,9 +332,9 @@ tp_tap_dragging_or_doubletap_handle_event(struct > > tp_dispatch *tp, enum tap_event > > break; > > case TAP_EVENT_RELEASE: > > tp->tap.state = TAP_STATE_IDLE; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > tp_tap_clear_timer(tp); > > break; > > case TAP_EVENT_MOTION: > > @@ -343,7 +343,7 @@ tp_tap_dragging_or_doubletap_handle_event(struct > > tp_dispatch *tp, enum tap_event > > break; > > case TAP_EVENT_BUTTON: > > tp->tap.state = TAP_STATE_DEAD; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > } > > } > > @@ -366,7 +366,7 @@ tp_tap_dragging_handle_event(struct tp_dispatch *tp, > > enum tap_event event, uint6 > > break; > > case TAP_EVENT_BUTTON: > > tp->tap.state = TAP_STATE_DEAD; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > } > > } > > @@ -385,11 +385,11 @@ tp_tap_dragging_wait_handle_event(struct tp_dispatch > > *tp, enum tap_event event, > > break; > > case TAP_EVENT_TIMEOUT: > > tp->tap.state = TAP_STATE_IDLE; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > case TAP_EVENT_BUTTON: > > tp->tap.state = TAP_STATE_DEAD; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > } > > } > > @@ -404,7 +404,7 @@ tp_tap_dragging2_handle_event(struct tp_dispatch *tp, > > enum tap_event event, uint > > break; > > case TAP_EVENT_TOUCH: > > tp->tap.state = TAP_STATE_DEAD; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > case TAP_EVENT_MOTION: > > case TAP_EVENT_TIMEOUT: > > @@ -412,7 +412,7 @@ tp_tap_dragging2_handle_event(struct tp_dispatch *tp, > > enum tap_event event, uint > > break; > > case TAP_EVENT_BUTTON: > > tp->tap.state = TAP_STATE_DEAD; > > - tp_tap_notify(tp, time, 1, > > LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > } > > } > > diff --git a/src/evdev.c b/src/evdev.c > > index d32ece3..dbe0b07 100644 > > --- a/src/evdev.c > > +++ b/src/evdev.c > > @@ -302,8 +302,8 @@ evdev_process_key(struct evdev_device *device, struct > > input_event *e, int time) > > &device->base, > > time, > > e->code, > > - e->value ? LIBINPUT_POINTER_BUTTON_STATE_PRESSED : > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + e->value ? LIBINPUT_BUTTON_STATE_PRESSED : > > + LIBINPUT_BUTTON_STATE_RELEASED); > > break; > > > > default: > > diff --git a/src/libinput-private.h b/src/libinput-private.h > > index 61cdc79..ea0f8c9 100644 > > --- a/src/libinput-private.h > > +++ b/src/libinput-private.h > > @@ -153,7 +153,7 @@ void > > pointer_notify_button(struct libinput_device *device, > > uint32_t time, > > int32_t button, > > - enum libinput_pointer_button_state state); > > + enum libinput_button_state state); > > > > void > > pointer_notify_axis(struct libinput_device *device, > > diff --git a/src/libinput.c b/src/libinput.c > > index 6b7e8b8..700dbfa 100644 > > --- a/src/libinput.c > > +++ b/src/libinput.c > > @@ -65,7 +65,7 @@ struct libinput_event_pointer { > > li_fixed_t y; > > uint32_t button; > > uint32_t seat_button_count; > > - enum libinput_pointer_button_state state; > > + enum libinput_button_state state; > > enum libinput_pointer_axis axis; > > li_fixed_t value; > > }; > > @@ -348,7 +348,7 @@ libinput_event_pointer_get_button(struct > > libinput_event_pointer *event) > > return event->button; > > } > > > > -LIBINPUT_EXPORT enum libinput_pointer_button_state > > +LIBINPUT_EXPORT enum libinput_button_state > > libinput_event_pointer_get_button_state(struct libinput_event_pointer > > *event) > > { > > return event->state; > > @@ -712,14 +712,14 @@ update_seat_key_count(struct libinput_seat *seat, > > static uint32_t > > update_seat_button_count(struct libinput_seat *seat, > > int32_t button, > > - enum libinput_pointer_button_state state) > > + enum libinput_button_state state) > > { > > assert(button >= 0 && button <= KEY_MAX); > > > > switch (state) { > > - case LIBINPUT_POINTER_BUTTON_STATE_PRESSED: > > + case LIBINPUT_BUTTON_STATE_PRESSED: > > return ++seat->button_count[button]; > > - case LIBINPUT_POINTER_BUTTON_STATE_RELEASED: > > + case LIBINPUT_BUTTON_STATE_RELEASED: > > /* We might not have received the first PRESSED event. */ > > if (seat->button_count[button] == 0) > > return 0; > > @@ -863,7 +863,7 @@ void > > pointer_notify_button(struct libinput_device *device, > > uint32_t time, > > int32_t button, > > - enum libinput_pointer_button_state state) > > + enum libinput_button_state state) > > { > > struct libinput_event_pointer *button_event; > > int32_t seat_button_count; > > diff --git a/src/libinput.h b/src/libinput.h > > index d771e21..ace7696 100644 > > --- a/src/libinput.h > > +++ b/src/libinput.h > > @@ -135,9 +135,9 @@ enum libinput_led { > > * Logical state of a physical button. Note that the logical state may not > > * represent the physical state of the button. > > */ > > -enum libinput_pointer_button_state { > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED = 0, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED = 1 > > +enum libinput_button_state { > > + LIBINPUT_BUTTON_STATE_RELEASED = 0, > > + LIBINPUT_BUTTON_STATE_PRESSED = 1 > > }; > > > > > > @@ -582,7 +582,7 @@ libinput_event_pointer_get_button(struct > > libinput_event_pointer *event); > > * > > * @return the button state triggering this event > > */ > > -enum libinput_pointer_button_state > > +enum libinput_button_state > > libinput_event_pointer_get_button_state(struct libinput_event_pointer > > *event); > > > > /** > > diff --git a/test/pointer.c b/test/pointer.c > > index f47e094..6983837 100644 > > --- a/test/pointer.c > > +++ b/test/pointer.c > > @@ -122,8 +122,8 @@ test_button_event(struct litest_device *dev, int > > button, int state) > > ck_assert_int_eq(libinput_event_pointer_get_button(ptrev), button); > > ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrev), > > state ? > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED : > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_PRESSED : > > + LIBINPUT_BUTTON_STATE_RELEASED); > > libinput_event_destroy(event); > > } > > > > @@ -248,7 +248,7 @@ START_TEST(pointer_seat_button_count) > > ck_assert_int_eq(libinput_event_pointer_get_button(tev), > > BTN_LEFT); > > ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > > > ++expected_seat_button_count; > > seat_button_count = > > @@ -278,7 +278,7 @@ START_TEST(pointer_seat_button_count) > > ck_assert_int_eq(libinput_event_pointer_get_button(tev), > > BTN_LEFT); > > ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > > > --expected_seat_button_count; > > seat_button_count = > > diff --git a/test/touchpad.c b/test/touchpad.c > > index 35781c3..9c95309 100644 > > --- a/test/touchpad.c > > +++ b/test/touchpad.c > > @@ -91,7 +91,7 @@ END_TEST > > > > static void > > assert_button_event(struct libinput *li, int button, > > - enum libinput_pointer_button_state state) > > + enum libinput_button_state state) > > { > > struct libinput_event *event; > > struct libinput_event_pointer *ptrev; > > @@ -124,10 +124,10 @@ START_TEST(touchpad_1fg_tap) > > libinput_dispatch(li); > > > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > usleep(300000); /* tap-n-drag timeout */ > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > > > libinput_dispatch(li); > > event = libinput_get_event(li); > > @@ -152,7 +152,7 @@ START_TEST(touchpad_1fg_tap_n_drag) > > libinput_dispatch(li); > > > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > > > libinput_dispatch(li); > > while (libinput_next_event_type(li) == LIBINPUT_EVENT_POINTER_MOTION) { > > @@ -180,7 +180,7 @@ START_TEST(touchpad_1fg_tap_n_drag) > > usleep(300000); /* tap-n-drag timeout */ > > > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > > > libinput_dispatch(li); > > event = libinput_get_event(li); > > @@ -204,10 +204,10 @@ START_TEST(touchpad_2fg_tap) > > libinput_dispatch(li); > > > > assert_button_event(li, BTN_RIGHT, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > usleep(300000); /* tap-n-drag timeout */ > > assert_button_event(li, BTN_RIGHT, > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > > > libinput_dispatch(li); > > event = libinput_get_event(li); > > @@ -232,9 +232,9 @@ START_TEST(touchpad_1fg_clickfinger) > > libinput_dispatch(li); > > > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > > > litest_delete_device(dev); > > } > > @@ -259,9 +259,9 @@ START_TEST(touchpad_2fg_clickfinger) > > libinput_dispatch(li); > > > > assert_button_event(li, BTN_RIGHT, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > assert_button_event(li, BTN_RIGHT, > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > > > litest_delete_device(dev); > > } > > @@ -282,9 +282,9 @@ START_TEST(touchpad_btn_left) > > libinput_dispatch(li); > > > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > } > > END_TEST > > > > @@ -321,7 +321,7 @@ START_TEST(clickpad_click_n_drag) > > > > libinput_dispatch(li); > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_PRESSED); > > + LIBINPUT_BUTTON_STATE_PRESSED); > > > > libinput_dispatch(li); > > ck_assert_int_eq(libinput_next_event_type(li), LIBINPUT_EVENT_NONE); > > @@ -345,7 +345,7 @@ START_TEST(clickpad_click_n_drag) > > litest_touch_up(dev, 0); > > > > assert_button_event(li, BTN_LEFT, > > - LIBINPUT_POINTER_BUTTON_STATE_RELEASED); > > + LIBINPUT_BUTTON_STATE_RELEASED); > > } > > END_TEST > > > > diff --git a/tools/event-debug.c b/tools/event-debug.c > > index 3c11b11..583dfe4 100644 > > --- a/tools/event-debug.c > > +++ b/tools/event-debug.c > > @@ -283,14 +283,14 @@ static void > > print_button_event(struct libinput_event *ev) > > { > > struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); > > - enum libinput_pointer_button_state state; > > + enum libinput_button_state state; > > > > print_event_time(libinput_event_pointer_get_time(p)); > > > > state = libinput_event_pointer_get_button_state(p); > > printf("%3d %s, seat count: %u\n", > > libinput_event_pointer_get_button(p), > > - state == LIBINPUT_POINTER_BUTTON_STATE_PRESSED ? "pressed" : > > "released", > > + state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released", > > libinput_event_pointer_get_seat_button_count(p)); > > } > > > > -- > > 1.8.5.5 > > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
