Re: [PATCH weston] compositor: document weston_view_damage_below()
On Tue, 17 Feb 2015 04:35:03 -0800 Jason Ekstrand ja...@jlekstrand.net wrote: Just spent a little time crawling through things to remind myself of how it all works. Your comment seems correct. Not sure if it's really sufficient documentation for view.clip though. Reviewed-by: Jason Ekstrand ja...@jlekstrand.net On Tue, Feb 17, 2015 at 4:19 AM, Pekka Paalanen ppaala...@gmail.com wrote: From: Pekka Paalanen pekka.paala...@collabora.co.uk Explains what weston_view::clip is. Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk --- src/compositor.c | 16 src/compositor.h | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) Pushed. Thanks, pq ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput] udev: fix a race condition if a device disappears before we get a handle
Hi, On 18-02-15 04:36, Peter Hutterer wrote: If the device disappears too quickly, the device is NULL, the sysname is NULL and that causes a segfault in strcmp. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net Looks good / simple: Reviewed-by: Hans de Goede hdego...@redhat.com Regards, Hans --- src/udev-seat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/udev-seat.c b/src/udev-seat.c index 3d05733..6615f20 100644 --- a/src/udev-seat.c +++ b/src/udev-seat.c @@ -158,6 +158,8 @@ udev_input_add_devices(struct udev_input *input, struct udev *udev) udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) { path = udev_list_entry_get_name(entry); device = udev_device_new_from_syspath(udev, path); + if (!device) + continue; sysname = udev_device_get_sysname(device); if (strncmp(event, sysname, 5) != 0) { ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput 01/11] Add an API for touchpad gesture events
On 02/18/2015 04:26 AM, Hans de Goede wrote: For touchscreens we always send raw touch events to the compositor, and the compositor or application toolkits do gesture recognition. This makes sense because on a touchscreen which window / widget the touches are over is important context to know to interpret gestures. On touchpads however we never send raw events since a touchpad is an absolute device which primary function is to send pointer motion delta-s, so we always need to do processing (and a lot of it) on the raw events. I don't quite understand this distinction. I can certainly imagine touchpad gestures that depend on where the cursor is currently. Conversely I can imagine users wanting full-screen gestures on their touchscreen, for instance a fast swipe should not be sent to the widget the down event is at, but to where the cursor was before the swipe was started. I think what is needed is for gesture recognition to be in libinput but also send the raw events. Then a program can ignore the gesture if it wants, and this also allows new gestures to be added without making older programs freeze when you attempt them. (for an implementation I would add a field to events to indicate if they are the last in a set). The only effect of gesture recognition that is unavoidable is that the focus may not match the location of the cursor, in that the raw events are sent to the same target that the gesture is being sent to. I think this is a necessary ability to make the gestures consistent. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput] test: fix Coverity complaints
seat_button_count seat_key_count ... uninitialized variable t = zalloc s = zalloc ... dereferencing potential NULL-pointer d-ntouches_down... side-effect in assertion Coverity run against the 0.10.0 tag, see https://scan.coverity.com/projects/4298 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- test/keyboard.c | 2 +- test/litest.c | 9 +++-- test/pointer.c | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/keyboard.c b/test/keyboard.c index 4563ce6..cb7ad52 100644 --- a/test/keyboard.c +++ b/test/keyboard.c @@ -36,7 +36,7 @@ START_TEST(keyboard_seat_key_count) struct libinput_event *ev; struct libinput_event_keyboard *kev; int i; - int seat_key_count; + int seat_key_count = 0; int expected_key_button_count = 0; char device_name[255]; diff --git a/test/litest.c b/test/litest.c index b220b2f..16d9239 100644 --- a/test/litest.c +++ b/test/litest.c @@ -184,6 +184,7 @@ litest_add_tcase_for_device(struct suite *suite, } t = zalloc(sizeof(*t)); + assert(t != NULL); t-name = strdup(test_name); t-tc = tcase_create(test_name); list_insert(suite-tests, t-node); @@ -215,6 +216,7 @@ litest_add_tcase_no_device(struct suite *suite, void *func) } t = zalloc(sizeof(*t)); + assert(t != NULL); t-name = strdup(test_name); t-tc = tcase_create(test_name); list_insert(suite-tests, t-node); @@ -270,6 +272,7 @@ get_suite(const char *name) } s = zalloc(sizeof(*s)); + assert(s != NULL); s-name = strdup(name); s-suite = suite_create(s-name); @@ -808,7 +811,8 @@ litest_touch_down(struct litest_device *d, unsigned int slot, { struct input_event *ev; - assert(++d-ntouches_down 0); + assert(d-ntouches_down = 0); + d-ntouches_down++; send_btntool(d); @@ -836,7 +840,8 @@ litest_touch_up(struct litest_device *d, unsigned int slot) { .type = -1, .code = -1 } }; - assert(--d-ntouches_down = 0); + assert(d-ntouches_down 0); + d-ntouches_down--; send_btntool(d); diff --git a/test/pointer.c b/test/pointer.c index 2e52a20..24ea726 100644 --- a/test/pointer.c +++ b/test/pointer.c @@ -470,7 +470,7 @@ START_TEST(pointer_seat_button_count) struct libinput_event *ev; struct libinput_event_pointer *tev; int i; - int seat_button_count; + int seat_button_count = 0; int expected_seat_button_count = 0; char device_name[255]; -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [RFC libinput 1/2] Add a buttonset interface for button-only devices
On 2/16/2015 9:11 PM, Peter Hutterer wrote: On Mon, Feb 16, 2015 at 08:13:01AM +0100, Hans de Goede wrote: Hi, On 16-02-15 04:50, Peter Hutterer wrote: snip ok, I've played around with the ideas in this thread and discussed it with Benjamin this morning. Short summary: I think we should go with the original patch, with an optional extension for numbered axes later. I tried the enum spacing first, providing an API where we have LIBINPUT_BUTTONSET_AXIS_TYPE_COUNT = 512 LIBINPUT_BUTTONSET_AXIS_RING = 512 LIBINPUT_BUTTONSET_AXIS_STRIP = 1024 so the caller can use code like libinput_event_buttonset_get_axis_value(event, LIBINPUT_BUTTONSET_AXIS_RING + 2); to get the third axis. switching event-debug showed the issues with this approach: to effectively go through the axes, the client needs two loops, one for the type one for the number and mask the enum into a type and a number component, something that's prone to bugs. Next attempt was to split value and axis number explicitly in the API: libinput_event_buttonset_get_axis_value(event, LIBINPUT_BUTTONSET_AXIS_RING, 2); Better than the above as it's less error-prone. It still doesn't remove the above issue though, nested loops everywhere to access the type and the number. event-debug is a special case in that it doesn't care about the content and cares more about listing/printing everything. However I suspect that any generic toolkit will require the same. [Internally both changes are a bit of a nightmare as both would require some rewriting, but that's solveable] So the question is now: what does this gain us? better handling of truly generic devices with random axes. Which leads into the next question: what are random axes? The above approach is over-engineered because there's a group of axes that only exists once. I don't think there's a device with two X axes on the same device for example. Likewise, there are axes that have more use being semantically labelled than just numbered. The ring axes are a good example, the current RING and RING2 naming is bad, we should name it RING_LEFT, RING_RIGHT instead. Other than say a mix table we'll likely find semantic naming for a majority of the device. For the other devices, we can use a hybrid approach: leave the current API to use enums but in the future, when we require more flexible axes or devices with multiple identical axes we can add calls like: libinput_device_buttonset_has_axis_by_offset(event, axis_number); libinput_device_buttonset_get_axis_type_by_offset(event, axis_number); libinput_event_buttonset_get_axis_value_by_offset(event, axis_number); etc. this would require a duplication of the buttonset API with a by_offset prefix but is otherwise straightforward and leaves the most expressive API as the default one. We also discussed making an axis an object (struct libinput_buttonset_axis) and providing a get_axis(enum) and a get_axis_by_offset(number) call. That object could've then be used in the API. I don't think it's a good idea to do this, it adds complexity (ref, unref, userdata) and effectively reduces the API to magic numbers/variable names again. so long story short, I think we should go with the enum after all and leave numbered/offset axes for the future when we need it. And I do still believe we need an UNKNOWN axis, at XDC we were talking about these button boxes people could buy to use with midi-apps, which were just a bunch of dials, I don't want to do a database of those, so for such a device we should just end up saying this is a buttonbox with UNKNOWN axis, which when absolute must be used with get_transformed only, and the deltas are in an unknown unit, but we can cross that bridge when we get there. once the axis is labelled once, it effectively becomes ABI. if we label something as unknown and then fix it in a later version of libinput we will break things. so we should hide anything we don't know enough about. Nothing stops us from adding a LINEAR_ACTUATOR, MIDI_DIAL, etc. though. Hmm, I still have the feeling the end result is going to be way less generic then what we had in mind when we introduced the buttonset concept, it seems that you're more solving the tablet buttons problem here then introducing a general buttonset API. But if you and Benjamin believe that this is the right way forward lets go with this, we can always extend the API later. yeah, tbh the tablet case is the most obvious for now, it's likely to be the prime use-case for this interface. A truly generic interface with just numbered axes is IMO a lot easier to tack on top than the other way round. Cheers, Peter I'm also somewhat wary of proposed semantic interface. Sure, if the controls had silkscreened labels indicating what they do, then it'd make a lot of sense. Generally
[PATCH v2 libinput 10/15] tools: only print the tablet axes we have on the tool
This doesn't really have an effect, since we don't set the per-tool axes correctly yet. Signed-off-by: Peter Hutterer peter.hutte...@who-t.net --- Changes to v1: - factor out into print_tablet_axes() so we can use the logic from proximity and axes events - only print tilt if the tool supports it tools/event-debug.c | 107 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/tools/event-debug.c b/tools/event-debug.c index 0d25d6a..169224c 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -288,48 +288,78 @@ tablet_axis_changed_sym(struct libinput_event_tablet *t, } static void -print_tablet_axis_event(struct libinput_event *ev) +print_tablet_axes(struct libinput_event_tablet *t) { - struct libinput_event_tablet *t = libinput_event_get_tablet_event(ev); + struct libinput_tool *tool = libinput_event_tablet_get_tool(t); double x, y; double dist, pressure; double rotation, slider; - print_event_time(libinput_event_tablet_get_time(t)); - x = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_X); y = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_Y); printf(\t%.2f%s/%.2f%s, x, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_X), y, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_Y)); - x = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_TILT_X); - y = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_TILT_Y); - printf(\ttilt: %.2f%s/%.2f%s , - x, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_X), - y, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_Y)); + if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_TILT_X) || + libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_TILT_Y)) { + x = libinput_event_tablet_get_axis_value(t, +LIBINPUT_TABLET_AXIS_TILT_X); + y = libinput_event_tablet_get_axis_value(t, +LIBINPUT_TABLET_AXIS_TILT_Y); + printf(\ttilt: %.2f%s/%.2f%s , + x, tablet_axis_changed_sym(t, + LIBINPUT_TABLET_AXIS_TILT_X), + y, tablet_axis_changed_sym(t, + LIBINPUT_TABLET_AXIS_TILT_Y)); + } - dist = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_DISTANCE); - pressure = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_PRESSURE); - if (dist) - printf(distance: %.2f%s, - dist, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_DISTANCE)); - else - printf(pressure: %.2f%s, - pressure, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_PRESSURE)); + if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_DISTANCE) || + libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_PRESSURE)) { + dist = libinput_event_tablet_get_axis_value(t, + LIBINPUT_TABLET_AXIS_DISTANCE); + pressure = libinput_event_tablet_get_axis_value(t, + LIBINPUT_TABLET_AXIS_PRESSURE); + if (dist) { + printf(\tdistance: %.2f%s, + dist, + tablet_axis_changed_sym(t, + LIBINPUT_TABLET_AXIS_DISTANCE)); + } else { + printf(\tpressure: %.2f%s, + pressure, + tablet_axis_changed_sym(t, + LIBINPUT_TABLET_AXIS_PRESSURE)); + } + } - rotation = libinput_event_tablet_get_axis_value(t, + if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_ROTATION_Z)) { + rotation = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_ROTATION_Z); - printf( rotation: %.2f%s, - rotation, - tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_ROTATION_Z)); + printf(\trotation: %.2f%s, + rotation, + tablet_axis_changed_sym(t, + LIBINPUT_TABLET_AXIS_ROTATION_Z)); + } - slider = libinput_event_tablet_get_axis_value(t, + if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_SLIDER)) { + slider = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_SLIDER); - printf( slider: %.2f%s, - slider, - tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_SLIDER)); + printf(\tslider: %.2f%s, +
Re: libinput in Coverity
On Wed, Feb 18, 2015 at 10:06:25AM +1000, Peter Hutterer wrote: On Tue, Feb 17, 2015 at 11:19:58PM +0100, Carlos Olmedo Escobar wrote: I was trying to check libinput in Coverity but it seems it's not there yet. Is there anybody who is supposed to register libinput there? fwiw, I ran irregular coverity checks on Red Hat's internal Coverity instance. last time was for 0.9.0 I think. anyway, I've registered it as a project now, but no builds just yet, I'll do this later today and send an email to the list when everything is done. Registration is complete now. Project link is here: https://scan.coverity.com/projects/4298 I did one build of 0.10.0, 7 defects, all of them easily fixable and in the tests only. I'll send patches out for this later today. Cheers, Peter ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: weston rdp crash on arm
Hi Raphael, You are using a rather old version of Weston (1.7.0 was just released). Considered upgrading the software ? Anyways, I remember pretty well that when 1.5.0 was around, latest FreeRDP master did not work. Here is the git commit that we were using in Tizen back then : 2604ff20bd12e810cfeed735b80dbe90020d781c I hope it helps. 2015-02-16 17:55 GMT+01:00 Raphael Cotty r.co...@cascade-technologies.com: I am trying to run the rdp backend on a proprietary board (arm / zynq). I am using yocto build system, wayland 1.5.0, freerdp (latest master). weston crashes just after the connection (using remmina from a Ubuntu PC). [20:08:40.921] weston 1.5.0 http://wayland.freedesktop.org/ Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Waylandcomponent=westonversion=1.5.0 Build: 1.4.93 configure.ac: Bump version 1.4.93 (2014-05-12 12:51:52 -0700) [20:08:40.922] OS: Linux, 3.6.0-xilinx-00014-gc78d9cf, #56 SMP PREEMPT Fri Mar 28 18:09:55 GMT 2014, armv7l [20:08:40.923] Starting with no config file. [20:08:40.923] Loading module '/usr/lib/weston/rdp-backend.so' [20:08:40.957] using FreeRDP version 1.2.1 [20:08:40:141] [2444:-1224888320] [INFO][com.freerdp.core.listener] - Listening on 0.0.0.0:3389 [20:08:40:143] [2444:-1224888320] [ERROR][com.freerdp.core.listener] - socket [20:08:40.964] Loading module '/usr/lib/weston/desktop-shell.so' [20:08:40.965] Compositor capabilities: arbitrary surface rotation: yes screen capture uses y-flip: yes [20:08:40.981] launching '/usr/lib/weston/weston-desktop-shell' [154264.319] - wl_display@1.get_registry(new id wl_registry@2) [154264.868] wl_display@1.get_registry(new id wl_registry@2) ... [154458.246] wl_display@1.delete_id(16) [154458.492] wl_display@1.delete_id(24) [154458.624] wl_display@1.delete_id(20) [154458.776] wl_display@1.delete_id(23) [154458.908] wl_display@1.delete_id(19) [154459.040] wl_surface@13.enter(wl_output@11) [154459.286] wl_surface@14.enter(wl_output@11) [154459.418] wl_callb...@23.done(2396746158) [154459.607] wl_callb...@19.done(2396746158) [20:08:47.702] caught signal: 11 [160979.659] - wl_surface@15.destroy() [160979.791] - wl_surface@14.destroy() [160979.848] - wl_buffer@22.destroy() Trace/breakpoint trap root@cascade-zynq7:~# [160982.305] - wl_shm_pool@21.destroy() [160982.494] - wl_surface@13.destroy() [160982.588] - wl_buffer@18.destroy() [160982.872] - wl_shm_pool@17.destroy() [160983.061] - wl_shm_pool@10.destroy() [160983.250] - wl_subcompositor@4.destroy() Is there a way to enable the freerdp logs? ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel -- Regards, *Manuel BACHMANN Tizen Project VANNES-FR* ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput v2 6/8] tablet: Include starting values of axes in proximity events
On Wed, Feb 18, 2015 at 01:42:27AM -0500, Stephen Chandler Paul wrote: Having a motion event that's sent right after the original proximity event just to give the values of each axis is somewhat redundant. Since we already include the values of each axis with each type of event, we may as well use the proximity event to give the client the starting values for each axis on the tablet. Signed-off-by: Stephen Chandler Paul thatsly...@gmail.com merged, thanks (well, the diff, I had alread pushed v1 of that) Cheers, Peter --- src/evdev-tablet.c | 38 ++ src/libinput-private.h | 1 + src/libinput.c | 7 ++- src/libinput.h | 10 +++--- test/tablet.c | 8 tools/event-debug.c| 38 +- 6 files changed, 73 insertions(+), 29 deletions(-) Changes - Don't mark all axes as changed on proximity out events - Clear the changed_axes before sending proximity out events, so that we ignore the unwanted reset to 0 for all axis values from evdev. diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index ec4fbfc..73dbef0 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -191,12 +191,21 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet, * it's there, but can't properly receive any data from the tool. */ if (axis_update_needed !tablet_has_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY) - !tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) - tablet_notify_axis(base, -time, -tool, -tablet-changed_axes, -tablet-axes); + !tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) { + if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) + tablet_notify_proximity(device-base, + time, + tool, + LIBINPUT_TOOL_PROXIMITY_IN, + tablet-changed_axes, + tablet-axes); + else + tablet_notify_axis(base, +time, +tool, +tablet-changed_axes, +tablet-axes); + } memset(tablet-changed_axes, 0, sizeof(tablet-changed_axes)); } @@ -470,18 +479,12 @@ tablet_flush(struct tablet_dispatch *tablet, /* Release all stylus buttons */ tablet-button_state.stylus_buttons = 0; tablet_set_status(tablet, TABLET_BUTTONS_RELEASED); - } else if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) { - tablet_notify_proximity(device-base, - time, - tool, - LIBINPUT_TOOL_PROXIMITY_IN, - tablet-axes); - tablet_unset_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY); - } - - if (tablet_has_status(tablet, TABLET_AXES_UPDATED)) { + } else if (tablet_has_status(tablet, TABLET_AXES_UPDATED) || +tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) { sanitize_tablet_axes(tablet); tablet_check_notify_axes(tablet, device, time, tool); + + tablet_unset_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY); tablet_unset_status(tablet, TABLET_AXES_UPDATED); } @@ -504,11 +507,14 @@ tablet_flush(struct tablet_dispatch *tablet, } if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) { + memset(tablet-changed_axes, 0, sizeof(tablet-changed_axes)); tablet_notify_proximity(device-base, time, tool, LIBINPUT_TOOL_PROXIMITY_OUT, + tablet-changed_axes, tablet-axes); + tablet_set_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY); tablet_unset_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY); diff --git a/src/libinput-private.h b/src/libinput-private.h index 415aac4..33ce2db 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -354,6 +354,7 @@ tablet_notify_proximity(struct libinput_device *device, uint32_t time, struct libinput_tool *tool, enum libinput_tool_proximity_state state, + unsigned char *changed_axes,
Re: [PATCH libinput 00/15] tablet: support the remaining tools
On Wed, Feb 18, 2015 at 10:18:59AM -0500, Benjamin Tissoires wrote: Hi Peter, On Wed, Feb 18, 2015 at 12:45 AM, Peter Hutterer peter.hutte...@who-t.net wrote: This patchset adds the remaining tools to the tablet branch (at least for Wacom tools). The notable additions are: * rotation support for mouse/lens cursor * rotation support for the artpen * 'wheel' support for the airbrush * correct per-tool capabilities (including buttons) If you have one of those tools handy, give it a test, most of this was lifted from memory, specs and code I had written in the past - not with an actual physical device at hand. Branch is available for testing here: https://github.com/whot/libinput/tree/wip/wacom-extra-tool-support Thanks for this work. I gave a quick test with the devices I currently have at home: - mouse support: * rotation works just fine * buttons are not handled (silently ignored) * wheel events raise a EV_REL not supported thanks, forgot about those. will fix them. - general pen: * so far, so good - airbrush: * ditto, so far so good - artpen: * don't have it at home, will test it tomorrow at the office thanks. FTR there's a bug in the patch series anyway, I assumed BRUSH was used for the artpen but that tool is for a now-obsolete device only. the artpen is BTN_TOOL_PEN like the normal pens, so we need some extra logic to detect them. Cheers, Peter ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 07/11] touchpad: Gesture support preparation
Handle everything which is not handeld by the tap, (soft)button or edge-scroll code/statemachines in a unified way. Everything is treated as a X-finger gesture now, and the action to take on finger movement is decided by the gesture.finger_mode setting. Pointer control now simply is seen as a 1 finger gesture, and 2fg scrolling as a 2fg gesture. This removed the need for special casing things like switching back to pointer mode when lifting a finger in 2fg scrolling mode, and also lays the groundwork for adding 3+ fg gesture support. Note that 1 test-case needs to be updated to wait for the finger mode switching when switching mode while a gesture has already been started. This is actually an improvement as this stops sending spurious pointer motion events at the end of 2fg scrolling when not lifting both fingers at exactly the same time. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/Makefile.am | 1 + src/evdev-mt-touchpad-buttons.c | 1 - src/evdev-mt-touchpad-edge-scroll.c | 1 - src/evdev-mt-touchpad-gestures.c| 146 src/evdev-mt-touchpad.c | 129 ++- src/evdev-mt-touchpad.h | 47 +--- test/litest.c | 6 ++ test/litest.h | 1 + test/touchpad.c | 12 +++ 9 files changed, 225 insertions(+), 119 deletions(-) create mode 100644 src/evdev-mt-touchpad-gestures.c diff --git a/src/Makefile.am b/src/Makefile.am index b5eba73..ff65ff7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,6 +15,7 @@ libinput_la_SOURCES = \ evdev-mt-touchpad-tap.c \ evdev-mt-touchpad-buttons.c \ evdev-mt-touchpad-edge-scroll.c \ + evdev-mt-touchpad-gestures.c\ filter.c\ filter.h\ filter-private.h\ diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index 9dbb513..12f8023 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -156,7 +156,6 @@ tp_button_set_state(struct tp_dispatch *tp, struct tp_touch *t, break; case BUTTON_STATE_AREA: t-button.curr = BUTTON_EVENT_IN_AREA; - tp_set_pointer(tp, t); break; case BUTTON_STATE_BOTTOM: t-button.curr = event; diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c index df181d5..28f29c2 100644 --- a/src/evdev-mt-touchpad-edge-scroll.c +++ b/src/evdev-mt-touchpad-edge-scroll.c @@ -86,7 +86,6 @@ tp_edge_scroll_set_state(struct tp_dispatch *tp, break; case EDGE_SCROLL_TOUCH_STATE_AREA: t-scroll.edge = EDGE_NONE; - tp_set_pointer(tp, t); break; } } diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c new file mode 100644 index 000..28ac74b --- /dev/null +++ b/src/evdev-mt-touchpad-gestures.c @@ -0,0 +1,146 @@ +/* + * Copyright © 2015 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include config.h + +#include assert.h +#include math.h +#include stdbool.h +#include limits.h + +#include evdev-mt-touchpad.h + +#define DEFAULT_GESTURE_SWITCH_TIMEOUT 100 /* ms */ + +void +tp_gesture_start(struct tp_dispatch *tp, uint64_t time) +{ + if (tp-gesture.started) + return; + + switch (tp-gesture.finger_mode) { + case 2: + /* NOP */ + break; + } + tp-gesture.started = true; +} + +void +tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) +{ + if (tp-gesture.finger_mode == 0) + return; + + /* When tap-and-dragging, or a clickpad
[PATCH libinput 08/11] touchpad: Move gesture handling code to evdev-mt-touchpad-gestures.c
Just moving some code around, no functional changes. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev-mt-touchpad-gestures.c | 94 +++- src/evdev-mt-touchpad.c | 92 --- src/evdev-mt-touchpad.h | 9 3 files changed, 93 insertions(+), 102 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 28ac74b..250974f 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -31,7 +31,53 @@ #define DEFAULT_GESTURE_SWITCH_TIMEOUT 100 /* ms */ -void +static void +tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) +{ + struct tp_touch *t; + int nchanged = 0; + double tmpx, tmpy; + + *dx = 0.0; + *dy = 0.0; + + tp_for_each_touch(tp, t) { + if (tp_touch_active(tp, t) t-dirty) { + nchanged++; + tp_get_delta(t, tmpx, tmpy); + + *dx += tmpx; + *dy += tmpy; + } + } + + if (nchanged == 0) + return; + + *dx /= nchanged; + *dy /= nchanged; +} + +static void +tp_get_combined_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) +{ + struct tp_touch *t; + double tdx, tdy; + unsigned int i; + + for (i = 0; i tp-real_touches; i++) { + t = tp-touches[i]; + + if (!tp_touch_active(tp, t) || !t-dirty) + continue; + + tp_get_delta(t, tdx, tdy); + *dx += tdx; + *dy += tdy; + } +} + +static void tp_gesture_start(struct tp_dispatch *tp, uint64_t time) { if (tp-gesture.started) @@ -45,6 +91,44 @@ tp_gesture_start(struct tp_dispatch *tp, uint64_t time) tp-gesture.started = true; } +static void +tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time) +{ + double dx = 0.0, dy = 0.0; + double dx_unaccel, dy_unaccel; + + /* When a clickpad is clicked, combine motion of all active touches */ + if (tp-buttons.is_clickpad tp-buttons.state) + tp_get_combined_touches_delta(tp, dx, dy); + else + tp_get_average_touches_delta(tp, dx, dy); + + tp_filter_motion(tp, dx, dy, dx_unaccel, dy_unaccel, time); + + if (dx != 0.0 || dy != 0.0 || dx_unaccel != 0.0 || dy_unaccel != 0.0) { + pointer_notify_motion(tp-device-base, time, + dx, dy, dx_unaccel, dy_unaccel); + } +} + +static void +tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) +{ + double dx = 0, dy =0; + + tp_get_average_touches_delta(tp, dx, dy); + tp_filter_motion(tp, dx, dy, NULL, NULL, time); + + if (dx == 0.0 dy == 0.0) + return; + + tp_gesture_start(tp, time); + evdev_post_scroll(tp-device, + time, + LIBINPUT_POINTER_AXIS_SOURCE_FINGER, + dx, dy); +} + void tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) { @@ -73,6 +157,14 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) } void +tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) +{ + evdev_stop_scroll(tp-device, + time, + LIBINPUT_POINTER_AXIS_SOURCE_FINGER); +} + +void tp_gesture_stop(struct tp_dispatch *tp, uint64_t time) { if (!tp-gesture.started) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 947678a..6bcbfcd 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -494,59 +494,6 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) } static void -tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) -{ - struct tp_touch *t; - int nchanged = 0; - double tmpx, tmpy; - - *dx = 0.0; - *dy = 0.0; - - tp_for_each_touch(tp, t) { - if (tp_touch_active(tp, t) t-dirty) { - nchanged++; - tp_get_delta(t, tmpx, tmpy); - - *dx += tmpx; - *dy += tmpy; - } - } - - if (nchanged == 0) - return; - - *dx /= nchanged; - *dy /= nchanged; -} - -void -tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) -{ - double dx = 0, dy =0; - - tp_get_average_touches_delta(tp, dx, dy); - tp_filter_motion(tp, dx, dy, NULL, NULL, time); - - if (dx == 0.0 dy == 0.0) - return; - - tp_gesture_start(tp, time); - evdev_post_scroll(tp-device, - time, - LIBINPUT_POINTER_AXIS_SOURCE_FINGER, - dx, dy); -} - -void
[PATCH libinput 10/11] touchpad: Refactor tp_get_*_touches_delta
The two tp_get_*_touches_delta functions are almost identical, refactor them into one function. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev-mt-touchpad-gestures.c | 29 + 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 8ebdf33..e429efe 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -32,7 +32,7 @@ #define DEFAULT_GESTURE_SWITCH_TIMEOUT 100 /* ms */ static void -tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) +tp_get_touches_delta(struct tp_dispatch *tp, double *dx, double *dy, bool average) { struct tp_touch *t; unsigned int i, nchanged = 0; @@ -53,7 +53,7 @@ tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) } } - if (nchanged == 0) + if (!average || nchanged == 0) return; *dx /= nchanged; @@ -61,25 +61,6 @@ tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) } static void -tp_get_combined_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) -{ - struct tp_touch *t; - double tdx, tdy; - unsigned int i; - - for (i = 0; i tp-real_touches; i++) { - t = tp-touches[i]; - - if (!tp_touch_active(tp, t) || !t-dirty) - continue; - - tp_get_delta(t, tdx, tdy); - *dx += tdx; - *dy += tdy; - } -} - -static void tp_gesture_start(struct tp_dispatch *tp, uint64_t time) { if (tp-gesture.started) @@ -101,9 +82,9 @@ tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time) /* When a clickpad is clicked, combine motion of all active touches */ if (tp-buttons.is_clickpad tp-buttons.state) - tp_get_combined_touches_delta(tp, dx, dy); + tp_get_touches_delta(tp, dx, dy, false); else - tp_get_average_touches_delta(tp, dx, dy); + tp_get_touches_delta(tp, dx, dy, true); tp_filter_motion(tp, dx, dy, dx_unaccel, dy_unaccel, time); @@ -118,7 +99,7 @@ tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) { double dx = 0, dy =0; - tp_get_average_touches_delta(tp, dx, dy); + tp_get_touches_delta(tp, dx, dy, true); tp_filter_motion(tp, dx, dy, NULL, NULL, time); if (dx == 0.0 dy == 0.0) -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 11/11] touchpad: Add support for swipe gestures
Add support for swipe gestures. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev-mt-touchpad-gestures.c | 36 1 file changed, 36 insertions(+) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index e429efe..faf5824 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -25,6 +25,7 @@ #include assert.h #include math.h #include stdbool.h +#include stdio.h #include limits.h #include evdev-mt-touchpad.h @@ -70,6 +71,13 @@ tp_gesture_start(struct tp_dispatch *tp, uint64_t time) case 2: /* NOP */ break; + case 3: + case 4: + gesture_notify_swipe(tp-device-base, time, +LIBINPUT_EVENT_GESTURE_SWIPE_START, +tp-gesture.finger_mode, +0, 0, 0, 0); + break; } tp-gesture.started = true; } @@ -112,6 +120,23 @@ tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) dx, dy); } +static void +tp_gesture_post_swipe(struct tp_dispatch *tp, uint64_t time) +{ + double dx, dy, dx_unaccel, dy_unaccel; + + tp_get_touches_delta(tp, dx, dy, true); + tp_filter_motion(tp, dx, dy, dx_unaccel, dy_unaccel, time); + + if (dx != 0.0 || dy != 0.0 || dx_unaccel != 0.0 || dy_unaccel != 0.0) { + tp_gesture_start(tp, time); + gesture_notify_swipe(tp-device-base, time, +LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, +tp-gesture.finger_mode, +dx, dy, dx_unaccel, dy_unaccel); + } +} + void tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) { @@ -136,6 +161,10 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) case 2: tp_gesture_post_twofinger_scroll(tp, time); break; + case 3: + case 4: + tp_gesture_post_swipe(tp, time); + break; } } @@ -157,6 +186,13 @@ tp_gesture_stop(struct tp_dispatch *tp, uint64_t time) case 2: tp_gesture_stop_twofinger_scroll(tp, time); break; + case 3: + case 4: + gesture_notify_swipe(tp-device-base, time, +LIBINPUT_EVENT_GESTURE_SWIPE_END, +tp-gesture.finger_mode, +0, 0, 0, 0); + break; } tp-gesture.started = false; } -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 09/11] touchpad: Do not use fake touches when getting the average touches delta
Only look at real touches when getting the average touches delta, otherwise the touch used to populate the fake touches gets an unfair weighing factor. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev-mt-touchpad-gestures.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 250974f..8ebdf33 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -35,13 +35,15 @@ static void tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) { struct tp_touch *t; - int nchanged = 0; + unsigned int i, nchanged = 0; double tmpx, tmpy; *dx = 0.0; *dy = 0.0; - tp_for_each_touch(tp, t) { + for (i = 0; i tp-real_touches; i++) { + t = tp-touches[i]; + if (tp_touch_active(tp, t) t-dirty) { nchanged++; tp_get_delta(t, tmpx, tmpy); -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 05/11] touchpad: Also stop edge scrolling when the trackpoint becomes active
Not only stop 2fg scrolling, but also edge scrolling when the trackpoint becomes active. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev-mt-touchpad.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index a6de661..a4c3fb9 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -970,9 +970,8 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data) return; if (!tp-sendevents.trackpoint_active) { - evdev_stop_scroll(tp-device, - time, - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); + tp_edge_scroll_stop_events(tp, time); + tp_twofinger_stop_scroll(tp, time); tp_tap_suspend(tp, time); tp-sendevents.trackpoint_active = true; } -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 02/11] Add a gesture capability flag
Add a new LIBINPUT_DEVICE_CAP_GESTURE device capability, Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev.c | 3 +++ src/evdev.h | 3 ++- src/libinput.h | 3 ++- tools/event-debug.c | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 525d5d7..9a1ea13 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1487,6 +1487,7 @@ evdev_configure_device(struct evdev_device *device) if (udev_tags EVDEV_UDEV_TAG_TOUCHPAD) { device-dispatch = evdev_mt_touchpad_create(device); + device-seat_caps |= EVDEV_DEVICE_GESTURE; log_info(libinput, input device '%s', %s is a touchpad\n, device-devname, devnode); @@ -1801,6 +1802,8 @@ evdev_device_has_capability(struct evdev_device *device, return !!(device-seat_caps EVDEV_DEVICE_KEYBOARD); case LIBINPUT_DEVICE_CAP_TOUCH: return !!(device-seat_caps EVDEV_DEVICE_TOUCH); + case LIBINPUT_DEVICE_CAP_GESTURE: + return !!(device-seat_caps EVDEV_DEVICE_GESTURE); default: return 0; } diff --git a/src/evdev.h b/src/evdev.h index fc70a28..845cd29 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -47,7 +47,8 @@ enum evdev_event_type { enum evdev_device_seat_capability { EVDEV_DEVICE_POINTER = (1 0), EVDEV_DEVICE_KEYBOARD = (1 1), - EVDEV_DEVICE_TOUCH = (1 2) + EVDEV_DEVICE_TOUCH = (1 2), + EVDEV_DEVICE_GESTURE = (1 3), }; enum evdev_device_tags { diff --git a/src/libinput.h b/src/libinput.h index c0112c2..cf4511d 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -54,7 +54,8 @@ enum libinput_log_priority { enum libinput_device_capability { LIBINPUT_DEVICE_CAP_KEYBOARD = 0, LIBINPUT_DEVICE_CAP_POINTER = 1, - LIBINPUT_DEVICE_CAP_TOUCH = 2 + LIBINPUT_DEVICE_CAP_TOUCH = 2, + LIBINPUT_DEVICE_CAP_GESTURE = 3, }; /** diff --git a/tools/event-debug.c b/tools/event-debug.c index 297e47d..055f3cc 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -140,6 +140,9 @@ print_device_notify(struct libinput_event *ev) if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH)) printf(t); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_GESTURE)) + printf(g); if (libinput_device_get_size(dev, w, h) == 0) printf(\tsize %.2f/%.2fmm, w, h); -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 06/11] touchpad: Add tp_get_average_touches_delta helper function
Add a tp_get_average_touches_delta helper function, and rename tp_get_active_touches_delta to tp_get_combined_touches_delta to better differentiate the two. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev-mt-touchpad.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index a4c3fb9..c6c48d3 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -513,20 +513,22 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) } static void -tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) +tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) { struct tp_touch *t; int nchanged = 0; - double dx = 0, dy =0; double tmpx, tmpy; + *dx = 0.0; + *dy = 0.0; + tp_for_each_touch(tp, t) { if (tp_touch_active(tp, t) t-dirty) { nchanged++; tp_get_delta(t, tmpx, tmpy); - dx += tmpx; - dy += tmpy; + *dx += tmpx; + *dy += tmpy; } /* Stop spurious MOTION events at the end of scrolling */ t-is_pointer = false; @@ -535,9 +537,16 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) if (nchanged == 0) return; - dx /= nchanged; - dy /= nchanged; + *dx /= nchanged; + *dy /= nchanged; +} + +static void +tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) +{ + double dx = 0, dy =0; + tp_get_average_touches_delta(tp, dx, dy); tp_filter_motion(tp, dx, dy, NULL, NULL, time); evdev_post_scroll(tp-device, @@ -758,7 +767,7 @@ tp_get_pointer_delta(struct tp_dispatch *tp, double *dx, double *dy) } static void -tp_get_active_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) +tp_get_combined_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) { struct tp_touch *t; double tdx, tdy; @@ -784,7 +793,7 @@ tp_post_pointer_motion(struct tp_dispatch *tp, uint64_t time) /* When a clickpad is clicked, combine motion of all active touches */ if (tp-buttons.is_clickpad tp-buttons.state) - tp_get_active_touches_delta(tp, dx, dy); + tp_get_combined_touches_delta(tp, dx, dy); else tp_get_pointer_delta(tp, dx, dy); -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 01/11] Add an API for touchpad gesture events
For touchscreens we always send raw touch events to the compositor, and the compositor or application toolkits do gesture recognition. This makes sense because on a touchscreen which window / widget the touches are over is important context to know to interpret gestures. On touchpads however we never send raw events since a touchpad is an absolute device which primary function is to send pointer motion delta-s, so we always need to do processing (and a lot of it) on the raw events. Moreover there is nothing underneath the finger which influences how to interpret gestures, and there is a lot of touchpad and libinput configuration specific context necessary for gesture recognition. E.g. is this a clickpad, and if so are softbuttons or clickfinger used? What is the size of the softbuttons? Is this a true multi-touch touchpad or a semi multi-touch touchpad which only gives us a bounding box enclosing the fingers? Etc. So for touchpads it is better to do gesture processing in libinput, this commit adds an initial implementation of a Gesture event API which only supports swipe gestures, other gestures will be added later following the same model wrt, having clear start and stop events and the number of fingers involved being fixed once a gesture sequence starts. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/libinput-private.h | 10 src/libinput.c | 129 +++ src/libinput.h | 146 - src/libinput.sym | 8 +++ test/litest.c | 9 +++ 5 files changed, 301 insertions(+), 1 deletion(-) diff --git a/src/libinput-private.h b/src/libinput-private.h index 23f66e4..d0bd7f0 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -330,6 +330,16 @@ touch_notify_touch_up(struct libinput_device *device, int32_t seat_slot); void +gesture_notify_swipe(struct libinput_device *device, +uint64_t time, +enum libinput_event_type type, +int finger_count, +double dx, +double dy, +double dx_unaccel, +double dy_unaccel); + +void touch_notify_frame(struct libinput_device *device, uint64_t time); diff --git a/src/libinput.c b/src/libinput.c index 81862d5..220bb1d 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -79,6 +79,16 @@ struct libinput_event_touch { double y; }; +struct libinput_event_gesture { + struct libinput_event base; + uint32_t time; + int finger_count; + double dx; + double dy; + double dx_unaccel; + double dy_unaccel; +}; + static void libinput_default_log_func(struct libinput *libinput, enum libinput_log_priority priority, @@ -183,6 +193,10 @@ libinput_event_get_pointer_event(struct libinput_event *event) case LIBINPUT_EVENT_TOUCH_CANCEL: case LIBINPUT_EVENT_TOUCH_FRAME: break; + case LIBINPUT_EVENT_GESTURE_SWIPE_START: + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + break; } return NULL; @@ -209,6 +223,10 @@ libinput_event_get_keyboard_event(struct libinput_event *event) case LIBINPUT_EVENT_TOUCH_CANCEL: case LIBINPUT_EVENT_TOUCH_FRAME: break; + case LIBINPUT_EVENT_GESTURE_SWIPE_START: + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + break; } return NULL; @@ -234,6 +252,40 @@ libinput_event_get_touch_event(struct libinput_event *event) case LIBINPUT_EVENT_TOUCH_CANCEL: case LIBINPUT_EVENT_TOUCH_FRAME: return (struct libinput_event_touch *) event; + case LIBINPUT_EVENT_GESTURE_SWIPE_START: + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + break; + } + + return NULL; +} + +LIBINPUT_EXPORT struct libinput_event_gesture * +libinput_event_get_gesture_event(struct libinput_event *event) +{ + switch (event-type) { + case LIBINPUT_EVENT_NONE: + abort(); /* not used as actual event type */ + case LIBINPUT_EVENT_DEVICE_ADDED: + case LIBINPUT_EVENT_DEVICE_REMOVED: + case LIBINPUT_EVENT_KEYBOARD_KEY: + break; + case LIBINPUT_EVENT_POINTER_MOTION: + case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: + case LIBINPUT_EVENT_POINTER_BUTTON: + case LIBINPUT_EVENT_POINTER_AXIS: + break; + case LIBINPUT_EVENT_TOUCH_DOWN: + case LIBINPUT_EVENT_TOUCH_UP: + case LIBINPUT_EVENT_TOUCH_MOTION: + case LIBINPUT_EVENT_TOUCH_CANCEL: + case LIBINPUT_EVENT_TOUCH_FRAME: + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_START: + case
[PATCH libinput 00/11] Add touchpad gesture support
Hi All, Here is a series actually implementing the touchpad gesture support API I've been proposing. The 1st patch is unchanged from its last posting other then fixing a single type. This series only adds swipe support. I've a bunch of backlight, uas and misc. other bugs which I need to look into Thursday and Friday. I plan to start working on zoom/rotate support next week. Regards, Hans ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH libinput 04/11] touchpad: Change how we deal with scroll methods
With the upcoming gesture support 2fg scrolling will be handled as part of the main gesture state machine, where as edge scrolling has its own state machine, our current way of dispatching scroll actions does not play well with this. Change the scroll method handling to treat edge and 2fg scrolling as 2 separate state machines. The double scroll calls this introduces will mostly be removed when the gesture handling code lands. Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev-mt-touchpad-edge-scroll.c | 3 ++ src/evdev-mt-touchpad.c | 73 +++-- 2 files changed, 17 insertions(+), 59 deletions(-) diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c index 8d0a13e..df181d5 100644 --- a/src/evdev-mt-touchpad-edge-scroll.c +++ b/src/evdev-mt-touchpad-edge-scroll.c @@ -317,6 +317,9 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) enum libinput_pointer_axis axis; double dx, dy, *delta; + if (tp-scroll.method != LIBINPUT_CONFIG_SCROLL_EDGE) + return 0; + tp_for_each_touch(tp, t) { if (!t-dirty) continue; diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index ae37ab1..a6de661 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -581,6 +581,9 @@ tp_twofinger_scroll_post_events(struct tp_dispatch *tp, uint64_t time) struct tp_touch *t; int nfingers_down = 0; + if (tp-scroll.method != LIBINPUT_CONFIG_SCROLL_2FG) + return 0; + /* No 2fg scrolling during tap-n-drag */ if (tp_tap_dragging(tp)) return 0; @@ -606,60 +609,6 @@ tp_twofinger_scroll_post_events(struct tp_dispatch *tp, uint64_t time) } static void -tp_scroll_handle_state(struct tp_dispatch *tp, uint64_t time) -{ - /* Note this must be always called, so that it knows the state of -* touches when the scroll-mode changes. -*/ - tp_edge_scroll_handle_state(tp, time); -} - -static int -tp_post_scroll_events(struct tp_dispatch *tp, uint64_t time) -{ - struct libinput *libinput = tp-device-base.seat-libinput; - - switch (tp-scroll.method) { - case LIBINPUT_CONFIG_SCROLL_NO_SCROLL: - break; - case LIBINPUT_CONFIG_SCROLL_2FG: - return tp_twofinger_scroll_post_events(tp, time); - case LIBINPUT_CONFIG_SCROLL_EDGE: - return tp_edge_scroll_post_events(tp, time); - case LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN: - log_bug_libinput(libinput, Unexpected scroll mode\n); - break; - } - return 0; -} - -static void -tp_stop_scroll_events(struct tp_dispatch *tp, uint64_t time) -{ - struct libinput *libinput = tp-device-base.seat-libinput; - - switch (tp-scroll.method) { - case LIBINPUT_CONFIG_SCROLL_NO_SCROLL: - break; - case LIBINPUT_CONFIG_SCROLL_2FG: - tp_twofinger_stop_scroll(tp, time); - break; - case LIBINPUT_CONFIG_SCROLL_EDGE: - tp_edge_scroll_stop_events(tp, time); - break; - case LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN: - log_bug_libinput(libinput, Unexpected scroll mode\n); - break; - } -} - -static void -tp_remove_scroll(struct tp_dispatch *tp) -{ - tp_remove_edge_scroll(tp); -} - -static void tp_unhover_touches(struct tp_dispatch *tp, uint64_t time) { struct tp_touch *t; @@ -749,7 +698,7 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time) } tp_button_handle_state(tp, time); - tp_scroll_handle_state(tp, time); + tp_edge_scroll_handle_state(tp, time); /* * We have a physical button down event on a clickpad. To avoid @@ -862,11 +811,14 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) filter_motion |= tp_post_button_events(tp, time); if (filter_motion || tp-sendevents.trackpoint_active) { - tp_stop_scroll_events(tp, time); + tp_edge_scroll_stop_events(tp, time); + tp_twofinger_stop_scroll(tp, time); return; } - if (tp_post_scroll_events(tp, time) != 0) + if (tp_edge_scroll_post_events(tp, time) != 0) + return; + if (tp_twofinger_scroll_post_events(tp, time) != 0) return; tp_post_pointer_motion(tp, time); @@ -925,7 +877,7 @@ tp_remove(struct evdev_dispatch *dispatch) tp_remove_tap(tp); tp_remove_buttons(tp); tp_remove_sendevents(tp); - tp_remove_scroll(tp); + tp_remove_edge_scroll(tp); } static void @@ -1255,11 +1207,14 @@ tp_scroll_config_scroll_method_set_method(struct libinput_device *device, { struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev-dispatch; +
[PATCH libinput 03/11] event-debug: Add support for gesture events
Add support for gesture events to the event-debug tool. Signed-off-by: Hans de Goede hdego...@redhat.com --- tools/event-debug.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/tools/event-debug.c b/tools/event-debug.c index 055f3cc..d76c127 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -106,6 +106,15 @@ print_event_header(struct libinput_event *ev) case LIBINPUT_EVENT_TOUCH_FRAME: type = TOUCH_FRAME; break; + case LIBINPUT_EVENT_GESTURE_SWIPE_START: + type = GESTURE_SWIPE_START; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + type = GESTURE_SWIPE_UPDATE; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + type = GESTURE_SWIPE_END; + break; } printf(%-7s%s , libinput_device_get_sysname(dev), type); @@ -269,6 +278,31 @@ print_touch_event_with_coords(struct libinput_event *ev) xmm, ymm); } +static void +print_gesture_event_without_coords(struct libinput_event *ev) +{ + struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev); + + print_event_time(libinput_event_gesture_get_time(t)); + printf(%d\n, libinput_event_gesture_get_finger_count(t)); +} + +static void +print_gesture_event_with_coords(struct libinput_event *ev) +{ + struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev); + double dx = libinput_event_gesture_get_dx(t); + double dy = libinput_event_gesture_get_dy(t); + double dx_unaccel = libinput_event_gesture_get_dx_unaccelerated(t); + double dy_unaccel = libinput_event_gesture_get_dy_unaccelerated(t); + + print_event_time(libinput_event_gesture_get_time(t)); + + printf(%d %5.2f/%5.2f (%5.2f/%5.2f unaccelerated)\n, + libinput_event_gesture_get_finger_count(t), + dx, dy, dx_unaccel, dy_unaccel); +} + static int handle_and_print_events(struct libinput *li) { @@ -318,6 +352,15 @@ handle_and_print_events(struct libinput *li) case LIBINPUT_EVENT_TOUCH_FRAME: print_touch_event_without_coords(ev); break; + case LIBINPUT_EVENT_GESTURE_SWIPE_START: + print_gesture_event_without_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + print_gesture_event_with_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + print_gesture_event_without_coords(ev); + break; } libinput_event_destroy(ev); -- 2.1.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput 00/15] tablet: support the remaining tools
Hi Peter, On Wed, Feb 18, 2015 at 12:45 AM, Peter Hutterer peter.hutte...@who-t.net wrote: This patchset adds the remaining tools to the tablet branch (at least for Wacom tools). The notable additions are: * rotation support for mouse/lens cursor * rotation support for the artpen * 'wheel' support for the airbrush * correct per-tool capabilities (including buttons) If you have one of those tools handy, give it a test, most of this was lifted from memory, specs and code I had written in the past - not with an actual physical device at hand. Branch is available for testing here: https://github.com/whot/libinput/tree/wip/wacom-extra-tool-support Thanks for this work. I gave a quick test with the devices I currently have at home: - mouse support: * rotation works just fine * buttons are not handled (silently ignored) * wheel events raise a EV_REL not supported - general pen: * so far, so good - airbrush: * ditto, so far so good - artpen: * don't have it at home, will test it tomorrow at the office This was for the pro-level Wacom (Intuos Pro and Intuos 4 BT). For the general consumer line (Bamboo, Bamboo PAD and Huion H610 Pro), everything works as expected except that event_debug always prints the tilt_x/y information even if the tool does not support it. The tool capability debug shows however if the device has the tilt support or not, so it's just an event_debug bug. I'll go further in the review now that the preliminary tests have been made. Cheers, Benjamin ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [RFC libinput 1/2] Add a buttonset interface for button-only devices
Hey :), On Mon, Feb 16, 2015 at 4:50 AM, Peter Hutterer peter.hutte...@who-t.net wrote: ok, I've played around with the ideas in this thread and discussed it with Benjamin this morning. Short summary: I think we should go with the original patch, with an optional extension for numbered axes later. I tried the enum spacing first, providing an API where we have LIBINPUT_BUTTONSET_AXIS_TYPE_COUNT = 512 LIBINPUT_BUTTONSET_AXIS_RING = 512 LIBINPUT_BUTTONSET_AXIS_STRIP = 1024 so the caller can use code like libinput_event_buttonset_get_axis_value(event, LIBINPUT_BUTTONSET_AXIS_RING + 2); to get the third axis. switching event-debug showed the issues with this approach: to effectively go through the axes, the client needs two loops, one for the type one for the number and mask the enum into a type and a number component, something that's prone to bugs. Next attempt was to split value and axis number explicitly in the API: libinput_event_buttonset_get_axis_value(event, LIBINPUT_BUTTONSET_AXIS_RING, 2); Better than the above as it's less error-prone. It still doesn't remove the above issue though, nested loops everywhere to access the type and the number. event-debug is a special case in that it doesn't care about the content and cares more about listing/printing everything. However I suspect that any generic toolkit will require the same. [Internally both changes are a bit of a nightmare as both would require some rewriting, but that's solveable] So the question is now: what does this gain us? better handling of truly generic devices with random axes. Which leads into the next question: what are random axes? The above approach is over-engineered because there's a group of axes that only exists once. I don't think there's a device with two X axes on the same device for example. Likewise, there are axes that have more use being semantically labelled than just numbered. The ring axes are a good example, the current RING and RING2 naming is bad, we should name it RING_LEFT, RING_RIGHT instead. I'm not sure left/right specifically is something we want to tell about at this level. With tablet support in mind, I would expect a left-handed mode for buttonsets too, so rings/strips would flip side, be inverted, etc. We can sure flip the axes internally in libinput, but sounds inconsistent if buttons aren't to be actually flipped. As for this semantical approach, are we sure the input_event codes won't overlap across different devices that might qualify here? It could be potentially confusing otherwise. TBH I share a bit the concern with Jason here, most probably all apps dealing with this will want their own dialogs and methods to map actions anyway. Cheers, Carlos ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput v2 8/8] tablet: Add tests for axes on proximity events
On Wed, Feb 18, 2015 at 01:43:21AM -0500, Stephen Chandler Paul wrote: --- test/tablet.c | 134 ++ 1 file changed, 134 insertions(+) merged, thanks Cheers, Peter Changes - Check that the axes are still present on the proximity out events, and make sure that they haven't changed - Don't use a loop when we're only expecting one event - Make use of litest_assert_empty_queue() diff --git a/test/tablet.c b/test/tablet.c index 8074e4e..2975541 100644 --- a/test/tablet.c +++ b/test/tablet.c @@ -154,6 +154,139 @@ START_TEST(proximity_out_clear_buttons) } END_TEST +START_TEST(proximity_has_axes) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev-libinput; + struct libinput_event_tablet *tablet_event; + struct libinput_event *event; + struct libinput_tool *tool; + double x, y, +distance; + + struct axis_replacement axes[] = { + { ABS_DISTANCE, 10 }, + { ABS_TILT_X, 10 }, + { ABS_TILT_Y, 10 }, + { -1, -1} + }; + + litest_drain_events(dev-libinput); + + litest_tablet_proximity_in(dev, 10, 10, axes); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_PROXIMITY, -1); + + event = libinput_get_event(li); + + tablet_event = libinput_event_get_tablet_event(event); + tool = libinput_event_tablet_get_tool(tablet_event); + + ck_assert(libinput_event_tablet_axis_has_changed( + tablet_event, LIBINPUT_TABLET_AXIS_X)); + ck_assert(libinput_event_tablet_axis_has_changed( + tablet_event, LIBINPUT_TABLET_AXIS_Y)); + + x = libinput_event_tablet_get_axis_value(tablet_event, + LIBINPUT_TABLET_AXIS_X); + y = libinput_event_tablet_get_axis_value(tablet_event, + LIBINPUT_TABLET_AXIS_Y); + + litest_assert_double_ne(x, 0); + litest_assert_double_ne(y, 0); + + if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_DISTANCE)) { + ck_assert(libinput_event_tablet_axis_has_changed( + tablet_event, + LIBINPUT_TABLET_AXIS_DISTANCE)); + + distance = libinput_event_tablet_get_axis_value( + tablet_event, + LIBINPUT_TABLET_AXIS_DISTANCE); + litest_assert_double_ne(distance, 0); + } + + if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_TILT_X) + libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_TILT_Y)) { + ck_assert(libinput_event_tablet_axis_has_changed( + tablet_event, + LIBINPUT_TABLET_AXIS_TILT_X)); + ck_assert(libinput_event_tablet_axis_has_changed( + tablet_event, + LIBINPUT_TABLET_AXIS_TILT_Y)); + + x = libinput_event_tablet_get_axis_value( + tablet_event, + LIBINPUT_TABLET_AXIS_TILT_X); + y = libinput_event_tablet_get_axis_value( + tablet_event, + LIBINPUT_TABLET_AXIS_TILT_Y); + + litest_assert_double_ne(x, 0); + litest_assert_double_ne(y, 0); + } + + litest_assert_empty_queue(li); + libinput_event_destroy(event); + + /* Make sure that the axes are still present on proximity out */ + litest_tablet_proximity_out(dev); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_PROXIMITY, -1); + event = libinput_get_event(li); + + tablet_event = libinput_event_get_tablet_event(event); + tool = libinput_event_tablet_get_tool(tablet_event); + + ck_assert(!libinput_event_tablet_axis_has_changed( + tablet_event, LIBINPUT_TABLET_AXIS_X)); + ck_assert(!libinput_event_tablet_axis_has_changed( + tablet_event, LIBINPUT_TABLET_AXIS_Y)); + + x = libinput_event_tablet_get_axis_value(tablet_event, + LIBINPUT_TABLET_AXIS_X); + y = libinput_event_tablet_get_axis_value(tablet_event, + LIBINPUT_TABLET_AXIS_Y); + + litest_assert_double_ne(x, 0); + litest_assert_double_ne(y, 0); + + if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_DISTANCE)) { + ck_assert(!libinput_event_tablet_axis_has_changed( + tablet_event, + LIBINPUT_TABLET_AXIS_DISTANCE)); + + distance = libinput_event_tablet_get_axis_value( + tablet_event, + LIBINPUT_TABLET_AXIS_DISTANCE); + litest_assert_double_ne(distance, 0); +
Weston 1.7 memleaks
Just checking mem leaks. Is this normal or are we shooting for zero leaks? [21:32:52.432] weston 1.7.0 http://wayland.freedesktop.org Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Waylandcomponent=westonversion=1.7.0 Build: 1.6.93-9-gdbd8606 configure.ac: bump to version 1.7.0 for release (2015-02-13 20:47:09 -0800) [21:32:52.484] OS: Linux, 3.18.6-1-ARCH, #1 SMP PREEMPT Sat Feb 7 08:44:05 CET 2015, x86_64 [21:32:52.495] Starting with no config file. [21:32:52.508] Loading module '/usr/lib/weston/x11-backend.so' [21:32:52.621] initializing x11 backend [21:32:52.722] Loading module '/usr/lib/weston/gl-renderer.so' [21:32:53.301] warning: EGL_EXT_buffer_age not supported. Performance could be affected. [21:32:53.301] warning: EGL_EXT_swap_buffers_with_damage not supported. Performance could be affected. [21:32:53.302] Using gl renderer [21:32:53.304] launching '/usr/lib/weston/weston-keyboard' [21:32:53.939] EGL version: 1.4 (DRI2) [21:32:53.939] EGL vendor: Mesa Project [21:32:53.940] EGL client APIs: OpenGL OpenGL_ES OpenGL_ES2 OpenGL_ES3 [21:32:53.940] EGL extensions: EGL_MESA_drm_image EGL_MESA_configless_context EGL_WL_bind_wayland_display EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_surfaceless_context EGL_KHR_create_context EGL_NOK_swap_region EGL_NOK_texture_from_pixmap EGL_CHROMIUM_sync_control EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import EGL_NV_post_sub_buffer [21:32:53.943] GL version: OpenGL ES 3.0 Mesa 10.4.4 [21:32:53.943] GLSL version: OpenGL ES GLSL ES 3.0 [21:32:53.943] GL vendor: Intel Open Source Technology Center [21:32:53.946] GL renderer: Mesa DRI Intel(R) Haswell Mobile [21:32:53.946] GL extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_filter_anisotropic GL_EXT_texture_compression_dxt1 GL_EXT_texture_format_BGRA GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_npot GL_OES_EGL_image GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_type_2_10_10_10_REV GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_vertex_array_object GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_EXT_texture_rg GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_EXT_map_buffer_range GL_OES_depth_texture_cube_map GL_OES_surfaceless_context GL_EXT_color_buffer_float GL_EXT_separate_shader_objects GL_EXT_shader_integer_mix GL_KHR_context_flush_control [21:32:53.948] GL ES 2 renderer features: read-back format: BGRA wl_shm sub-image to texture: yes EGL Wayland extension: yes [21:32:53.949] Chosen EGL config details: RGBA bits: 8 8 8 8 swap interval range: 0 - 1000 [21:32:53.952] x11 output 1024x640, window id 62914565 [21:32:53.954] Compositor capabilities: arbitrary surface rotation: yes screen capture uses y-flip: yes presentation clock: CLOCK_MONOTONIC_RAW, id 4 [21:32:53.963] Loading module '/usr/lib/weston/desktop-shell.so' [21:32:55.718] launching '/usr/lib/weston/weston-desktop-shell' ==16517== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) ==16517==at 0x5D41330: __sendmsg_nocancel (in /usr/lib/libc-2.21.so) ==16517==by 0x4E3F780: ??? (in /usr/lib/libwayland-server.so.0.1.0) ==16517==by 0x4E3D92E: wl_display_flush_clients (in /usr/lib/libwayland-server.so.0.1.0) ==16517==by 0x4E3D987: wl_display_run (in /usr/lib/libwayland-server.so.0.1.0) ==16517==by 0x4086FA: ??? (in /usr/bin/weston) ==16517==by 0x5C787FF: (below main) (in /usr/lib/libc-2.21.so) ==16517== Address 0xeacd996 is 4,134 bytes inside a block of size 16,424 alloc'd ==16517==at 0x4C29F90: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16517==by 0x4E3F8B1: ??? (in /usr/lib/libwayland-server.so.0.1.0) ==16517==by 0x4E3DD12: wl_client_create (in /usr/lib/libwayland-server.so.0.1.0) ==16517==by 0x40AA40: weston_client_launch (in /usr/bin/weston) ==16517==by 0x417C54: ??? (in /usr/bin/weston) ==16517==by 0x413F53: weston_seat_init (in /usr/bin/weston) ==16517==by 0x6C56F8D: backend_init (in
Re: [RFC libinput 1/2] Add a buttonset interface for button-only devices
On Wed, Feb 18, 2015 at 01:57:17PM -0800, Jason Gerecke wrote: On 2/16/2015 9:11 PM, Peter Hutterer wrote: On Mon, Feb 16, 2015 at 08:13:01AM +0100, Hans de Goede wrote: Hi, On 16-02-15 04:50, Peter Hutterer wrote: snip ok, I've played around with the ideas in this thread and discussed it with Benjamin this morning. Short summary: I think we should go with the original patch, with an optional extension for numbered axes later. I tried the enum spacing first, providing an API where we have LIBINPUT_BUTTONSET_AXIS_TYPE_COUNT = 512 LIBINPUT_BUTTONSET_AXIS_RING = 512 LIBINPUT_BUTTONSET_AXIS_STRIP = 1024 so the caller can use code like libinput_event_buttonset_get_axis_value(event, LIBINPUT_BUTTONSET_AXIS_RING + 2); to get the third axis. switching event-debug showed the issues with this approach: to effectively go through the axes, the client needs two loops, one for the type one for the number and mask the enum into a type and a number component, something that's prone to bugs. Next attempt was to split value and axis number explicitly in the API: libinput_event_buttonset_get_axis_value(event, LIBINPUT_BUTTONSET_AXIS_RING, 2); Better than the above as it's less error-prone. It still doesn't remove the above issue though, nested loops everywhere to access the type and the number. event-debug is a special case in that it doesn't care about the content and cares more about listing/printing everything. However I suspect that any generic toolkit will require the same. [Internally both changes are a bit of a nightmare as both would require some rewriting, but that's solveable] So the question is now: what does this gain us? better handling of truly generic devices with random axes. Which leads into the next question: what are random axes? The above approach is over-engineered because there's a group of axes that only exists once. I don't think there's a device with two X axes on the same device for example. Likewise, there are axes that have more use being semantically labelled than just numbered. The ring axes are a good example, the current RING and RING2 naming is bad, we should name it RING_LEFT, RING_RIGHT instead. Other than say a mix table we'll likely find semantic naming for a majority of the device. For the other devices, we can use a hybrid approach: leave the current API to use enums but in the future, when we require more flexible axes or devices with multiple identical axes we can add calls like: libinput_device_buttonset_has_axis_by_offset(event, axis_number); libinput_device_buttonset_get_axis_type_by_offset(event, axis_number); libinput_event_buttonset_get_axis_value_by_offset(event, axis_number); etc. this would require a duplication of the buttonset API with a by_offset prefix but is otherwise straightforward and leaves the most expressive API as the default one. We also discussed making an axis an object (struct libinput_buttonset_axis) and providing a get_axis(enum) and a get_axis_by_offset(number) call. That object could've then be used in the API. I don't think it's a good idea to do this, it adds complexity (ref, unref, userdata) and effectively reduces the API to magic numbers/variable names again. so long story short, I think we should go with the enum after all and leave numbered/offset axes for the future when we need it. And I do still believe we need an UNKNOWN axis, at XDC we were talking about these button boxes people could buy to use with midi-apps, which were just a bunch of dials, I don't want to do a database of those, so for such a device we should just end up saying this is a buttonbox with UNKNOWN axis, which when absolute must be used with get_transformed only, and the deltas are in an unknown unit, but we can cross that bridge when we get there. once the axis is labelled once, it effectively becomes ABI. if we label something as unknown and then fix it in a later version of libinput we will break things. so we should hide anything we don't know enough about. Nothing stops us from adding a LINEAR_ACTUATOR, MIDI_DIAL, etc. though. Hmm, I still have the feeling the end result is going to be way less generic then what we had in mind when we introduced the buttonset concept, it seems that you're more solving the tablet buttons problem here then introducing a general buttonset API. But if you and Benjamin believe that this is the right way forward lets go with this, we can always extend the API later. yeah, tbh the tablet case is the most obvious for now, it's likely to be the prime use-case for this interface. A truly generic interface with just numbered axes is IMO a lot easier to tack on top than the other way round. Cheers, Peter I'm also