Compare commits

...

90 Commits

Author SHA1 Message Date
Peter Hutterer
abcafeede7 xf86-input-evdev 2.11.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-10-15 14:32:50 +10:00
Peter Hutterer
d893fc74d2 Map some specific high keycodes into the FK20-23 range
These mappings have been part of xkeyboard-config for over a decade and
the likely reason they were introduced is that the corresponding evdev
keycode is > 255.

Let's forcibly remap those in the driver here so the rest of the system
can switch to the real keycodes instead of having to map them to the
whatever X expects.

See https://github.com/systemd/systemd/pull/34325/

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/10>
2024-10-09 14:33:05 +10:00
Martin Rys
b9327e6b28 Swap Compose and Kana values to conform to USB HID spec
Should fix https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/204

Current state conflicts with XKB which defines them correctly.

NUM and CAPS are still incorrectly swapped, but it's equally wrong on
XKB's side and everywhere else, so it's just cosmetic and a breaking
change just to satisfy USB HID ordering is not worth it, since the keys
work fine this way anyway.

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/8>
2024-09-05 11:32:21 +10:00
Peter Hutterer
917c2ea204 gitlab CI: set the standard workflow rules for an fdo project 2024-09-03 13:49:04 +10:00
Enrico Weigelt, metux IT consult
b48c2b7028 dont spam xserver with false-positives
It's not necessary to spam the xserver log with error messages of
just temporary read failures that aren't actually errors.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 19:05:58 +02:00
Enrico Weigelt, metux IT consult
aac329fd2a fix FTBS on non-udev target platforms (eg. FreeBSD)
On platforms that don't have libudev at all (eg. FreeBSD), the build
breaks. The only consumer, EvdevDeviceIsVirtual(), can live well with
just bailing out directly if libudev isn't present.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 19:05:54 +02:00
Enrico Weigelt, metux IT consult
fbfb16edfe tolerate including linux/input.h
On some platforms (eg. FreeBSD) we're running into a name clash between
xf86str.h and linux/input.h. Since we don't actually need those symbols
here, an easy workaround is #undef'ing them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 18:42:22 +02:00
Enrico Weigelt, metux IT consult
409e8205e8 fix unportable linux-only include
including <linux/types.h> obviously isn't portable - instead using
<sys/types.h> is the right choice for us.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 18:38:12 +02:00
Enrico Weigelt, metux IT consult
7fc0d51f70 drop quirk for ancient linux kernel version (<2.6.30)
This kernel had been released 1.5 decades ago - probably no need to have
special quirks for such an ancient kernel version anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-10 18:05:40 +02:00
Enrico Weigelt, metux IT consult
7c48b6225b bump minimal xorg version to 1.18
1.18 was released a decade ago, so it seems reasonable stop supporting
older ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/5>
2024-05-14 10:59:46 +02:00
Alan Coopersmith
8edcb2b9e8 gitlab CI: ensure libtool is installed in build container
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-10-01 11:22:19 -07:00
Alan Coopersmith
84b2740814 gitlab CI: stop requiring Signed-off-by in commits
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-02-09 12:06:53 -08:00
Alan Coopersmith
469a30f158 Convert src/draglock.c from ISO-8859-1 to UTF-8
Fixes flawfinder error in CI:
Error: encoding error in ./src/draglock.c
'utf-8' codec can't decode byte 0xa9 in position 343: invalid start byte

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 11:11:01 -08:00
Alan Coopersmith
23909c35a4 gitlab CI: add a basic build test
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 10:55:36 -08:00
Alan Coopersmith
abf0fa611e Fix spelling/wording issues
Found by using:
    codespell --builtin clear,rare,usage,informal,code,names

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 10:51:03 -08:00
Alan Coopersmith
6609d352f3 Build xz tarballs instead of bzip2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 10:49:21 -08:00
Alan Coopersmith
71036116be Update configure.ac bug URL for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-11-25 12:45:55 -08:00
Alan Coopersmith
b6b36166bd Update README for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-11-18 11:30:58 -08:00
Peter Hutterer
67a97afbc0 evdev 2.10.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 10:05:22 +10:00
Andrey Zabolotnyi
2fb95783e0 Fix generation of proximity-in/out events.
Invoking xf86PostProximityEvent with no valuators does nothing, so we
have to provide a valid valuator set to the call.

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

[whot: slight change from 104562
abs_vals is reset on every frame but old_vals is kept around to remember the
last value of the valuator (and is updated to the current values before
processing the frame). We expect the prox in to have x/y, so let's just
unconditionally use old_vals for proximity events.]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 10:00:26 +10:00
Peter Hutterer
456f23cbbd Ignore x/y axis changes on proximity out
Wacom tablets send a farewell reset to 0 on all axes when the tool goes out of
proximity. Ignore those so we can rely on our various valuator masks always
having the correct coordinates.

Possible false positive if you manage to go out of proximity right above the
zero datum but meh.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 10:00:05 +10:00
Christian Gmeiner
ab1d9adfd3 Print cause of a failed open(..) call
This is quite helpful for debugging.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-30 13:37:57 +10:00
Andrey Zabolotnyi
192fdb0690 Fix handling of devices with only buttons (e.g. tablet pads).
When transforming 'only buttons' device into a pseudo-mouse by adding
relative X and Y axes, EVDEV_RELATIVE_EVENTS flag  must be set on device,
otherwise it gets classified as a keyboard by X11.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-16 16:30:59 +10:00
Mihail Konev
8c1058f2eb autogen: add default patch prefix
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
2017-01-26 14:00:21 +10:00
Emil Velikov
4921912374 autogen.sh: use quoted string variables
Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
fall-outs, when they contain space.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 11:13:25 +10:00
Peter Hutterer
67681097b8 autogen.sh: use exec instead of waiting for configure to finish
Syncs the invocation of configure with the one from the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-26 11:13:25 +10:00
Peter Hutterer
1dd61111ad evdev 2.10.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-18 13:14:29 +10:00
Alexander Volkov
231061d004 Don't send pointer events in addition to touch events
Updating abs_vals for touch events since d24431a186
leads to posting Motion events with updated coordinates to the X server,
which in turn resends them to clients.

Don't queue Motion events for touch events, the X server should
synthesize them itself.

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-03 11:28:17 +10:00
David Strobach
425ed6017a Middle emulation - make the emulated button number configurable
Sometimes it may be desirable to remap physical middle button
to something else and use emulation instead. The emulation is
however hardcoded to emulate physical button 2, so the emulated
button gets remapped together with the physical one. This patch
adds the Emulate3Button configuration option to allow for user
selection of the emulated button number and a configuration
like this:

Section "InputClass"
    Identifier "Middle button emulation config"
    MatchProduct ".... some device ..."
    MatchDriver "evdev"
    Option "Emulate3Buttons" "on"
    Option "Emulate3Button" "9"
EndSection

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-21 15:26:58 +10:00
Peter Hutterer
7251e42dfb Fix off-by-one error counting axes
We stopped counting one too early, but still initialized that axis later,
leading to a bug macro to trigger.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-10-24 08:27:24 +10:00
Peter Hutterer
551db5b86e evdev 2.10.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-01 17:49:10 +10:00
Keith Packard
bb8bde7456 Support XINPUT ABI 24 (remove select mask from block/wakeup handlers)
The evdev driver wasn't using the select mask arguments, so this
change just involves adjusting the argument lists.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-06 13:51:21 +10:00
Keith Packard
7b1267f7f1 Support XINPUT ABI version 23 (threaded input)
Use input_lock/input_unlock calls instead of SIGIO functions

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-02 09:42:05 +10:00
Keith Packard
e08b033276 Report errors when attempting to write keyboard controls
This is mostly to eliminate a compiler warning.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-02 09:41:25 +10:00
Peter Hutterer
7c1971d9e7 evdev 2.10.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-01 11:41:03 +10:00
Peter Hutterer
9a6952dafe Restore non-xy axes updates
This broke in d24431a186 Restore wheel emulation for absolute devices,
last hunk when the valuator update was moved to before any early exit
condition. But that new update only applies to valuator maps < 2, i.e. x/y
only. Other valuators are now ignored and remain on 0 forever.

Restore the valuator update.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-12 15:29:55 +10:00
Peter Hutterer
f12eca9f83 evdev 2.10.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 09:13:35 +10:00
Peter Hutterer
33dc3d7128 Prevent buffer overrun accessing btn_labels
We go up to BTN_JOYSTICK, hence group can have a value of up to including 15.
The actual btn_labels only has 6 elements though.

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-27 09:11:03 +10:00
Peter Hutterer
7b0a65d989 Don't reset the other axis on wheel emulation scroll buildup
The idea was that of a direction lock: as we move vertically we should not
build up any horizontal scroll motion even if we move slightly diagonally.

The effect was though that the axis would be reset completely as soon as an
event from the other axis occured. With the default threshold of 10, if one in
ten events was a REL_X, we'd never get a wheel event.

Drop this code, it's not needed. By default wheel emulation doesn't do
horizontal scrolling, if a config snippet sets XAxisMapping the user wants
horizontal scrolling. And since we just add the value anyway, as long as the
user does a roughly vertical motion we won't get over the threshold anyway.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 10:48:36 +10:00
Peter Hutterer
d24431a186 Restore wheel emulation for absolute devices
Wheel emulation relies on oldVals, which stopped updating in 3dcf6f123c.

Since wheel emulation may filter the abs event, store the event before we do
anything with it. If we really want the abs_event, abs_queued will be set to
1, otherwise the value will be ignored.

And now that we know abs_value is always valied, we can copy its value into
old_vals, so that wheel emulation can calculate the delta correctly.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 10:48:35 +10:00
Peter Hutterer
ce7d8fdebc man: add a warning that wheel emu inertia must be set and it isn't inertia
First, it's not actually inertia, it's simply the scroll distance, yay for the
misnomer.

And it needs to be set for any device that is more fine-grained than a
mouse, especially absolute devices. For example the VirtualBox device has an
abs max of 32767, so a simple motion may have a delta of to 2000 units and
that results in 200 scroll events. That's a bit excessive.

Related to: https://bugs.freedesktop.org/show_bug.cgi?id=93617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-14 11:53:56 +10:00
Peter Hutterer
6a3beab613 evdev 2.10.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-08 15:11:59 +10:00
Peter Hutterer
d7e61a7074 Only map x and y to axes 0 and 1
The Logitech G600 has one device with all axes north of ABS_MISC. The current
code assigns ABS_MISC as first axis to map to axis 0, i.e. x. On button press,
one node sends the BTN_LEFT but the other node sends an ABS_MISC with a 1 0
value. ABS_MISC is mapped to axis 0, this moves the pointer to (0, y) on
every button click.

Avoid this by simply mapping any axis other than x/y to at least axis 3, and
make sure we only override the MT 0/1 axes when we actually have MT axes.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-11-13 06:50:28 +10:00
Peter Hutterer
01e7ac4854 evdev 2.10.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-28 14:28:20 +10:00
Thomas Hindoe Paaboel Andersen
034be31159 Add "Resolution" option for mice to the evdev driver
It can be used to scale the resolution of a mouse to that of a 1000 DPI
mouse. This can be useful to make high resolution mice less sensitive
without turning off acceleration. The target of 1000 DPI is used as the
same default is used in libinput. If the option is not set no scaling
will be done.

https://bugs.freedesktop.org/show_bug.cgi?id=88134
Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 14:59:27 +10:00
Peter Hutterer
66c9978864 Add the default evdev config
This used to be part of the server but now that we have two drivers doing the
same thing (libinput, evdev) shift the configuration defaults to the driver.
This way you get what you install.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-18 13:39:37 +10:00
Peter Hutterer
0d3494eadf Bump to 2.9.99
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-27 11:41:50 +10:00
Peter Hutterer
56a5e67162 Unconditionally require mtdev
Missing from 2c9f4f0380

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-16 07:57:38 +10:00
Peter Hutterer
74433f788a Always check for a return value on creating a property
Mostly to make static analyzers happy

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-16 07:57:26 +10:00
Peter Hutterer
fdc33809de Invert a condition to reduce nesting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-13 10:58:01 +10:00
Peter Hutterer
38e107a39f Disable axis faking and MT event processing on fake MT devices
This effectively disables all axes >= ABS_MT_SLOT on those devices. But at
least the device comes up without an error and it didn't work correctly
beforehand anyway.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:21:09 +10:00
Peter Hutterer
b6176cff5a Invert two conditions to reduce nesting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:12 +10:00
Peter Hutterer
37afebfb67 Factor out MT axis counting into a separate function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:11 +10:00
Peter Hutterer
5b5ae1786c Split android axis simulation into a helper function
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:11 +10:00
Peter Hutterer
2c9f4f0380 Require multitouch/smooth scrolling dependencies
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:11 +10:00
Peter Hutterer
39ef4444a2 Drop evdev-specific XKB defaults
Just use the server defaults instead. This has very little effect, on most
systems there was some sort of default configuration applied anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-13 09:06:44 +10:00
Tobias Himmer
abc4a8b603 Check for incoming MT slot indices exceeding the allocated number of slots.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88715

Signed-off-by: Tobias Himmer <provisorisch@online.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-23 12:05:28 +10:00
Colin B. Macdonald
b370ccdff8 Workaround lack of ABS_X on MT devices (#80470)
Often on Android, we have ABS_MT_POSITION_X without ABS_X (which is contrary
to spec). We add fake ABS_X axis in that case.

X.Org Bug 80470 <http://bugs.freedesktop.org/show_bug.cgi?id=80470>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 10:40:25 +10:00
Éric Brunet
511498478b Move EVDEV_RELATIVE_MODE logic earlier
When in EVDEV_RELATIVE_MODE, after converting the absolute valuators, the
code unsets pEvdev->abs_queued. This is wrong if there are some absolute
valuators which are not positions, such as a pressure valuators, because
events on these valuators would be lost.

This patch fixes the problem by doing the absolute->relative translation
early. This way, abs_queued is not set and then unset when receiving
absolute valuators representing positions. Other absolute events now set abs_queued
and will be processed.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:42:11 +10:00
Éric Brunet
3dcf6f123c Don't update old_vals when not in EVDEV_RELATIVE_MODE
When not in EVDEV_RELATIVE_MODE, absolute position is stored in old_vals. This serves
no purpose except that old_vals is ready when the device is switched to
EVDEV_RELATIVE_MODE. It is however better to make the copy between old_vals
and abs_vals at the time of the switch rather than all the time.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:37:38 +10:00
Éric Brunet
f59585b367 Change the logic concerning EVDEV_RELATIVE_MODE and in_proximity
When not in_proximity, we don't really trust data, even though a valuator
sent just before a in_proximity event might actually be important. The
present code for EVDEV_RELATIVE_MODE throws away all data if not
in_proximity, which is a little bit too much. This patch allows for
relative values to be calculated and old_vals to be updated even if not
in_proximity, but will prevent evdev to sending (presumably) wrong
information to the X server. But at least, old_vals will be correctly
filled when the device comes into proximity again.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:33:17 +10:00
Éric Brunet
593bbc6390 drop the pEvdev->delta array
Now that relative events have their own valuator mask, use it instead of
delta

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:32:41 +10:00
Éric Brunet
e0e2587a95 Split pEvdev->vals into pEvdev->abs_vals and pEvdev->rel_vals
This should hopefully fix bug 84445.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:26:25 +10:00
Peter Hutterer
cb3b023783 evdev 2.9.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-26 09:23:39 +10:00
Peter Hutterer
124eff9ba2 Remove three unused #defines
Obsolete since 768c25a99b

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-07 13:41:06 +10:00
Éric Brunet
605047613c Don't pass superfluous arguments to EvdevPost*Events
The functions EvdevPostProximityEvents, EvdevPostRelativeMotionEvents,
EvdevPostAbsoluteMotionEvents and EvdevPostQueuedEvents are only called
by EvdevProcessSyncEvent. These functions take as arguments an array of
valuators which is set by EvdevProcessSyncEvent to contain ... nothing.
This patch changes the prototype of the four functions, their definitions
and the way they are called  to remove the useless array of valuators.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-29 11:18:16 +10:00
Peter Hutterer
3ee98d0b7f Drop some unused #defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-29 13:14:56 +10:00
Peter Hutterer
977588d24a If only IgnoreRelativeAxes is set, init like a normal relative device
In the current code, if only IgnoreRelativeAxes is set, the code would go on
and force absolute axes to initialize even if the relative axes were
successfully initialized.

Evdev gives precedence to relative axes anyway, initializing absolute axes if
the relative axes failed. Thus, if we explicitely want relative axes but leave
the abs axes as-is, proceed as normal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 10:02:00 +10:00
Peter Hutterer
291b60172d Fix axis initialization for devices with abs x/y and rel scrollwheels
The Xen Virtual Pointer device has ABS_X, ABS_Y and REL_WHEEL. If smooth
scrolling is detected, the current code would first initialize relative axes
for scrolling and immediately overwrite those axes when the abs valuators are
written out.

This patch fixes the default case only, in the case of a device setting the
two Ignore*Axis options both to "off", the axes are still overwritten. The
wheels will work, other axes only if the same number of abs axes exists. And
it keeps the current memory leak too, but it's marked with a FIXME now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 10:02:00 +10:00
Peter Hutterer
8ce06c96e4 Make the slot-state per slot
The previous approach only had the slot state for the current slot. If we
changed slots, that means we lost the information if the slot was ever
initialized. If the ABS_MT_TRACKING_ID was never received, the slot would
still update and try to send events (which the server refused with a warning).

Avoid this by having a per-slot state and a dirty bit that tells us if the
current slot updated at all. If we don't get the tracking ID, leave the slot
empty and refuse any further events from that touch.

This quashes the various "unable to find touch point 0" warnings caused if a
touchpoint starts before the device is enabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Walter Harms <wharms@bfs.de>
2014-08-18 10:01:47 +10:00
Peter Hutterer
5d239ceb26 evdev 2.9.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-20 15:41:08 +10:00
Peter Hutterer
13dea90bc8 Use the server's device list for duplicate detection (#78309)
EvdevAddDevice/EvdevRemoveDevice keep a reference to the device to detect
duplicate devices based on the dev_t.

EvdevAddDevices was called during PreInit, EvdevRemoveDevice was called during
DEVICE_CLOSE. That makes it imbalanced if the device succeeds PreInit but the
server skips everything else because MAX_DEVICES is exceeded. So for all
devices after MAX_DEVICES, we'd add a reference but never remove it,
eventually reading/writing past evdev_devices.

The server keeps the list of devices for us anyway, so remove the copy of all
the pointers and instead run through the device list the server gives us.

X.Org Bug 78309 <http://bugs.freedesktop.org/show_bug.cgi?id=78309>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-05-07 07:27:29 +10:00
Peter Hutterer
b25d716165 evdev 2.8.99.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-29 10:20:50 +10:00
Peter Hutterer
41cf9212d0 Map REL_DIAL to horizontal scrolling (#73105)
This was the original behavior introduced in
f77410e1f9 and stayed that way until smooth
scrolling erroneously added it as vertical axis in
b450efdf95. Revert to horizontal scrolling to
restore the previous behaviour - which unbreaks scrolling on Microsoft mice.

This effectively reverts 54a3120e33 too.

X.Org Bug 73105 <http://bugs.freedesktop.org/show_bug.cgi?id=73105>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-29 09:52:31 +10:00
Peter Hutterer
75368052b5 Revert "Map REL_DIAL to horizontal scrolling (#73105)"
Whoops, the vertical axis is swapped, so when changing the axis we also need
to change the direction.

This reverts commit 16c85cbeac.
2014-04-29 09:52:31 +10:00
Peter Hutterer
16c85cbeac Map REL_DIAL to horizontal scrolling (#73105)
This was the original behavior introduced in
f77410e1f9 and stayed that way until smooth
scrolling erroneously added it as vertical axis in
b450efdf95. Revert to horizontal scrolling to
restore the previous behaviour - which unbreaks scrolling on Microsoft mice.

This effectively reverts 54a3120e33 too.

X.Org Bug 73105 <http://bugs.freedesktop.org/show_bug.cgi?id=73105>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-29 09:39:12 +10:00
Hans de Goede
ae67f64f02 evdev: Add support for server managed fds
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-10 11:58:43 +10:00
Peter Hutterer
f6fcad8b10 Fix wheel emulation for absolute device (#68415)
wheel emulation, for some reasons beyond time, got the value from
pEvdev->vals, then set the value back into pEvdev->vals. Alas, that value is
always 0, hence oldValue is zero and the delta is nil.

If we're not in relative (touchpad) mode, store the current value in
old_vals, so they're retrievable for the next event.

X.Org Bug 68415 <http://bugs.freedesktop.org/show_bug.cgi?id=68415>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-22 13:59:46 +10:00
Peter De Wachter
d171b3d919 Export smooth scroll settings as an XInput property.
A new property "Evdev Scrolling Distance" is created that holds three values
(vertical, horizontal and dial).

Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-21 16:39:59 +10:00
Peter De Wachter
c3251deb4b Add configuration options for smooth scrolling.
This patch creates three new xorg.conf options, VertScrollDelta,
HorizScrollDelta and DialDelta, which adjust the sensitivity of
smooth scrolling. These options take a positive integer, default
value is 1.

Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-21 15:47:54 +10:00
Peter Hutterer
cabed4bbb6 Use num_slots where appropriate
This was supposed to be added in 43e270fb7a, but
got lost somehow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-14 11:49:29 +10:00
Peter Hutterer
a75c43830e Merge branch 'libevdev' 2013-10-07 09:22:09 +11:00
Peter Hutterer
d9aadfd5f0 bump to 2.8.99
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-07 09:21:57 +11:00
Peter De Wachter
54a3120e33 Map REL_DIAL to vertical scrolling
This makes the absolute axis codepath behave the same as the relative axis
path.

Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-07 09:21:07 +11:00
Peter Hutterer
164c62a975 Use libevdev as backend
Removes the need to ioctl manually and check bits, with all the dangers that
come with that. libevdev is much better prepared for invalid values, OOB
checks, etc.

Plus, we get almost free SYN_DROPPED handling as well which we didn't have
before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-04 16:19:19 +10:00
Peter Hutterer
43e270fb7a Use helper function for counting slots
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-09-10 15:06:38 +10:00
Peter Hutterer
4ca57716ca Drop ABS_MT_SLOT minimum - the kernel guarantees a minimum of 0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-09-10 15:04:40 +10:00
Peter Hutterer
0f16065b00 Remove a comment
This comment is now in the wrong place. It was moved when abs support for
wheel emulation was added but is now only confusing. Remove it altogether,
the code is quite obvious what it does.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-28 14:37:26 +10:00
Peter Hutterer
cae1478781 Don't use mtdev for protocol B devices
If a device has ABS_MT_SLOT, mtdev merely reads the events and returns them
to the caller as-is. For this we don't need mtdev, we can just handle those
events ourselves.

This patch switches to the mtdev plumbing layer that takes events and
converts them instead of reading them off the fd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-28 10:38:40 +10:00
Peter Hutterer
27926b3763 Write a SYN_REPORT after the last LED
When writing LED values to the device, append a SYN_REPORT to the list to
ensure other clients are updated immediately. Otherwise, the LED events
will be queued and not sent to other clients until the next input event
arrives.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2013-08-13 19:34:16 +10:00
17 changed files with 1084 additions and 741 deletions

106
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,106 @@
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
#
# This CI uses the freedesktop.org ci-templates.
# Please see the ci-templates documentation for details:
# https://freedesktop.pages.freedesktop.org/ci-templates/
.templates_sha: &template_sha 25e8e9f020880aa35fffe3d6b259b933f0f9449f # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include:
# Arch container builder template
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/arch.yml'
- project: 'freedesktop/ci-templates'
ref: *template_sha
file: '/templates/ci-fairy.yml'
- template: Security/SAST.gitlab-ci.yml
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
stages:
- prep # prep work like rebuilding the container images if there is a change
- build # for actually building and testing things in a container
- test
- deploy
variables:
FDO_UPSTREAM_REPO: 'xorg/driver/xf86-input-evdev'
# The tag should be updated each time the list of packages is updated.
# Changing a tag forces the associated image to be rebuilt.
# Note: the tag has no meaning, we use a date format purely for readability
FDO_DISTRIBUTION_TAG: '2023-10-01.0'
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make xorg-util-macros xorgproto xorg-server-devel pixman systemd-libs libevdev mtdev'
#
# Verify that commit messages are as expected
#
check-commits:
extends:
- .fdo.ci-fairy
stage: prep
script:
- ci-fairy check-commits --junit-xml=results.xml
except:
- master@xorg/driver/xf86-input-evdev
variables:
GIT_DEPTH: 100
artifacts:
reports:
junit: results.xml
#
# Verify that the merge request has the allow-collaboration checkbox ticked
#
check-merge-request:
extends:
- .fdo.ci-fairy
stage: deploy
script:
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
artifacts:
when: on_failure
reports:
junit: results.xml
allow_failure: true
#
# Build a container with the given tag and the packages pre-installed.
# This only happens if the tag changes, otherwise the existing image is
# re-used.
#
container-prep:
extends:
- .fdo.container-build@arch
stage: prep
variables:
GIT_STRATEGY: none
#
# The default build, runs on the image built above.
#
build:
stage: build
extends:
- .fdo.distribution-image@arch
script:
- autoreconf -ivf
- mkdir _builddir
- pushd _builddir > /dev/null
- ../configure --disable-silent-rules
- make
- make check
- make distcheck
- popd > /dev/null

40
10-evdev.conf Normal file
View File

@@ -0,0 +1,40 @@
#
# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.
Section "InputClass"
Identifier "evdev pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev tablet catchall"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection

View File

@@ -28,6 +28,7 @@ MAINTAINERCLEANFILES = ChangeLog INSTALL
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-evdev.pc pkgconfig_DATA = xorg-evdev.pc
dist_xorgconf_DATA = 10-evdev.conf
.PHONY: ChangeLog INSTALL .PHONY: ChangeLog INSTALL
@@ -38,3 +39,5 @@ ChangeLog:
$(CHANGELOG_CMD) $(CHANGELOG_CMD)
dist-hook: ChangeLog INSTALL dist-hook: ChangeLog INSTALL
EXTRA_DIST = README.md

20
README
View File

@@ -1,20 +0,0 @@
xf86-input-evdev - Generic Linux input driver for the Xorg X server
Please submit bugs & patches to the Xorg bugzilla:
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
All questions regarding this software should be directed at the
Xorg mailing list:
http://lists.freedesktop.org/mailman/listinfo/xorg
The master development code repository can be found at:
git://anongit.freedesktop.org/git/xorg/driver/xf86-input-evdev
http://cgit.freedesktop.org/xorg/driver/xf86-input-evdev
For more information on the git code manager, see:
http://wiki.x.org/wiki/GitPage

18
README.md Normal file
View File

@@ -0,0 +1,18 @@
xf86-input-evdev - Generic Linux input driver for the Xorg X server
-------------------------------------------------------------------
All questions regarding this software should be directed at the
Xorg mailing list:
https://lists.x.org/mailman/listinfo/xorg
The primary development code repository can be found at:
https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev
Please submit bug reports and requests to merge patches there.
For patch submission instructions, see:
https://www.x.org/wiki/Development/Documentation/SubmittingPatches

View File

@@ -1,14 +1,17 @@
#! /bin/sh #! /bin/sh
srcdir=`dirname $0` srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=. test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd` ORIGDIR=`pwd`
cd $srcdir cd "$srcdir"
autoreconf -v --install || exit 1 autoreconf -v --install || exit 1
cd $ORIGDIR || exit $? cd "$ORIGDIR" || exit $?
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
git config --local format.subjectPrefix "PATCH xf86-input-evdev"
if test -z "$NOCONFIGURE"; then if test -z "$NOCONFIGURE"; then
$srcdir/configure "$@" exec "$srcdir"/configure "$@"
fi fi

View File

@@ -23,15 +23,15 @@
# Initialize Autoconf # Initialize Autoconf
AC_PREREQ([2.60]) AC_PREREQ([2.60])
AC_INIT([xf86-input-evdev], AC_INIT([xf86-input-evdev],
[2.8.1], [2.11.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/issues],
[xf86-input-evdev]) [xf86-input-evdev])
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR(.) AC_CONFIG_AUX_DIR(.)
# Initialize Automake # Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_INIT_AUTOMAKE([foreign dist-xz])
# Initialize libtool # Initialize libtool
AC_DISABLE_STATIC AC_DISABLE_STATIC
@@ -44,18 +44,11 @@ XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS XORG_DEFAULT_OPTIONS
# Obtain compiler/linker options from server and required extensions # Obtain compiler/linker options from server and required extensions
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto) PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18] xproto [inputproto >= 2.1.99.3])
PKG_CHECK_MODULES(UDEV, libudev) PKG_CHECK_MODULES(UDEV, libudev, [AC_DEFINE(HAVE_LIBUDEV, 1,[libudev support])])
PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no") PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
PKG_CHECK_MODULES(MTDEV, mtdev)
if test "x$HAVE_XI22" = xyes; then
# Obtain compiler/linker options for mtdev
PKG_CHECK_MODULES(MTDEV, mtdev, HAVE_MTDEV="yes", HAVE_MTDEV="no")
fi
if test "x$HAVE_XI22" = xyes && test "x$HAVE_MTDEV" = xyes; then
AC_DEFINE(MULTITOUCH, 1, [XI2.2 available])
fi
# Define a configure option for an alternate input module directory # Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir, AC_ARG_WITH(xorg-module-dir,
@@ -66,6 +59,13 @@ AC_ARG_WITH(xorg-module-dir,
inputdir=${moduledir}/input inputdir=${moduledir}/input
AC_SUBST(inputdir) AC_SUBST(inputdir)
AC_ARG_WITH(xorg-conf-dir,
AC_HELP_STRING([--with-xorg-conf-dir=DIR],
[Default xorg.conf.d directory [[default=$prefix/share/X11/xorg.conf.d/]]]),
[xorgconfdir="$withval"],
[xorgconfdir="$prefix/share/X11/xorg.conf.d"])
AC_SUBST(xorgconfdir)
# X Server SDK location is required to install evdev header files # X Server SDK location is required to install evdev header files
# This location is also relayed in the xorg-evdev.pc file # This location is also relayed in the xorg-evdev.pc file
sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server` sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`

View File

@@ -33,6 +33,8 @@
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation" #define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
/* CARD32 */ /* CARD32 */
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout" #define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
/* CARD8 */
#define EVDEV_PROP_MIDBUTTON_BUTTON "Evdev Middle Button Button"
/* Wheel emulation */ /* Wheel emulation */
/* BOOL */ /* BOOL */
@@ -87,4 +89,8 @@
*/ */
#define EVDEV_PROP_FUNCTION_KEYS "Evdev Function Keys" #define EVDEV_PROP_FUNCTION_KEYS "Evdev Function Keys"
/* Smooth scroll */
/* INT32, 3 values (vertical, horizontal, dial) */
#define EVDEV_PROP_SCROLL_DISTANCE "Evdev Scrolling Distance"
#endif #endif

View File

@@ -94,6 +94,11 @@ Sets the timeout (in milliseconds) that the driver waits before deciding
if two buttons where pressed "simultaneously" when 3 button emulation is if two buttons where pressed "simultaneously" when 3 button emulation is
enabled. Default: 50. Property: "Evdev Middle Button Timeout". enabled. Default: 50. Property: "Evdev Middle Button Timeout".
.TP 7 .TP 7
.BI "Option \*qEmulate3Button\*q \*q" integer \*q
Specifies the physical button number to be emitted if middle button emulation
is triggered.
Default: 2. Property: "Evdev Middle Button Button".
.TP 7
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q .BI "Option \*qEmulateWheel\*q \*q" boolean \*q
Enable/disable "wheel" emulation. Wheel emulation means emulating button Enable/disable "wheel" emulation. Wheel emulation means emulating button
press/release events when the mouse is moved while a specific real button press/release events when the mouse is moved while a specific real button
@@ -125,6 +130,19 @@ Property: "Evdev Wheel Emulation Button".
Specifies how far (in pixels) the pointer must move to generate button Specifies how far (in pixels) the pointer must move to generate button
press/release events in wheel emulation mode. Default: 10. Property: "Evdev press/release events in wheel emulation mode. Default: 10. Property: "Evdev
Wheel Emulation Inertia". Wheel Emulation Inertia".
.IP
This value must be set for any device does not resemble a standard mouse.
Specifically, on absolute devices such as tablets the value should be set to
a reasonable fraction of the expected movement to avoid excess scroll events.
.IP
.B WARNING:
the name \*qinertia\*q is a misnomer. This option defines the distance
required to generate one scroll event similar to the
.B VertScrollDelta
and
.B HorizScrollDelta
options. It does not enable inertia in the
physical sense, scrolling stops immediately once the movement has stopped.
.TP 7 .TP 7
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q .BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
Specifies the time in milliseconds the Specifies the time in milliseconds the
@@ -176,7 +194,7 @@ Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q .BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q
Ignore the specified type of axis. Default: unset. The X server cannot deal Ignore the specified type of axis. Default: unset. The X server cannot deal
with devices that have both relative and absolute axes. Evdev tries to guess with devices that have both relative and absolute axes. Evdev tries to guess
wich axes to ignore given the device type and disables absolute axes for which axes to ignore given the device type and disables absolute axes for
mice and relative axes for tablets, touchscreens and touchpad. These options mice and relative axes for tablets, touchscreens and touchpad. These options
allow to forcibly disable an axis type. Mouse wheel axes are exempt and will allow to forcibly disable an axis type. Mouse wheel axes are exempt and will
work even if relative axes are ignored. No property, this configuration must work even if relative axes are ignored. No property, this configuration must
@@ -226,6 +244,24 @@ Specify the X Input 1.x type (see XListInputDevices(__libmansuffix__)).
There is rarely a need to use this option, evdev will guess the device type There is rarely a need to use this option, evdev will guess the device type
based on the device's capabilities. This option is provided for devices that based on the device's capabilities. This option is provided for devices that
need quirks. need quirks.
.TP 7
.BI "Option \*qVertScrollDelta\*q \*q" integer \*q
The amount of motion considered one unit of scrolling vertically.
Default: "1". Property: "Evdev Scrolling Distance".
.TP 7
.BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
The amount of motion considered one unit of scrolling horizontally.
Default: "1". Property: "Evdev Scrolling Distance".
.TP 7
.BI "Option \*qDialDelta\*q \*q" integer \*q
The amount of motion considered one unit of turning the dial. Default: "1".
Property: "Evdev Scrolling Distance".
.TP 7
.BI "Option \*qResolution\*q \*q" integer \*q
Sets the resolution of the device in dots per inch. The resolution is used
to scale relative motion events from mouse devices to 1000 DPI resolution. This
can be used to make high resolution mice less sensitive without turning off
acceleration. If set to 0 no scaling will be performed. Default: "0".
.SH SUPPORTED PROPERTIES .SH SUPPORTED PROPERTIES
The following properties are provided by the The following properties are provided by the
@@ -252,6 +288,9 @@ value.
.BI "Evdev Middle Button Timeout" .BI "Evdev Middle Button Timeout"
1 16-bit positive value. 1 16-bit positive value.
.TP 7 .TP 7
.BI "Evdev Middle Button Button"
1 8-bit value, allowed range 0-32, 0 disables the button.
.TP 7
.BI "Evdev Wheel Emulation" .BI "Evdev Wheel Emulation"
1 boolean value (8 bit, 0 or 1). 1 boolean value (8 bit, 0 or 1).
.TP 7 .TP 7
@@ -266,6 +305,9 @@ value.
.TP 7 .TP 7
.BI "Evdev Wheel Emulation Timeout" .BI "Evdev Wheel Emulation Timeout"
1 16-bit positive value. 1 16-bit positive value.
.TP 7
.BI "Evdev Scrolling Distance"
3 32-bit values: vertical, horizontal and dial.
.SH AUTHORS .SH AUTHORS
Kristian Høgsberg, Peter Hutterer Kristian Høgsberg, Peter Hutterer

View File

@@ -26,11 +26,11 @@
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS) AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
AM_CPPFLAGS =-I$(top_srcdir)/include AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS)
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version @DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
@DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS) @DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS) $(LIBEVDEV_LIBS)
@DRIVER_NAME@_drv_ladir = @inputdir@ @DRIVER_NAME@_drv_ladir = @inputdir@
@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \ @DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \

View File

@@ -303,7 +303,8 @@ EvdevAppleInitProperty(DeviceIntPtr dev)
enum fkeymode fkeymode; enum fkeymode fkeymode;
if (!product_check(apple_keyboard_table, if (!product_check(apple_keyboard_table,
pEvdev->id_vendor, pEvdev->id_product)) libevdev_get_id_vendor(pEvdev->dev),
libevdev_get_id_product(pEvdev->dev)))
return; return;
fkeymode = get_fnmode(); fkeymode = get_fnmode();

View File

@@ -5,7 +5,7 @@
* Copyright 1994-2002 by The XFree86 Project, Inc. * Copyright 1994-2002 by The XFree86 Project, Inc.
* Copyright 2002 by Paul Elliott * Copyright 2002 by Paul Elliott
* (Ported from xf86-input-mouse, above copyrights taken from there) * (Ported from xf86-input-mouse, above copyrights taken from there)
* Copyright © 2008 University of South Australia * Copyright © 2008 University of South Australia
* Copyright 2008 by Chris Salch * Copyright 2008 by Chris Salch
* Copyright 2008 Red Hat, Inc. * Copyright 2008 Red Hat, Inc.
* *

View File

@@ -45,6 +45,7 @@
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */ static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
static Atom prop_mbtimeout = 0; /* Middle button timeout property */ static Atom prop_mbtimeout = 0; /* Middle button timeout property */
static Atom prop_mbbuton = 0; /* Middle button target button property */
/* /*
* Lets create a simple finite-state machine for 3 button emulation: * Lets create a simple finite-state machine for 3 button emulation:
* *
@@ -184,14 +185,21 @@ int
EvdevMBEmuTimer(InputInfoPtr pInfo) EvdevMBEmuTimer(InputInfoPtr pInfo)
{ {
EvdevPtr pEvdev = pInfo->private; EvdevPtr pEvdev = pInfo->private;
int sigstate;
int id; int id;
int mapped_id;
sigstate = xf86BlockSIGIO (); #if HAVE_THREADED_INPUT
input_lock();
#else
int sigstate = xf86BlockSIGIO();
#endif
pEvdev->emulateMB.pending = FALSE; pEvdev->emulateMB.pending = FALSE;
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) { if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
EvdevPostButtonEvent(pInfo, abs(id), mapped_id = abs(id);
if (mapped_id == 2)
mapped_id = pEvdev->emulateMB.button;
EvdevPostButtonEvent(pInfo, mapped_id,
(id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE); (id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
pEvdev->emulateMB.state = pEvdev->emulateMB.state =
stateTab[pEvdev->emulateMB.state][4][2]; stateTab[pEvdev->emulateMB.state][4][2];
@@ -200,7 +208,11 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
pEvdev->emulateMB.state); pEvdev->emulateMB.state);
} }
xf86UnblockSIGIO (sigstate); #if HAVE_THREADED_INPUT
input_unlock();
#else
xf86UnblockSIGIO(sigstate);
#endif
return 0; return 0;
} }
@@ -219,6 +231,7 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
{ {
EvdevPtr pEvdev = pInfo->private; EvdevPtr pEvdev = pInfo->private;
int id; int id;
int mapped_id;
int *btstate; int *btstate;
int ret = FALSE; int ret = FALSE;
@@ -237,7 +250,10 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0) if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
{ {
EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0)); mapped_id = abs(id);
if (mapped_id == 2)
mapped_id = pEvdev->emulateMB.button;
EvdevQueueButtonEvent(pInfo, mapped_id, (id >= 0));
ret = TRUE; ret = TRUE;
} }
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0) if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
@@ -261,9 +277,7 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
} }
void EvdevMBEmuWakeupHandler(pointer data, void EvdevMBEmuWakeupHandler(WAKEUP_HANDLER_ARGS)
int i,
pointer LastSelectMask)
{ {
InputInfoPtr pInfo = (InputInfoPtr)data; InputInfoPtr pInfo = (InputInfoPtr)data;
EvdevPtr pEvdev = (EvdevPtr)pInfo->private; EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
@@ -277,9 +291,7 @@ void EvdevMBEmuWakeupHandler(pointer data,
} }
} }
void EvdevMBEmuBlockHandler(pointer data, void EvdevMBEmuBlockHandler(BLOCK_HANDLER_ARGS)
struct timeval **waitTime,
pointer LastSelectMask)
{ {
InputInfoPtr pInfo = (InputInfoPtr) data; InputInfoPtr pInfo = (InputInfoPtr) data;
EvdevPtr pEvdev= (EvdevPtr) pInfo->private; EvdevPtr pEvdev= (EvdevPtr) pInfo->private;
@@ -298,12 +310,23 @@ void
EvdevMBEmuPreInit(InputInfoPtr pInfo) EvdevMBEmuPreInit(InputInfoPtr pInfo)
{ {
EvdevPtr pEvdev = (EvdevPtr)pInfo->private; EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
int bt;
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options, pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
"Emulate3Buttons", "Emulate3Buttons",
FALSE); FALSE);
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options, pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
"Emulate3Timeout", 50); "Emulate3Timeout", 50);
bt = xf86SetIntOption(pInfo->options, "Emulate3Button", 2);
if (bt < 0 || bt > EVDEV_MAXBUTTONS) {
xf86IDrvMsg(pInfo, X_WARNING, "Invalid Emulate3Button value: %d\n",
bt);
xf86IDrvMsg(pInfo, X_WARNING, "Middle button emulation disabled.\n");
pEvdev->emulateMB.enabled = FALSE;
}
pEvdev->emulateMB.button = bt;
} }
void void
@@ -335,6 +358,7 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
{ {
InputInfoPtr pInfo = dev->public.devicePrivate; InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private; EvdevPtr pEvdev = pInfo->private;
int bt;
if (atom == prop_mbemu) if (atom == prop_mbemu)
{ {
@@ -350,6 +374,18 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
if (!checkonly) if (!checkonly)
pEvdev->emulateMB.timeout = *((CARD32*)val->data); pEvdev->emulateMB.timeout = *((CARD32*)val->data);
} else if (atom == prop_mbbuton)
{
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
bt = *((CARD8*)val->data);
if (bt < 0 || bt > EVDEV_MAXBUTTONS)
return BadValue;
if (!checkonly)
pEvdev->emulateMB.button = bt;
} }
return Success; return Success;
@@ -387,5 +423,15 @@ EvdevMBEmuInitProperty(DeviceIntPtr dev)
return; return;
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE); XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
prop_mbbuton = MakeAtom(EVDEV_PROP_MIDBUTTON_BUTTON,
strlen(EVDEV_PROP_MIDBUTTON_BUTTON),
TRUE);
rc = XIChangeDeviceProperty(dev, prop_mbbuton, XA_INTEGER, 8, PropModeReplace, 1,
&pEvdev->emulateMB.button, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_mbbuton, FALSE);
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL); XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
} }

View File

@@ -89,12 +89,19 @@ Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg)
InputInfoPtr pInfo = (InputInfoPtr)arg; InputInfoPtr pInfo = (InputInfoPtr)arg;
EvdevPtr pEvdev = pInfo->private; EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B; struct emulate3B *emu3B = &pEvdev->emulate3B;
int sigstate = 0;
sigstate = xf86BlockSIGIO (); #if HAVE_THREADED_INPUT
input_lock();
#else
int sigstate = xf86BlockSIGIO();
#endif
emu3B->state = EM3B_EMULATING; emu3B->state = EM3B_EMULATING;
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS); Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
xf86UnblockSIGIO (sigstate); #if HAVE_THREADED_INPUT
input_unlock();
#else
xf86UnblockSIGIO(sigstate);
#endif
return 0; return 0;
} }
@@ -229,8 +236,8 @@ Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
{ {
if (valuator_mask_isset(vals, axis)) if (valuator_mask_isset(vals, axis))
{ {
int delta = valuator_mask_get(vals, axis) - emu3B->startpos[axis]; double delta = valuator_mask_get_double(vals, axis) - emu3B->startpos[axis];
if (abs(delta) > emu3B->threshold) if (fabs(delta) > emu3B->threshold)
cancel = TRUE; cancel = TRUE;
} }
axis++; axis++;
@@ -248,7 +255,7 @@ Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
* emulation. * emulation.
*/ */
void void
Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy) Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy)
{ {
EvdevPtr pEvdev = pInfo->private; EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B; struct emulate3B *emu3B = &pEvdev->emulate3B;
@@ -260,8 +267,8 @@ Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy)
emu3B->delta[1] += dy; emu3B->delta[1] += dy;
emu3B->flags |= EVDEV_RELATIVE_EVENTS; emu3B->flags |= EVDEV_RELATIVE_EVENTS;
if (abs(emu3B->delta[0]) > emu3B->threshold || if (fabs(emu3B->delta[0]) > emu3B->threshold ||
abs(emu3B->delta[1]) > emu3B->threshold) fabs(emu3B->delta[1]) > emu3B->threshold)
{ {
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS); Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo); Evdev3BCancel(pInfo);

View File

@@ -50,7 +50,7 @@ static Atom prop_wheel_inertia = 0;
static Atom prop_wheel_timeout = 0; static Atom prop_wheel_timeout = 0;
static Atom prop_wheel_button = 0; static Atom prop_wheel_button = 0;
/* Local Funciton Prototypes */ /* Local Function Prototypes */
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value); static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
/* Filter mouse button events */ /* Filter mouse button events */
@@ -95,9 +95,8 @@ BOOL
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv) EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
{ {
EvdevPtr pEvdev = (EvdevPtr)pInfo->private; EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL; WheelAxisPtr pAxis = NULL;
int value = pEv->value; int value = pEv->value;
int oldValue;
/* Has wheel emulation been configured to be enabled? */ /* Has wheel emulation been configured to be enabled? */
if (!pEvdev->emulateWheel.enabled) if (!pEvdev->emulateWheel.enabled)
@@ -115,12 +114,15 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
return TRUE; return TRUE;
} }
/* We don't want to intercept real mouse wheel events */
if(pEv->type == EV_ABS) { if(pEv->type == EV_ABS) {
int axis = pEvdev->abs_axis_map[pEv->code]; int axis = pEvdev->abs_axis_map[pEv->code];
oldValue = valuator_mask_get(pEvdev->vals, axis); int oldValue;
valuator_mask_set(pEvdev->vals, axis, value);
value -= oldValue; /* make value into a differential measurement */ if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
valuator_mask_set(pEvdev->abs_vals, axis, value);
value -= oldValue; /* make value into a differential measurement */
} else
value = 0; /* avoid a jump on the first touch */
} }
switch(pEv->code) { switch(pEv->code) {
@@ -128,13 +130,11 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
/* ABS_X has the same value as REL_X, so this case catches both */ /* ABS_X has the same value as REL_X, so this case catches both */
case REL_X: case REL_X:
pAxis = &(pEvdev->emulateWheel.X); pAxis = &(pEvdev->emulateWheel.X);
pOtherAxis = &(pEvdev->emulateWheel.Y);
break; break;
/* ABS_Y has the same value as REL_Y, so this case catches both */ /* ABS_Y has the same value as REL_Y, so this case catches both */
case REL_Y: case REL_Y:
pAxis = &(pEvdev->emulateWheel.Y); pAxis = &(pEvdev->emulateWheel.Y);
pOtherAxis = &(pEvdev->emulateWheel.X);
break; break;
default: default:
@@ -142,15 +142,10 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
} }
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse /* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
wheel. Reset the inertia of the other axis when a scroll event wheel.
was sent to avoid the buildup of erroneous scroll events if the
user doesn't move in a perfectly straight line.
*/ */
if (pAxis) if (pAxis)
{ EvdevWheelEmuInertia(pInfo, pAxis, value);
if (EvdevWheelEmuInertia(pInfo, pAxis, value))
pOtherAxis->traveled_distance = 0;
}
/* Eat motion events while emulateWheel button pressed. */ /* Eat motion events while emulateWheel button pressed. */
return TRUE; return TRUE;

File diff suppressed because it is too large Load Diff

View File

@@ -36,16 +36,23 @@
#define EVDEV_H #define EVDEV_H
#include <linux/input.h> #include <linux/input.h>
#include <linux/types.h> #include <sys/types.h>
/* Tolerate prior #include <linux/input.h> */
#undef BUS_NONE
#undef BUS_PCI
#undef BUS_SBUS
#undef BUS_PLATFORM
#undef BUS_USB
#include <xorg-server.h> #include <xorg-server.h>
#include <xf86Xinput.h> #include <xf86Xinput.h>
#include <xf86_OSproc.h> #include <xf86_OSproc.h>
#include <xkbstr.h> #include <xkbstr.h>
#ifdef MULTITOUCH
#include <mtdev.h> #include <mtdev.h>
#endif
#include <libevdev/libevdev.h>
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */ #ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
#define EV_CNT (EV_MAX+1) #define EV_CNT (EV_MAX+1)
@@ -63,14 +70,22 @@
#define LED_CNT (LED_MAX+1) #define LED_CNT (LED_MAX+1)
#endif #endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
#define HAVE_SMOOTH_SCROLLING 1
#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
#define LogMessageVerbSigSafe xf86MsgVerb #define LogMessageVerbSigSafe xf86MsgVerb
#endif #endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
#define HAVE_THREADED_INPUT 1
#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 24
#define BLOCK_HANDLER_ARGS void *data, void *waitTime
#define WAKEUP_HANDLER_ARGS void *data, int i
#else
#define BLOCK_HANDLER_ARGS pointer data, struct timeval **waitTime, pointer LastSelectMask
#define WAKEUP_HANDLER_ARGS void *data, int i, pointer LastSelectMask
#endif
#define EVDEV_MAXBUTTONS 32 #define EVDEV_MAXBUTTONS 32
#define EVDEV_MAXQUEUE 32 #define EVDEV_MAXQUEUE 32
@@ -101,6 +116,8 @@
/* Number of longs needed to hold the given number of bits */ /* Number of longs needed to hold the given number of bits */
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS) #define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
#define DEFAULT_MOUSE_DPI 1000.0
/* Function key mode */ /* Function key mode */
enum fkeymode { enum fkeymode {
FKEYMODE_UNKNOWN = 0, FKEYMODE_UNKNOWN = 0,
@@ -133,25 +150,18 @@ typedef struct {
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */ EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
EV_QUEUE_BTN, /* xf86PostButtonEvent() */ EV_QUEUE_BTN, /* xf86PostButtonEvent() */
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */ EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
#ifdef MULTITOUCH
EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */ EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */
#endif
} type; } type;
union { union {
int key; /* May be either a key code or button number. */ int key; /* May be either a key code or button number. */
#ifdef MULTITOUCH
unsigned int touch; /* Touch ID */ unsigned int touch; /* Touch ID */
#endif
} detail; } detail;
int val; /* State of the key/button/touch; pressed or released. */ int val; /* State of the key/button/touch; pressed or released. */
#ifdef MULTITOUCH
ValuatorMask *touchMask; ValuatorMask *touchMask;
#endif
} EventQueueRec, *EventQueuePtr; } EventQueueRec, *EventQueuePtr;
typedef struct { typedef struct {
unsigned short id_vendor; struct libevdev *dev;
unsigned short id_product;
char *device; char *device;
int grabDevice; /* grab the event device? */ int grabDevice; /* grab the event device? */
@@ -160,16 +170,19 @@ typedef struct {
int num_mt_vals; /* number of multitouch valuators */ int num_mt_vals; /* number of multitouch valuators */
int abs_axis_map[ABS_CNT]; /* Map evdev ABS_* to index */ int abs_axis_map[ABS_CNT]; /* Map evdev ABS_* to index */
int rel_axis_map[REL_CNT]; /* Map evdev REL_* to index */ int rel_axis_map[REL_CNT]; /* Map evdev REL_* to index */
ValuatorMask *vals; /* new values coming in */ ValuatorMask *abs_vals; /* values for absolute axis */
ValuatorMask *old_vals; /* old values for calculating relative motion */ ValuatorMask *rel_vals; /* values for relative axis */
ValuatorMask *prox; /* last values set while not in proximity */ ValuatorMask *old_vals; /* old absolute values for calculating relative motion */
ValuatorMask *prox; /* last absolute values set while not in proximity */
ValuatorMask *mt_mask; ValuatorMask *mt_mask;
ValuatorMask **last_mt_vals; ValuatorMask **last_mt_vals;
int cur_slot; int cur_slot;
enum SlotState slot_state; struct slot {
#ifdef MULTITOUCH int dirty;
enum SlotState state;
} *slots;
struct mtdev *mtdev; struct mtdev *mtdev;
#endif BOOL fake_mt;
int flags; int flags;
int in_proximity; /* device in proximity */ int in_proximity; /* device in proximity */
@@ -178,8 +191,8 @@ typedef struct {
BOOL swap_axes; BOOL swap_axes;
BOOL invert_x; BOOL invert_x;
BOOL invert_y; BOOL invert_y;
int resolution;
int delta[REL_CNT];
unsigned int abs_queued, rel_queued, prox_queued; unsigned int abs_queued, rel_queued, prox_queued;
/* Middle mouse button emulation */ /* Middle mouse button emulation */
@@ -190,6 +203,7 @@ typedef struct {
int state; /* state machine (see bt3emu.c) */ int state; /* state machine (see bt3emu.c) */
Time expires; /* time of expiry */ Time expires; /* time of expiry */
Time timeout; Time timeout;
uint8_t button; /* phys button to emit */
} emulateMB; } emulateMB;
/* Third mouse button emulation */ /* Third mouse button emulation */
struct emulate3B { struct emulate3B {
@@ -200,7 +214,7 @@ typedef struct {
int button; /* phys button to emit */ int button; /* phys button to emit */
int threshold; /* move threshold in dev coords */ int threshold; /* move threshold in dev coords */
OsTimerPtr timer; OsTimerPtr timer;
int delta[2]; /* delta x/y, accumulating */ double delta[2]; /* delta x/y, accumulating */
int startpos[2]; /* starting pos for abs devices */ int startpos[2]; /* starting pos for abs devices */
int flags; /* remember if we had rel or abs movement */ int flags; /* remember if we had rel or abs movement */
} emulate3B; } emulate3B;
@@ -220,6 +234,11 @@ typedef struct {
Time expires; /* time of expiry */ Time expires; /* time of expiry */
Time timeout; Time timeout;
} emulateWheel; } emulateWheel;
struct {
int vert_delta;
int horiz_delta;
int dial_delta;
} smoothScroll;
/* run-time calibration */ /* run-time calibration */
struct { struct {
int min_x; int min_x;
@@ -234,13 +253,6 @@ typedef struct {
int reopen_left; /* number of attempts left to re-open the device */ int reopen_left; /* number of attempts left to re-open the device */
OsTimerPtr reopen_timer; OsTimerPtr reopen_timer;
/* Cached info from device. */
unsigned long bitmask[NLONGS(EV_CNT)];
unsigned long key_bitmask[NLONGS(KEY_CNT)];
unsigned long rel_bitmask[NLONGS(REL_CNT)];
unsigned long abs_bitmask[NLONGS(ABS_CNT)];
struct input_absinfo absinfo[ABS_CNT];
/* minor/major number */ /* minor/major number */
dev_t min_maj; dev_t min_maj;
@@ -257,23 +269,19 @@ typedef struct {
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value); void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value); void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value); void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
#ifdef MULTITOUCH
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
ValuatorMask *mask, uint16_t type); ValuatorMask *mask, uint16_t type);
#endif
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act); void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count); void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v, void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo);
int v[MAX_VALUATORS]); void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo);
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS]);
unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code); unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);
/* Middle Button emulation */ /* Middle Button emulation */
int EvdevMBEmuTimer(InputInfoPtr); int EvdevMBEmuTimer(InputInfoPtr);
BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL); BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
void EvdevMBEmuWakeupHandler(pointer, int, pointer); void EvdevMBEmuWakeupHandler(WAKEUP_HANDLER_ARGS);
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer); void EvdevMBEmuBlockHandler(BLOCK_HANDLER_ARGS);
void EvdevMBEmuPreInit(InputInfoPtr); void EvdevMBEmuPreInit(InputInfoPtr);
void EvdevMBEmuOn(InputInfoPtr); void EvdevMBEmuOn(InputInfoPtr);
void EvdevMBEmuFinalize(InputInfoPtr); void EvdevMBEmuFinalize(InputInfoPtr);
@@ -284,7 +292,7 @@ BOOL Evdev3BEmuFilterEvent(InputInfoPtr, int, BOOL);
void Evdev3BEmuPreInit(InputInfoPtr pInfo); void Evdev3BEmuPreInit(InputInfoPtr pInfo);
void Evdev3BEmuOn(InputInfoPtr); void Evdev3BEmuOn(InputInfoPtr);
void Evdev3BEmuFinalize(InputInfoPtr); void Evdev3BEmuFinalize(InputInfoPtr);
void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy); void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy);
void Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals); void Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals);
/* Mouse Wheel emulation */ /* Mouse Wheel emulation */