[PATCH libinput 1/3] Add msleep() helper function
For those whose eyes struggle to focus on 5 zeros in a row, or those just sick of forgetting one zero and wondering why things don't work. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- src/libinput-util.h | 8 test/touchpad.c | 12 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/libinput-util.h b/src/libinput-util.h index 11c4f5c..2558a3d 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -23,6 +23,8 @@ #ifndef LIBINPUT_UTIL_H #define LIBINPUT_UTIL_H +#include unistd.h + #include libinput.h void @@ -84,4 +86,10 @@ zalloc(size_t size) return calloc(1, size); } +static inline void +msleep(unsigned int ms) +{ + usleep(ms * 1000); +} + #endif /* LIBINPUT_UTIL_H */ diff --git a/test/touchpad.c b/test/touchpad.c index 3565833..690e105 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -125,7 +125,7 @@ START_TEST(touchpad_1fg_tap) assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); - usleep(30); /* tap-n-drag timeout */ + msleep(300); /* tap-n-drag timeout */ assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); @@ -177,7 +177,7 @@ START_TEST(touchpad_1fg_tap_n_drag) ck_assert_int_eq(libinput_next_event_type(li), LIBINPUT_EVENT_NONE); - usleep(30); /* tap-n-drag timeout */ + msleep(300); /* tap-n-drag timeout */ assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); @@ -202,7 +202,7 @@ START_TEST(touchpad_2fg_tap) assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); - usleep(30); /* tap-n-drag timeout */ + msleep(300); /* tap-n-drag timeout */ assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); @@ -681,7 +681,7 @@ START_TEST(clickpad_softbutton_left_1st_fg_move) /* move out of the area, then wait for softbutton timer */ litest_touch_move_to(dev, 0, 20, 90, 90, 20, 10); libinput_dispatch(li); - usleep(40); + msleep(400); libinput_dispatch(li); litest_drain_events(li); @@ -982,13 +982,13 @@ START_TEST(clickpad_topsoftbuttons_move_out_ignore) litest_touch_down(dev, 0, 50, 5); libinput_dispatch(li); - usleep(20); + msleep(200); libinput_dispatch(li); litest_assert_empty_queue(li); litest_touch_move_to(dev, 0, 50, 5, 80, 90, 20); libinput_dispatch(li); - usleep(40); + msleep(400); libinput_dispatch(li); litest_event(dev, EV_KEY, BTN_LEFT, 1); -- 1.9.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] xdg-shell: Fix a typo in description
Signed-off-by: Boyan Ding stu_...@126.com --- protocol/xdg-shell.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml index 28add40..0327f40 100644 --- a/protocol/xdg-shell.xml +++ b/protocol/xdg-shell.xml @@ -304,7 +304,7 @@ /enum event name=configure - description summary=suggest a surface chnage + description summary=suggest a surface change The configure event asks the client to resize its surface. The width and height arguments specify a hint to the window -- 2.0.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 3/3] tablet: ignore pad buttons
We've got big plans for handling pad buttons, and the interface will likely be different for those. Meanwhile, discard any pad button events so no-one can get too used to them. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- src/evdev-tablet.c | 14 -- src/evdev-tablet.h | 1 - test/tablet.c | 50 ++ 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 9f19565..7d03b17 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -179,8 +179,7 @@ tablet_update_button(struct tablet_dispatch *tablet, /* XXX: This really depends on the expected buttons fitting in the mask */ if (evcode = BTN_MISC evcode = BTN_TASK) { - mask = tablet-button_state.pad_buttons; - button = evcode - BTN_MISC; + return; } else if (evcode = BTN_TOUCH evcode = BTN_STYLUS2) { mask = tablet-button_state.stylus_buttons; button = evcode - BTN_TOUCH; @@ -325,21 +324,16 @@ tablet_notify_buttons(struct tablet_dispatch *tablet, uint32_t time, enum libinput_button_state state) { - uint32_t pad_buttons, stylus_buttons; + uint32_t stylus_buttons; - if (state == LIBINPUT_BUTTON_STATE_PRESSED) { - pad_buttons = tablet_get_pressed_buttons(tablet, pad_buttons); + if (state == LIBINPUT_BUTTON_STATE_PRESSED) stylus_buttons = tablet_get_pressed_buttons(tablet, stylus_buttons); - } else { - pad_buttons = tablet_get_released_buttons(tablet, pad_buttons); + else stylus_buttons = tablet_get_released_buttons(tablet, stylus_buttons); - } tablet_notify_button_mask(tablet, device, time, - pad_buttons, BTN_MISC, state); - tablet_notify_button_mask(tablet, device, time, stylus_buttons, BTN_TOUCH, state); } diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h index 9beba7b..504b093 100644 --- a/src/evdev-tablet.h +++ b/src/evdev-tablet.h @@ -38,7 +38,6 @@ enum tablet_status { }; struct button_state { - uint32_t pad_buttons; /* bitmask of evcode - BTN_MISC */ uint32_t stylus_buttons; /* bitmask of evcode - BTN_TOUCH */ }; diff --git a/test/tablet.c b/test/tablet.c index 3bfbb6a..6fb4465 100644 --- a/test/tablet.c +++ b/test/tablet.c @@ -537,6 +537,55 @@ START_TEST(invalid_serials) } END_TEST +START_TEST(pad_buttons_ignored) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev-libinput; + struct libinput_event *event; + struct axis_replacement axes[] = { + { ABS_DISTANCE, 10 }, + { -1, -1 } + }; + int button; + + litest_drain_events(li); + + for (button = BTN_0; button BTN_MOUSE; button++) { + litest_event(dev, EV_KEY, button, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, button, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + } + + while ((event = libinput_get_event(li))) { + ck_assert_int_ne(libinput_event_get_type, +LIBINPUT_EVENT_TABLET_BUTTON); + libinput_event_destroy(event); + libinput_dispatch(li); + } + + /* same thing while in prox */ + litest_tablet_proximity_in(dev, 10, 10, axes); + for (button = BTN_0; button BTN_MOUSE; button++) { + litest_event(dev, EV_KEY, button, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, button, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + } + litest_tablet_proximity_out(dev); + + libinput_dispatch(li); + while ((event = libinput_get_event(li))) { + ck_assert_int_ne(libinput_event_get_type, +LIBINPUT_EVENT_TABLET_BUTTON); + libinput_event_destroy(event); + libinput_dispatch(li); + } +} +END_TEST + int main(int argc, char **argv) { @@ -548,6 +597,7 @@ main(int argc, char **argv) litest_add(tablet:proximity, bad_distance_events, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); litest_add(tablet:motion, motion, LITEST_TABLET, LITEST_ANY); litest_add(tablet:normalization, normalization, LITEST_TABLET, LITEST_ANY); + litest_add(tablet:pad, pad_buttons_ignored, LITEST_TABLET, LITEST_ANY); return litest_run(argc, argv); } -- 1.9.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org
[PATCH libinput 1/3] tablet: provide x/y by default in mm off the top/left corner
Given that tablets may not have the same x/y resolution, raw or normalized values are mostly meaningless and likely to be handled the wrong way. Providing x/y in mm is the only constant, meaningful value. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- src/evdev-tablet.c | 3 +++ src/libinput.h | 10 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 4efb36c..09bb454 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -141,6 +141,9 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet, switch (a) { case LIBINPUT_TABLET_AXIS_X: case LIBINPUT_TABLET_AXIS_Y: + tablet-axes[a] = evdev_convert_to_mm(absinfo, + absinfo-value); + break; case LIBINPUT_TABLET_AXIS_DISTANCE: tablet-axes[a] = absinfo-value; break; diff --git a/src/libinput.h b/src/libinput.h index 04f40fa..ada6829 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -861,11 +861,11 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event, * * Return the axis value of a given axis for a tablet. The interpretation of the * value is dependent on the axis: - * - @ref LIBINPUT_TABLET_AXIS_X and @ref LIBINPUT_TABLET_AXIS_Y - the raw X and - * Y coordinates of the tablet tool. By default these are not transformed, - * however libinput provides libinput_event_tablet_get_x_transformed() and - * libinput_event_tablet_get_y_transformed() for transforming each respective - * axis value. + * - @ref LIBINPUT_TABLET_AXIS_X and @ref LIBINPUT_TABLET_AXIS_Y - the X and + * Y coordinates of the tablet tool, in mm from the top left corner of the + * tablet. Use libinput_event_tablet_get_x_transformed() and + * libinput_event_tablet_get_y_transformed() for transforming each + * respective axis value. * - @ref LIBINPUT_TABLET_AXIS_DISTANCE - Approximately how many millimeters * away from the tablet's sensor the tool is * - @ref LIBINPUT_TABLET_AXIS_PRESSURE - The current pressure being applied on -- 1.9.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput 3/3] Change the logging system to be per-context
On Wed, Jun 18, 2014 at 10:07:12AM +0200, Jonas Ådahl wrote: On Wed, Jun 18, 2014 at 05:52:04PM +1000, Peter Hutterer wrote: On Wed, Jun 18, 2014 at 09:24:03AM +0200, Jonas Ådahl wrote: The purpose of the struct was to provide an interface with the functionality that libinput would require to have to function without having to be root, and it doesn't feel logging function fits this purpose. It was already a set/get, wouldn't it fit better to just make them per context, while keeping the interface struct minimal? yeah, fair enough. I arrived at this solution at a bit of a roundabout way since I wanted to make the current udev_create work without changes and then failed anyway. with the create_context function it's possible now to do the following: li = libinput_udev_create_context(); libinput_set_log_handler(li, ...); libinput_set_log_priority(li, ...); libinput_udev_set_set(li, seat); That's what you're proposing, right? Yes, something like that. We could also possibly do what I think we discussed a while ago and default to suspended, i.e. _create_for_seat(), _set_(), _enable(), but either way really. The problem with _set_seat() though I guess is that it makes it look like we can actually switch seat of a context, which I don't know if we should support. well, we could do it as add/remove like in the path backend, I just don't know if there's a use-case for that? Not sure. A user could just create multiple contexts if libinput only would can handle one physical seat per context. for the current code I'll just add a check, right now it just overwrites it which is a bug. other name suggestions: assign_seat() or bind_seat() Any of these two would be best IMHO. If we'd want to support multiple physical backends some day, we could just add the unbind/unassign function, but for now, lets just support one. Maybe just fail if it's called twice instead of overwrite? for the archives, i've done a s/set_seat/assign_seat/ on these functions, and added the code to fail if the function is called once a seat has been assigned. Cheers, Peter ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel