platform/upstream/libinput.git
9 years agodoc: specify the IMAGE_PATH relative to the source
Peter Hutterer [Thu, 15 Jan 2015 01:43:04 +0000 (11:43 +1000)]
doc: specify the IMAGE_PATH relative to the source

Fixes doxygen build with custom builddirs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add some missing files to EXTRA_DIST
Peter Hutterer [Thu, 15 Jan 2015 00:49:56 +0000 (10:49 +1000)]
doc: add some missing files to EXTRA_DIST

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoRename functions for left handed device configurations
Stephen Chandler Paul [Wed, 7 Jan 2015 02:20:22 +0000 (21:20 -0500)]
Rename functions for left handed device configurations

Some devices require more than just flipping around the buttons, such as
tablets.
When it comes to devices like tablets, because the position of the palm rest is
on the right, the entire tablet has to be flipped around in order to be usable
by lefties. As such, this requires that we reverse the coordinates of the
tablets in addition to flipping the buttons on the tablet. As such, renaming
these functions so that they aren't specific to devices where only the buttons
are flipped seems appropriate.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMerge branch 'merged-scroll-events'
Peter Hutterer [Wed, 14 Jan 2015 23:48:29 +0000 (09:48 +1000)]
Merge branch 'merged-scroll-events'

This is merged on top of the wheel normalization patches. Those introduced an
axis source and an extra "discrete" value to the various internal and external
APIs. This branch changed from a single value to passing dx/dy into all scroll
events.

The conflicts are to change everything to take x, y, x_discrete, y_discrete as
values (and the source axis mask of course).

Conflicts:
src/evdev-mt-touchpad-edge-scroll.c
src/evdev.c
src/libinput-private.h
src/libinput.c

9 years agoAdd libinput_event_pointer_get_axis_value_discrete() to count wheel clicks
Peter Hutterer [Tue, 13 Jan 2015 05:15:02 +0000 (15:15 +1000)]
Add libinput_event_pointer_get_axis_value_discrete() to count wheel clicks

The recent normalization of wheel events means we get the angle in degrees but
we don't know how this corresponds to clicks. The M325 has a 20 degree click
angle, most other mice have 15 degrees. So an angle of 60 can be 3 or 4 click
events.

Most clients care more about the click count than the angle on a mouse wheel.
Provide that value when needed.

Adding a discrete value to the axis event leaves the possibility of defining
discrete units for finger/continuous scroll sources in the future. Right now,
these will always reuturn 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoChange axis events to carry all directions
Peter Hutterer [Wed, 24 Dec 2014 01:10:04 +0000 (11:10 +1000)]
Change axis events to carry all directions

Sending separate axis events instead of one unified events is limiting,
especially when simultaneously scrolling in both directions and the caller
tries to implement kinetic scrolling.

Take a page from the tablet-support branch and instead implement the axis
event as a generic event that can contain multiple axes simultaneously.

Right now we only have two (scroll) axes and we could easily just check both
for non-zero values. If we want to allow further axes in the future, we need
a check whether an axis is set in an event, that's what
libinput_event_pointer_has_axis to scroll events() is for.

We also need the mask to notify of a scroll stop event, which could otherwise
be confused as a vertical-only or horizontal-only event.

This is an API and ABI break.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoParse the MOUSE_WHEEL_CLICK_ANGLE udev property if present
Peter Hutterer [Sun, 11 Jan 2015 22:39:47 +0000 (08:39 +1000)]
Parse the MOUSE_WHEEL_CLICK_ANGLE udev property if present

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoChange the scroll step distance to 15 and document it as degrees
Peter Hutterer [Fri, 9 Jan 2015 07:03:45 +0000 (17:03 +1000)]
Change the scroll step distance to 15 and document it as degrees

Similar to the mouse resolution, let's make the scroll distance a sensible
predictable value. Most mice use a 15 degree angle per scroll click, so let's
change to that. This will alter behaviour in clients that expect 10.

We return doubles for the axis value, so that leaves the option of
really fine-grained step sizes in the future.

We currently assume all mice have 15 degree angles. Like the DPI settings, it
will require a udev property to be set. Patch for that to follow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoAdd a comment to clarify what the prop parameter is
Peter Hutterer [Sun, 11 Jan 2015 22:15:12 +0000 (08:15 +1000)]
Add a comment to clarify what the prop parameter is

prop isn't the full property line, just the value.
And document the return value too while we're at it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agolibinput.h: Fix some line wrapping in documentation
Stephen Chandler Paul [Mon, 5 Jan 2015 22:44:37 +0000 (17:44 -0500)]
libinput.h: Fix some line wrapping in documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agobuild-pedantic: use main(void)
Marek Chalupa [Fri, 9 Jan 2015 09:34:46 +0000 (10:34 +0100)]
build-pedantic: use main(void)

Main has unused parameters argc and argv. Since they are unused and
C 99 allows to prototype main as 'int main(void)',
remove them and replace by void. It fixes build when unused parameters
are treated as errors.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: switch signal handler in event-debug
Peter Hutterer [Wed, 7 Jan 2015 04:32:16 +0000 (14:32 +1000)]
tools: switch signal handler in event-debug

Under gdb, signalfd will still deliver the signal when gdb itself is
interrupted and quit event-debug. For a debugging tool, that's not optimal.
Switch to a normal signal handler instead, signalfd is overkill here anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotools: fail if we can't set up signal handlers in event-debug
Peter Hutterer [Wed, 7 Jan 2015 04:09:00 +0000 (14:09 +1000)]
tools: fail if we can't set up signal handlers in event-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDropped an extra 'the'
Jonas Ådahl [Wed, 7 Jan 2015 04:10:28 +0000 (12:10 +0800)]
Dropped an extra 'the'

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agos/discreet/discrete/
Jonas Ådahl [Wed, 7 Jan 2015 04:03:53 +0000 (12:03 +0800)]
s/discreet/discrete/

Discreet means to not draw attention.

Discrete means non-continuous.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: fix a clang compiler warning
Peter Hutterer [Mon, 5 Jan 2015 23:34:06 +0000 (09:34 +1000)]
touchpad: fix a clang compiler warning

Causes the valgrind tests to fail as tp is considered uninitialized.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix a clang compiler warning
Peter Hutterer [Mon, 5 Jan 2015 22:49:11 +0000 (08:49 +1000)]
test: fix a clang compiler warning

misc.c:562:10: warning: missing field 'expected_dpi' initializer
[-Wmissing-field-initializers]
                { NULL }

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: drop empty test device interfaces
Peter Hutterer [Mon, 5 Jan 2015 22:52:49 +0000 (08:52 +1000)]
test: drop empty test device interfaces

We can just set the interface component to NULL directly instead. Fixes clang
warnings:

litest-mouse.c:38:1: warning: missing field 'touch_move' initializer
[-Wmissing-field-initializers]

litest-trackpoint.c:38:1: warning: missing field 'touch_move' initializer
[-Wmissing-field-initializers]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDrop unused function calc_penumbral_gradient
Peter Hutterer [Mon, 5 Jan 2015 22:50:03 +0000 (08:50 +1000)]
Drop unused function calc_penumbral_gradient

Unused since 4913fd7a4806e54ebe4eb7f5f3f1d2fa3b8fdbdb

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMinor documentation wording improvement
Peter Hutterer [Wed, 24 Dec 2014 01:12:41 +0000 (11:12 +1000)]
Minor documentation wording improvement

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: print device capabilities in event-debug
Peter Hutterer [Sun, 4 Jan 2015 22:36:00 +0000 (08:36 +1000)]
tools: print device capabilities in event-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: change name/seat/logical seat format string
Peter Hutterer [Sun, 4 Jan 2015 22:40:35 +0000 (08:40 +1000)]
tools: change name/seat/logical seat format string

Change the seat field widths to match the usual seat0/default. This compresses
the output a bit, we're printing too much already.

Also, one of my mice has >30 chars, it's annoying to look at. Fix this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd pointer axis sources to the API
Peter Hutterer [Wed, 5 Nov 2014 06:22:07 +0000 (16:22 +1000)]
Add pointer axis sources to the API

For a caller to implement/provide kinetic scrolling ("inertial scrolling",
"fling scrolling"), it needs to know how the scrolling motion was implemented,
and what to expect in the future. Add this information to the pointer axis
event.

The three scroll sources we have are:
* wheels: scrolling is in discreet steps, you don't know when it ends, the
  wheel will just stop sending events
* fingers: scrolling is continuous coordinate space, we know when it stops and
  we can tell the caller
* continuous: scrolling is in continuous coordinate space but we may or may not
  know when it stops. if scroll lock is used, the device may never technically
  get out of scroll mode even if it doesn't send events at any given moment
  Use case: trackpoint/trackball scroll emulation on button press

The stop event is now codified in the API documentation, so callers can use
that for kinetic scrolling. libinput does not implement kinetic scrolling
itself.

Not covered by this patch:
* The wheel event is currently defined as "typical mouse wheel step", this is
  different to Qt where the step value is 1/8 of a degree. Some better
  definition here may help.
* It is unclear how an absolute device would map into relative motion if the
  device itself is not controlling absolute motion.
* For diagonal scrolling, the vertical/horizontal terminator events would come
  in separately. The caller would have to deal with that somehow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Original patch, before the rebase onto today's master:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add edge-scrolling tests
Peter Hutterer [Wed, 24 Dec 2014 00:16:12 +0000 (10:16 +1000)]
test: add edge-scrolling tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd libinput_set_user_data
Peter Hutterer [Tue, 23 Dec 2014 03:37:28 +0000 (13:37 +1000)]
Add libinput_set_user_data

Previously, the pointer could only be passed into the context on creation
time and was immutable after that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDeclare libinput.sym as dependency
Peter Hutterer [Thu, 18 Dec 2014 04:18:53 +0000 (14:18 +1000)]
Declare libinput.sym as dependency

We want to rebuild whenever it changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: revert to pointer movement when stopping twofinger scrolling
Peter Hutterer [Thu, 18 Dec 2014 00:37:38 +0000 (10:37 +1000)]
touchpad: revert to pointer movement when stopping twofinger scrolling

Add a boolean state machine for two-finger scrolling so we know when we're
currently scrolling. If we were scrolling and it stops, pick the active
touch as pointer touch so we can go back to pointer movement without having to
lift the finger off the touchpad.

https://bugs.freedesktop.org/show_bug.cgi?id=86807

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: rename scroll.state to scroll.edge_state
Peter Hutterer [Thu, 18 Dec 2014 00:21:48 +0000 (10:21 +1000)]
touchpad: rename scroll.state to scroll.edge_state

In preparation for a twofinger_state field, to avoid confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: switch tests to use the new helper function
Peter Hutterer [Thu, 18 Dec 2014 01:52:31 +0000 (11:52 +1000)]
test: switch tests to use the new helper function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add helper function for checking for a specific event type
Peter Hutterer [Thu, 18 Dec 2014 01:29:32 +0000 (11:29 +1000)]
test: add helper function for checking for a specific event type

In a few tests we care about that a specific set of events are in the queue
but not about the details of the events (usually checked elsewhere). Instead
of manual loops, provide a helper function that also checks that there is at
least one of those events in the queue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: switch touch points around for semi-mt tap-n-drag testing
Peter Hutterer [Thu, 18 Dec 2014 03:52:36 +0000 (13:52 +1000)]
test: switch touch points around for semi-mt tap-n-drag testing

The tests ignored it when motion events never happened - but that's mostly
what these tests are about. This only happened for semi-mt devices that use
the bounding box only, not separate touch points. Switching the touch points
around that the bounding box doesn't interfere causes the test to work as
expected.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: pass the userdata to the context
Peter Hutterer [Tue, 23 Dec 2014 01:13:33 +0000 (11:13 +1000)]
tools: pass the userdata to the context

The event-gui needs this but it got dropped in
6ee8c585, causing a crash. Oops.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: use the new shared lib from event-gui
Peter Hutterer [Thu, 18 Dec 2014 04:47:54 +0000 (14:47 +1000)]
tools: use the new shared lib from event-gui

This gives the event gui the ability to use the path backend, and any
configuration toggles given on the commandline.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add support for enabling/disabling left-handed button mappings
Peter Hutterer [Thu, 18 Dec 2014 05:14:09 +0000 (15:14 +1000)]
tools: add support for enabling/disabling left-handed button mappings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add support to enable/disable natural scrolling
Peter Hutterer [Thu, 18 Dec 2014 05:10:59 +0000 (15:10 +1000)]
tools: add support to enable/disable natural scrolling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: move applying device configuration to shared lib
Peter Hutterer [Thu, 18 Dec 2014 05:10:09 +0000 (15:10 +1000)]
tools: move applying device configuration to shared lib

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: move opening the backend to the shared lib too
Peter Hutterer [Thu, 18 Dec 2014 05:02:45 +0000 (15:02 +1000)]
tools: move opening the backend to the shared lib too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: move option parsing to a helper library
Peter Hutterer [Thu, 18 Dec 2014 04:42:42 +0000 (14:42 +1000)]
tools: move option parsing to a helper library

event-debug and event-gui can and should share this

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add --enable-tap to event-debug
Peter Hutterer [Thu, 18 Dec 2014 03:04:50 +0000 (13:04 +1000)]
tools: add --enable-tap to event-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: make event-debug's option parsing more flexible
Peter Hutterer [Thu, 18 Dec 2014 02:56:14 +0000 (12:56 +1000)]
tools: make event-debug's option parsing more flexible

We need to be able to turn config options on/off for testing, so switch to
something that's a bit more flexible than characters that represent the
options.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move the wiki's palm detection docs to here
Peter Hutterer [Mon, 22 Dec 2014 23:47:39 +0000 (09:47 +1000)]
doc: move the wiki's palm detection docs to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move the wiki's tapping documentation to here
Peter Hutterer [Mon, 22 Dec 2014 23:32:37 +0000 (09:32 +1000)]
doc: move the wiki's tapping documentation to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move the wiki's scrolling documentation to here
Peter Hutterer [Mon, 22 Dec 2014 23:24:33 +0000 (09:24 +1000)]
doc: move the wiki's scrolling documentation to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add link to udev hwdb in rel motion normalization doc
Peter Hutterer [Mon, 22 Dec 2014 22:15:00 +0000 (08:15 +1000)]
doc: add link to udev hwdb in rel motion normalization doc

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: document the calibration as well
Peter Hutterer [Mon, 22 Dec 2014 02:11:46 +0000 (12:11 +1000)]
doc: document the calibration as well

Requires MathJax for client-side, but that's an easy dependency to accept and
better than requiring Latex to build the documentation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: improve seat documentation
Peter Hutterer [Mon, 22 Dec 2014 00:33:55 +0000 (10:33 +1000)]
doc: improve seat documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move "device configuration via udev" page to here
Peter Hutterer [Mon, 22 Dec 2014 00:11:09 +0000 (10:11 +1000)]
doc: move "device configuration via udev" page to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: drop touchpad button behavior page - provided in doc/ now
Peter Hutterer [Mon, 22 Dec 2014 00:09:27 +0000 (10:09 +1000)]
doc: drop touchpad button behavior page - provided in doc/ now

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move relative motion normalization page over to doc/
Peter Hutterer [Mon, 22 Dec 2014 00:08:13 +0000 (10:08 +1000)]
doc: move relative motion normalization page over to doc/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoImprove the documentation
Peter Hutterer [Mon, 22 Dec 2014 00:04:58 +0000 (10:04 +1000)]
Improve the documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdded configure option for documentation build.
Jon A. Cruz [Thu, 18 Dec 2014 18:49:59 +0000 (10:49 -0800)]
Added configure option for documentation build.

Added option with fallback of 'auto' to control building of documentation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoInitial move of some wiki contents into main documentation.
Jon A. Cruz [Thu, 18 Dec 2014 18:49:58 +0000 (10:49 -0800)]
Initial move of some wiki contents into main documentation.

This moves some information from the wiki into the main generated doxygen
documenation. It is fairly rought but includes examples for inline and
stand-alone diagrams, linking to external HTML pages, etc.

Among other things, it allows for better cross-referencing into the
main doxygen contents and thus for overall shorter documentation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add --help to event-debug's usage
Peter Hutterer [Thu, 18 Dec 2014 02:57:59 +0000 (12:57 +1000)]
tools: add --help to event-debug's usage

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix busted indentation
Peter Hutterer [Thu, 18 Dec 2014 01:55:17 +0000 (11:55 +1000)]
test: fix busted indentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta
Hans de Goede [Tue, 9 Dec 2014 11:47:11 +0000 (12:47 +0100)]
touchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta

Use TOUCHPAD_MIN_SAMPLES in tp_get_delta rather then hardcoding "4".

Also remove the superfluous TOUCHPAD_MIN_SAMPLES check before calling
tp_get_delta in tp_get_pointer_delta, this is not necessary as tp_get_delta
already checks itself.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: When a clickpad is clicked post combined motion of all touches
Hans de Goede [Tue, 9 Dec 2014 11:47:10 +0000 (12:47 +0100)]
touchpad: When a clickpad is clicked post combined motion of all touches

When clicking a clickpad the user may want to switch fingers to move the
pointer around, without lifting so as to not release the button.

Switch to using combined motion of all touches when a clickpad is clicked to
allow this.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=86807
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Add a tp_post_pointer_motion helper function
Hans de Goede [Tue, 9 Dec 2014 11:47:09 +0000 (12:47 +0100)]
touchpad: Add a tp_post_pointer_motion helper function

Split out the pointer-motion handling into a helper function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: print event type on state machine error
Peter Hutterer [Fri, 12 Dec 2014 01:21:05 +0000 (11:21 +1000)]
touchpad: print event type on state machine error

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: fix typos in error message
Peter Hutterer [Fri, 12 Dec 2014 01:13:21 +0000 (11:13 +1000)]
touchpad: fix typos in error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix two compiler warnings
Peter Hutterer [Thu, 11 Dec 2014 06:30:03 +0000 (16:30 +1000)]
test: fix two compiler warnings

device.c:596:2: warning: incompatible pointer to integer conversion
initializing 'intmax_t' (aka 'long') with an expression of type 'struct
libinput_device *' [-Wint-conversion]
        ck_assert_int_eq(libinput_event_get_device(event),

use ck_assert_ptr_eq() instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: print axis event information for debugging too
Peter Hutterer [Thu, 11 Dec 2014 04:11:27 +0000 (14:11 +1000)]
test: print axis event information for debugging too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: print the string of the event type
Peter Hutterer [Thu, 11 Dec 2014 04:02:37 +0000 (14:02 +1000)]
test: print the string of the event type

Bit quicker to parse than the number

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: put some extra warning in for libinput_event_destroy()
Peter Hutterer [Tue, 9 Dec 2014 03:52:45 +0000 (13:52 +1000)]
doc: put some extra warning in for libinput_event_destroy()

Unlike all other structs, events aren't refcounted and will get destroyed
immediately.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodoc: document the base structures so they show up in doxygen
Peter Hutterer [Tue, 9 Dec 2014 03:37:04 +0000 (13:37 +1000)]
doc: document the base structures so they show up in doxygen

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodoc: add the various events to the doxygen groups
Peter Hutterer [Tue, 9 Dec 2014 03:31:09 +0000 (13:31 +1000)]
doc: add the various events to the doxygen groups

Makes them show up on the respective page and in the data structures list
doxygen generates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodoc: include README as mainpage
Peter Hutterer [Tue, 9 Dec 2014 03:19:54 +0000 (13:19 +1000)]
doc: include README as mainpage

doxygen supports markdown so we can expand the README with general interesting
information in markdown format and have it be the front page of the
documentation at the same time.

This requires renaming README to README.txt, but that's a relatively small
price to pay.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoUse symbol versioning
Peter Hutterer [Tue, 9 Dec 2014 02:52:45 +0000 (12:52 +1000)]
Use symbol versioning

This isn't the final 0.8.0 API yet, but we might as well get started.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoDrop deprecated symbols
Peter Hutterer [Tue, 9 Dec 2014 02:55:17 +0000 (12:55 +1000)]
Drop deprecated symbols

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotest: create a new device during the disable test to change fds
Peter Hutterer [Wed, 10 Dec 2014 01:01:08 +0000 (11:01 +1000)]
test: create a new device during the disable test to change fds

In the current test, disable followed by enable would result in the same fd
number for the new device, not exposing a bug fixed by
"evdev: Ensure the libevdev object receives the new fd on resume"

Create a keyboard device after suspending the first device, then re-enable the
device. This changes the fd to a different number, so we pick up on internal
bugs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Ensure the libevdev object receives the new fd on resume
Carlos Garnacho [Tue, 9 Dec 2014 14:55:32 +0000 (15:55 +0100)]
evdev: Ensure the libevdev object receives the new fd on resume

Otherwise, input_events will be attempted to read from the wrong place,
which also leaves the right/current fd with pending data to be read,
making the epoll fd wake up constantly.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Use remove callback to unlink event listener and stop timers
Hans de Goede [Fri, 5 Dec 2014 11:50:39 +0000 (12:50 +0100)]
touchpad: Use remove callback to unlink event listener and stop timers

We use 2 mechanisms to unregister the trackpoint event listener depending on
device removal order.

1) We have a device_removed callback, if the trackpoint gets removed before
the touchpad, this gets called, sees the device being removed is the trackpoint
and unregisters the listener

2) If the touchpad gets removed first, then in tp_destroy we unregister the
listener

2) May be delayed beyond the destruction of the trackpoint itself if the
libinput user has a reference to the libinput_device for the touchpad.
When this happens the trackpoint still has an eventlistener at destroy time
and an assert triggers.

To fix this we must do 2) at the same time as we do 1), so at remove time.

While working on this I noticed that the touchpad code was also cancelling
timers at destroy time rather then remove time, which means that they may
expire between remove and destroy time, and cause events to be emitted from
a removed device, so this commit moves the cancelling of the timers to the
remove callback as well.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Add a remove callback to the evdev_dispatch_interface
Hans de Goede [Fri, 5 Dec 2014 11:39:16 +0000 (12:39 +0100)]
evdev: Add a remove callback to the evdev_dispatch_interface

Some dispatchers may want to do some cleanup at remove time, rather then at
destroy time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoREADME: link to bugzilla and API docs
Peter Hutterer [Tue, 9 Dec 2014 02:58:04 +0000 (12:58 +1000)]
README: link to bugzilla and API docs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: fix wording on the dpi normalization paragraph
Peter Hutterer [Tue, 9 Dec 2014 03:42:45 +0000 (13:42 +1000)]
doc: fix wording on the dpi normalization paragraph

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: delete double-empty lines
Peter Hutterer [Tue, 9 Dec 2014 03:56:02 +0000 (13:56 +1000)]
doc: delete double-empty lines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Remove double-semicolon
Carlos Garnacho [Mon, 8 Dec 2014 09:46:54 +0000 (10:46 +0100)]
evdev: Remove double-semicolon

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.7 0.7.0
Peter Hutterer [Fri, 5 Dec 2014 02:08:22 +0000 (12:08 +1000)]
configure.ac: libinput 0.7

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoudev: only apply default calibration on absolute devices
Peter Hutterer [Fri, 5 Dec 2014 03:41:04 +0000 (13:41 +1000)]
udev: only apply default calibration on absolute devices

Fixes a crash if the LIBINPUT_CALIBRATION_MATRIX is set for a relative device.

https://bugs.freedesktop.org/show_bug.cgi?id=86993

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoSplit libinput-util into a noinst helper library
Peter Hutterer [Fri, 5 Dec 2014 02:52:22 +0000 (12:52 +1000)]
Split libinput-util into a noinst helper library

Fixes distcheck (automake 1.14.1)

make[2]: Entering directory '....../libinput-0.7.0/_build/test'
Makefile:926: ../src/.deps/libinput-util.Plo: No such file or directory
make[2]: *** No rule to make target '../src/.deps/libinput-util.Plo'.  Stop.
make[2]: Leaving directory '....../libinput/libinput-0.7.0/_build/test'
Makefile:412: recipe for target 'distclean-recursive' failed

That was the only place we used subdir objects, so we can drop it from
configure now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotest: Don't send two motion events when button scrolling
Jonas Ådahl [Thu, 4 Dec 2014 03:44:10 +0000 (11:44 +0800)]
test: Don't send two motion events when button scrolling

Button scrolling motion events don't pass through the acceleration
filter so no need to assume the initial event will be absorbed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoIntroduce unaccelerated motion event vectors
Jonas Ådahl [Thu, 4 Dec 2014 03:44:09 +0000 (11:44 +0800)]
Introduce unaccelerated motion event vectors

For certain applications (such as FPS games) it is necessary to use
unaccelerated motion events (the motion vector that is passed to the
acceleration filter) to get a more natural feeling. Supply this
information by passing both accelerated and unaccelerated motion
vectors to the existing motion event.

Note that the unaccelerated motion event is not equivalent to 'raw'
events as read from devices.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAlways check for INVALID configs first
Peter Hutterer [Thu, 4 Dec 2014 06:50:32 +0000 (16:50 +1000)]
Always check for INVALID configs first

Always check for invalid input first, then check if the input is supported by
the actual device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: drop unused device arg from tp_clear_state
Peter Hutterer [Thu, 4 Dec 2014 01:08:01 +0000 (11:08 +1000)]
touchpad: drop unused device arg from tp_clear_state

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd missing @ingroup tag
Peter Hutterer [Wed, 3 Dec 2014 04:28:12 +0000 (14:28 +1000)]
Add missing @ingroup tag

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDocument relative motion normalization
Peter Hutterer [Wed, 3 Dec 2014 01:57:35 +0000 (11:57 +1000)]
Document relative motion normalization

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd libinput_device_get_context/libinput_seat_get_context
Peter Hutterer [Mon, 1 Dec 2014 06:00:13 +0000 (16:00 +1000)]
Add libinput_device_get_context/libinput_seat_get_context

Allow retrieval of the libinput context from the seat and the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd a function to retrieve the udev_device handle from a libinput device
Peter Hutterer [Fri, 31 Oct 2014 00:53:53 +0000 (10:53 +1000)]
Add a function to retrieve the udev_device handle from a libinput device

The libinput device abstracts a number of things but sometimes the underlying
device is important. The udev device provides the necessary handle to access
that underlying device and various sysfs properties that may be necessary.

A function returning the device node would've done the same thing but is more
prone to race conditions than the udev_device.

https://bugs.freedesktop.org/show_bug.cgi?id=85573

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoChange default DPI to 1000
Peter Hutterer [Fri, 28 Nov 2014 00:09:21 +0000 (10:09 +1000)]
Change default DPI to 1000

400 used to be the default DPI for many mice but it it's not anymore. A survey
of mice shows that 400 is still common as one of the pre-configured settings
in switchable multi-resolution gaming mice, but devices with a single
resolution mostly favor 1000 dpi.

Let's make that switch now so that any future changes to the pointer
acceleration code assumes that resolution as a default.

For the touchpad, this has a bad side-effect, caused by our expectation of
mouse vs touchpad behaviours: our acceleration code ignores device type and
provides the same acceleration for the same physical movement. Unfortunately,
we expect touchpads to be significantly slower than mice.

The previous 400 DPI worked because it caused an acceptable slowdown on input.
e.g. on the T440 with a res of 42 units/mm, the scale coefficient was 0.37.
For 1000 DPI as default, this now results in 0.94, i.e. speeding up the
touchpad by a factor of 2.5. That is way too fast.

Adding touchpad-specific filter code is a bigger project, so let's just add a
fixme for now and scale the coefficient back to what it was before the
DPI default change. Effect: touchpad behaves as before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoMove DEFAULT_MOUSE_DPI to filter.h
Peter Hutterer [Fri, 28 Nov 2014 00:08:02 +0000 (10:08 +1000)]
Move DEFAULT_MOUSE_DPI to filter.h

The filter code is what relies on some default dpi configuration to apply
pointer acceleration and expects the input coordinates to be pre-scaled to
that resolution.

Let's move the define here so we can use it from the touchpad code too.

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: fix a comment, 400 isn't hard-coded anymore
Peter Hutterer [Fri, 28 Nov 2014 00:00:30 +0000 (10:00 +1000)]
filter: fix a comment, 400 isn't hard-coded anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: Query mouse DPI from udev
Derek Foreman [Tue, 25 Nov 2014 17:46:42 +0000 (11:46 -0600)]
evdev: Query mouse DPI from udev

Instead of using a hard coded mouse DPI value, we query it from udev.
If it's not present or the property is obviously broken we fall back
to default.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: move device ID test to test/device.c
Peter Hutterer [Mon, 1 Dec 2014 03:21:26 +0000 (13:21 +1000)]
test: move device ID test to test/device.c

More appropriate here, they were in misc because this file didn't exist yet
when they were added.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Fix uninitialized variable warning
Derek Foreman [Tue, 25 Nov 2014 17:53:23 +0000 (11:53 -0600)]
evdev: Fix uninitialized variable warning

The early exit path in evdev_device_compare_syspath() expects
udev_device_new to be initialized to NULL, but it wasn't.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoIgnore devices that have joystick buttons
Krzysztof A. Sobiecki [Tue, 25 Nov 2014 01:33:53 +0000 (02:33 +0100)]
Ignore devices that have joystick buttons

This patch allows libinput to ignore devices that have joystick buttons.

Signed-off-by: Krzysztof Sobiecki <sobkas@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Add edge-scrolling support
Hans de Goede [Mon, 24 Nov 2014 11:16:06 +0000 (12:16 +0100)]
touchpad: Add edge-scrolling support

Add edge-scrolling support for non multi-touch touchpads as well as for
users who prefer edge-scrolling (as long as they don't have a clickpad).

Note the percentage to use of the width / height as scroll-edge differs from
one manufacturer to the next, the various per model percentages were taken
from xf86-input-synaptics.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=85635
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Add code to get the touchpad model / manufacturer
Hans de Goede [Mon, 24 Nov 2014 11:16:05 +0000 (12:16 +0100)]
touchpad: Add code to get the touchpad model / manufacturer

This is useful to know in some cases, it is e.g. necessary to figure out
which percentage of a touchpads range to use as edge for edge-scrolling.

Note this is a slightly cleaned up copy of the same code in
xf86-input-synaptics.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Move 2 finger scrolling functions to above tp_process_state()
Hans de Goede [Mon, 24 Nov 2014 11:16:04 +0000 (12:16 +0100)]
touchpad: Move 2 finger scrolling functions to above tp_process_state()

This is purely a code move, this is a preparation patch for adding edge
scrolling support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add seat changing tests
Peter Hutterer [Wed, 19 Nov 2014 05:42:54 +0000 (15:42 +1000)]
test: add seat changing tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd libinput_device_set_seat_logical_name() to change seats at runtime
Peter Hutterer [Wed, 19 Nov 2014 03:43:59 +0000 (13:43 +1000)]
Add libinput_device_set_seat_logical_name() to change seats at runtime

The seat of a device is currently immutable, but a device may (in a
multi-pointer case) move between different logical seats. Moving it between
seats is akin to removing it and re-plugging it, so let's do exactly that.

The physical seat name stays immutable.

Pro:
- device handling after changing a seat remains identical as handling any
  other device.
Con:
- tracking a device across seat changes is difficult
- this is not an atomic operation, if re-adding the device fails it stays
  removed from the original seat and is now dead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agopath: optionally pass the seat name into path_device_enable()
Peter Hutterer [Wed, 19 Nov 2014 04:16:48 +0000 (14:16 +1000)]
path: optionally pass the seat name into path_device_enable()

Prep work for changing seat names on devices. No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>