Commit Graph

57 Commits

Author SHA1 Message Date
Peter Hutterer
a55cb9121a Move the property #defines up
Since they serve as documentation, make them easier to find.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-19 14:36:19 +10:00
Peter Hutterer
2348a6812a Fix for new libinput APIs
Scroll events carry multiple axes.

Left-handed config was renamed to drop the "button" bit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-15 13:12:36 +10:00
Peter Hutterer
0c4eaf5480 Support server-side fds
libinput's device handling and server-side fd handling are a bit of a
mismatch, so this is hackier than one would hope for.

The server sets pInfo->fd and the options "fd" and "device".
The server requires pInfo->fd to be the one triggering select(2) to call the
correct pInfo->read_input. We can't pass an fd to use into libinput, all we
have is the open_restricted callback. That callback gives us the context, but
not the pInfo with the fd we want.

The solution:
1) In PreInit, store the patch + fd combination in a driver-wide list. Search
that list for an fd in open_restricted, return the pre-openend fd.

2) Overwrite all devices' pInfo->fd with the libinput epollfd. In this driver
we don't care about which device read_input is called on, we get the correct
pInfo to post events from through the struct libinput_device of the libinput
events.

3) When a device is closed, swap the real fd back in so systemd-logind closes the
right fd.

This saves us worrying about keeping the right refcount on who currently has
the fd set to the libinput fd. We just set it for all devices, let the server
figure out which device to call (the first in inputInfo.devices) and we only
need to remember to swap it back during DEVICE_OFF.

If the server calls close on a pInfo->fd without telling the driver, that's a
bug anyway.

This patch also drops the pInfo->fd = -1 calls, they've been unnecessary since
at least 1.11, possibly earlier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-12-08 08:36:16 +10:00
Peter Hutterer
200be95ac9 Support absolute pointer devices
Detecting them is a bit of guesswork: if a device is a pointer device and has
a calibration matrix option, then the device must be an abs device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 15:12:31 +10:00
Peter Hutterer
8b5dbd4c01 Split up a really long line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 15:20:41 +10:00
Peter Hutterer
fb5c5b6f85 Move the option parsing into a separate function
No functional changes, makes preinit a bit more digestible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 11:52:28 +10:00
Peter Hutterer
182363d674 Change a sigsafe error to xf86IDrvMsg
We don't use the signal handler in this driver, so no need for sigsafe
logging.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 11:48:56 +10:00
Peter Hutterer
f0b14c6ccc Change the touch IDs to uints
Better overflow behavior, not that we're likely to trigger it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 11:47:15 +10:00
Peter Hutterer
dda952fafe Leave the XKB defaults up to the server
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 11:44:11 +10:00
Peter Hutterer
17302c3352 Allow disabling scroll methods
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 11:31:30 +10:00
Peter Hutterer
7e3926f2b7 Split sendevent modes property into "available" and "current"
Clients need to know which methods are available, not just which one
is currently set. Export bitmask config options as two properties,
one read-only named "... Available" and one set-able one named "... Enabled"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 11:31:30 +10:00
Peter Hutterer
9ad23dd1cb Split scroll methods property into "available" and "current"
Clients need to know which methods are available, not just which one is
currently set. Export bitmask config options as two properties, one read-only
named "... Available" and one set-able one named "... Enabled"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-28 09:14:24 +10:00
Peter Hutterer
eddc8cb1b2 Don't process events from devices that got removed already
If the driver doesn't have a pInfo reference anymore for a libinput device,
don't bother processing events, the device was already removed. This was
triggered by the libevdev test suite which adds/removes devices very quickly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-24 11:50:48 +10:00
Peter Hutterer
95597d8070 Drop double empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-24 11:50:48 +10:00
Peter Hutterer
a323e221a7 Use the button conversion helper for normal button events too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-24 11:01:25 +10:00
Peter Hutterer
6385974e4d Add support for changing the button-scrolling button
This currently exposes the libinput button name, which isn't ideal. Needs to
be switched to X button numbers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-24 11:01:25 +10:00
Peter Hutterer
439a244ae7 Add support for switching scroll methods
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-24 11:00:44 +10:00
Peter Hutterer
4a049ad6f8 Add support for left-handed button orientation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-24 10:50:24 +10:00
Peter Hutterer
576da9db26 Hook up the libinput log handler
Let the server filter based on the verbosity levels in the server, so map
ERROR to -1 (always), INFO to 3 (default verbosity) and DEBUG to 10.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-19 14:40:58 +10:00
Peter Hutterer
2eb01498bd Add an explanatory comment for the disabled ptraccel
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-19 14:40:58 +10:00
Peter Hutterer
a4fb161c3e Allow re-enabling of the sendevents configuration
When re-enabling the device, the mode is 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-19 14:40:58 +10:00
Peter Hutterer
d9c212d266 Init the right number of buttons for pointer devices
This only makes room for the highest button number present on the device, it
doesn't cater for devices with 'holes'. i.e. if a device has only BTN_BACK, it
will initialize buttons for all below too.

Which is also evdev's current behavior.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-19 14:40:58 +10:00
Peter Hutterer
d48f437aa9 Replace hardcoded button number with one we can calculate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-19 14:39:50 +10:00
Peter Hutterer
84f301f7e3 Fix loop condition
Use the passed-in value, not the global constant.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-19 14:39:50 +10:00
Peter Hutterer
6f06b1dd1d Set the XI type for the device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-18 13:37:39 +10:00
Peter Hutterer
2b6c485117 Store the data in the local options, then apply all at once
Less code this way, though if we somehow sneak in a bad option we get the
error for it every time we update any property.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-26 14:42:31 +10:00
Peter Hutterer
246200cbdc Apply all config options on DEVICE_ON
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-26 14:36:10 +10:00
Peter Hutterer
fb41458a93 Expose all config options as xorg.conf options
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-26 14:36:10 +10:00
Peter Hutterer
0a58edd3f6 Add a couple of general properties that all drivers should support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-26 14:25:20 +10:00
Peter Hutterer
8d6019c786 Expose properties for the various configuration settings.
The property support isn't ideal, the server relies on the driver to check
first if a setting is possible, applying the setting itself cannot fail.
Thus we can't just check the libinput config status code, which matters mostly
in the sendevents property where we simply check that only a single bit is set
and that the supported modes are equal or more to the requested mode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-26 14:23:28 +10:00
Peter Hutterer
6a69462359 Let libinput take care of pointer acceleration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-01 11:19:06 +10:00
Peter Hutterer
9e664af686 Use the new libinput_ref/unref instead of manual counting.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-26 15:11:30 +10:00
Peter Hutterer
c28d90ba69 Fix for libinput 0.4.0 API changes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 14:43:16 +10:00
Peter Hutterer
3b2e3e6f9e Require libinput 0.3.0
And add fix for the renamed button state enum

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-10 09:06:17 +10:00
Jonas Ådahl
e7f7ed9303 Use floating point instead of fixed point numbers
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-10 09:04:10 +10:00
Peter Hutterer
163b244ec5 Fix scrolling axis number
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-10 09:03:28 +10:00
Peter Hutterer
102c126c02 Delete the input device reference on uninit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-04 15:19:54 +10:00
Peter Hutterer
e114d517b5 Unset the device user data on device off
Once we turn the device off, we may still get events from it but the pInfo
struct may not be valid anymore to process those events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-04 15:18:43 +10:00
Peter Hutterer
1ab6637b56 zero out the valuator mask before sending touch events
otherwise we might re-submit values from other events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:09:02 +10:00
Peter Hutterer
16796d08d8 Switch to ValuatorMasks for motion and axis events
Allows us to use subpixel data, not that the server does a good job with it.
But at least for scrolling we should now be able to scroll by  small amounts
too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 08:46:44 +10:00
Peter Hutterer
116a484498 Only post rel motion events if we have a non-zero delta
We trunc the li_fixed_t to int, so we don't always have a delta to post

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-25 13:37:19 +10:00
Benjamin Tissoires
b8611394cd Do not set valuators for touch up events
the kernel does not send any ABS_MT_POSITION_X|Y data while releasing
the touch, so use the previous values to set the position of the release.

If it's not done, the touch up occurs at (0,0) and moves dragged elements
to the upper right corner.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-07 10:35:13 +10:00
Peter Hutterer
74cd082e15 Fix up for new libinput API - without touch subtypes
Touch types are now top-level event types.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-07 10:35:13 +10:00
Peter Hutterer
ac6e2171d7 Whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-07 10:35:13 +10:00
Peter Hutterer
ec5e60c41e Reset the fd to -1 after PreInit
We open and remove the device immediately, but the fd was left on the old
value. This makes debugging harder, since the fd looks correct when it isn't.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-21 15:58:20 +10:00
Peter Hutterer
c0046e2b41 Fix bitmask handling when changing LEDs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-21 13:50:25 +10:00
Benjamin Tissoires
bee8989c74 Fix scrolling jumps
libinput currently scales wheel events by DEFAULT_AXIS_STEP_DISTANCE,
which is currently 10.
We may be able to find the value automatically, but it would require
some dark codings that may not be robust.
For the time being, just duplicate the define in libinput.c and remember
to update it if it is changed in the future.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-18 10:09:06 +10:00
Peter Hutterer
761603d9e7 Adjust for new API - current-screen-dimensions callback was removed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-06 11:28:30 +10:00
Peter Hutterer
17826b06dc Keep track of the enabled devices
All libinput devices share the same file descriptor so make sure we don't
remove from the server's select loop until the last device is disabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-04 08:45:18 +10:00
Peter Hutterer
54da516906 Clarify a comment
Whatever xf86AddEnabledDevice does to the fd, it doesn't work with an
epollfd. Should probably investigate that further.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-04 08:25:27 +10:00