Compare commits

..

30 Commits

Author SHA1 Message Date
Peter Hutterer
1c5ad6f8a0 evdev 2.5.99.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-08 12:40:49 +10:00
Peter Hutterer
6fd1d0860e Return error codes from EvdevOpenDevice()
The server's behaviour is to stop adding new devices when a BadAlloc occurs
on any device (on the assumption that new devices won't magically have more
memory). Change EvdevOpenDevice() to return an error code of BadValue when
it fails (and thus to the server) to prevent other devices being ignored
because of one misconfigured one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-12-07 08:05:42 +10:00
Peter Hutterer
31ba99e9ed evdev 2.5.99.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-19 15:03:33 +10:00
Peter Hutterer
a4aefca2ed Reshuffle to avoid the need for XI86_CONFIGURED.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-28 13:11:56 +10:00
Peter Hutterer
20d7a0a4aa Input API 12 requires a valuator mode for each axis.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-27 08:32:21 +10:00
Nikolai Kondrashov
5e26ba8641 Extend button mapping to full ranges
Extend button code to number mapping to cover full BTN_MOUSE and BTN_MISC
ranges, including undefined codes.

This extends mapping introduced with 0367e387 to the following:

        1       BTN_LEFT        BTN_0       BTN_TOUCH
        2       BTN_MIDDLE      BTN_1       BTN_STYLUS
        3       BTN_RIGHT       BTN_2       BTN_STYLUS2

        8       BTN_SIDE        BTN_3
        9       BTN_EXTRA       BTN_4
        10      BTN_FORWARD     BTN_5
        11      BTN_BACK        BTN_6
        12      BTN_TASK        BTN_7
        13      0x118           BTN_8
        14      0x119           BTN_9
        15      0x11A           0x10A
        16      0x11B           0x10B
        17      0x11C           0x10C
        18      0x11D           0x10D
        19      0x11E           0x10E
        20      0x11F           0x10F

This should fix https://bugs.freedesktop.org/show_bug.cgi?id=30336

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-22 07:52:48 +10:00
Peter Hutterer
71dd18f728 Rename CountBits to EvdevCountBits.
Avoid name collision with the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-21 08:13:25 +10:00
Peter Hutterer
c3e49f2b95 Use an array for the proximity bits.
Instead of two lists that need to be kept in sync, just store the bits in an
array and run through them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-10-21 08:12:44 +10:00
Peter Hutterer
b06d3ffdcd Rename abs/rel/prox to abs_queued/rel_queued/prox_queued.
Mainly to avoid confusing between pEvdev->prox and pEvdev->proximity and to
better express what these fields are actually holding.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-10-21 08:12:38 +10:00
Benjamin Tissoires
3646371eef Add the names of the valuators for the multitouch properties
Thoses definitions have been included in the kernel and in the X server.
However, the evdev driver has not been updated accordingly.

Without these definitions, the multitouch axes are not correctly labelled.

Signed-off-by: Benjamin Tissoires <tissoire@cena.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-18 10:00:54 +10:00
Peter Hutterer
b48f4c41c0 Add proximity support.
When one of the tools comes into proximity, queue up a proximity event and
send it accordingly.

Includes special handling for tablets that do not send axes with tools
(#29645)

Some tablets send axis values, then EV_SYN, and in the next event the
BTN_TOOL_PEN/BTN_TOUCH, etc. For these tablets, the cursor doesn't move as
coordinates while not in proximity are ignored.

Buffer coordinates received while out-of-proximity and if we get a proximity
event without other coordinates, re-use the last ones received.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-18 09:54:42 +10:00
Peter Hutterer
185ad42078 Rename evdev->tool to evdev->proximity.
evdev doesn't care about the actual tool used, only that it is used as an
indicator for proximity. Rename the field accordingly to make the code more
obvious to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
2010-10-13 11:01:12 +10:00
Peter Hutterer
7282e3ac6c When posting buttons, post absolute valuators if we have them.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:47:47 +10:00
Peter Hutterer
c504852aa2 Fix valuator offset when posting absolute motion events.
If first_v was not zero, the values passed to xf86PostMotionEventP were
wrong.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:46:51 +10:00
Peter Hutterer
4bbf9c9125 Don't pass pointers around to first_v and num_v.
We only use them as values, no need for the addresses.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:46:09 +10:00
Peter Hutterer
684426a9d2 De-duplicate event queue access.
Factor out access to the next queue element in a static function to be
reused for button and key presses.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:44:26 +10:00
Peter Hutterer
9664e5a487 Remove refcnt initialization from InputDriverRec.
Removed from the server with
commit 6130170e7e9b64c611ee942ec3455dd1a185193d
Author: Adam Jackson <ajax@redhat.com>
Date:   Sat Sep 18 06:41:35 2010 -0400

    xfree86: Remove unused refcounting from input drivers

And given that it was unused, we don't need to ifdef it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-11 07:52:14 +10:00
Nikolai Kondrashov
0367e3871f Clean up button code to number mapping
Now BTN_MOUSE, BTN_MISC and BTN_DIGI button ranges are all mapped to the
same lower numbers including first three, corresponding to the LMR mouse
buttons. Like this:

    1       BTN_LEFT        BTN_0       BTN_TOUCH
    2       BTN_MIDDLE      BTN_1       BTN_STYLUS
    3       BTN_RIGHT       BTN_2       BTN_STYLUS2

    8       BTN_SIDE        BTN_3
    9       BTN_EXTRA       BTN_4
    10      BTN_FORWARD     BTN_5
    11      BTN_BACK        BTN_6
    12      BTN_TASK        BTN_7
    13                      BTN_8
    14                      BTN_9

This streamlines the button mapping under the assumption that these ranges
don't generally appear in a single device simultaneously. If they do appear,
they will simply report overlapping button numbers.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-07 10:40:36 +10:00
Nikolai Kondrashov
617a09e298 Add BTN_TOUCH/STYLUS/STYLUS2 support.
These three buttons are mapped into buttons 1/2/3, respectively.
Overlapping range with BTN_LEFT/MIDDLE/RIGHT, assuming that these
ranges don't generally appear in a single device simultaneously.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-07 10:38:20 +10:00
Tim Yamin
b83515485b SwapAxes should rescale raw values when enabled
Current implementation assumes that X & Y axes have the same min and max
values. If they don't, you'll end up with funny behaviour if SwapAxes is
turned on.

Signed-off-by: Tim Yamin <plasm@roo.me.uk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-07 10:31:02 +10:00
Peter Hutterer
009d442aa3 Merge branch 'input-api' of git://people.freedesktop.org/~whot/xf86-input-evdev 2010-09-01 13:04:29 +10:00
Nikolai Kondrashov
10493de96e Improve dumb tablet detection
Improve dumb tablet detection by checking if BTN_STYLUS or BTN_STYLUS2
(first or second pen barrel button) is present when BTN_TOOL_PEN is not
found.

This enables detection of tablets without explicit tool proximity reporting.
These include at least four UC-Logic tablet models: WP4030U, WP5540U,
WP8060U and PF1209, on which many Genius and Trust models are based.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-01 12:48:04 +10:00
Peter Hutterer
829facd516 Bump to 2.5.99.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-31 14:21:53 +10:00
Nikolai Kondrashov
fbafe59420 Fix comments about BTN_TOOL_PEN.
Fix incorrect usage of BTN_DIGI instead of BTN_TOOL_PEN in comments.
Fix forgotten pEvdev->digi reference.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-31 14:21:39 +10:00
Peter Hutterer
4964c61f4b Return BadMatch for already configured devices.
PreInit can now return different error codes. Return BadAlloc for alloc
failures and BadMatch if the device was already configured or the cache
comparison/probe failed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 13:26:40 +10:00
Peter Hutterer
92e8dc4961 Use the new input API (changed PreInit function prototype).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 13:26:38 +10:00
Peter Hutterer
e0e4b7d89b Move private init down.
No real change, preparation for new input API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
Peter Hutterer
d2c11d36a0 Use pInfo->options instead of dev->commonOptions.
No real change, preparation for new input API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
Peter Hutterer
2f636402d8 Add ifdefs for pre ABI 12 support.
The server doesn't provide these defines anymore, define them here for
future use. To be purged whenever we drop support for the current server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
Peter Hutterer
3d3565c069 Remove usage of XI86_POINTER_CAPABLE and XI86_KEYBOARD_CAPABLE.
XI86_KEYBOARD_CAPABLE was write-only, both in the driver and the server.
XI86_POINTER_CAPABLE was write-only in the server and can be emulated with
has_abs_axes and has_rel_axes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
3 changed files with 352 additions and 194 deletions

View File

@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-evdev],
[2.5.0],
[2.5.99.902],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-input-evdev])
AC_CONFIG_SRCDIR([Makefile.am])

View File

@@ -61,6 +61,11 @@
#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
/* removed from server, purge when dropping support for server 1.10 */
#define XI86_SEND_DRAG_EVENTS 0x08
#endif
#ifndef MAXDEVICES
#include <inputstr.h> /* for MAX_DEVICES */
#define MAXDEVICES MAX_DEVICES
@@ -82,20 +87,32 @@
#define MODEFLAG 8
#define COMPOSEFLAG 16
static const char *evdevDefaults[] = {
static char *evdevDefaults[] = {
"XkbRules", "evdev",
"XkbModel", "evdev",
"XkbLayout", "us",
NULL
};
/* Any of those triggers a proximity event */
static int proximity_bits[] = {
BTN_TOOL_PEN,
BTN_TOOL_RUBBER,
BTN_TOOL_BRUSH,
BTN_TOOL_PENCIL,
BTN_TOOL_AIRBRUSH,
BTN_TOOL_FINGER,
BTN_TOOL_MOUSE,
BTN_TOOL_LENS,
};
static int EvdevOn(DeviceIntPtr);
static int EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare);
static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode);
static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab);
static void EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]);
static BOOL EvdevOpenDevice(InputInfoPtr pInfo);
static int EvdevOpenDevice(InputInfoPtr pInfo);
#ifdef HAVE_PROPERTIES
static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
@@ -147,7 +164,7 @@ static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
return Success;
}
static size_t CountBits(unsigned long *array, size_t nlongs)
static size_t EvdevCountBits(unsigned long *array, size_t nlongs)
{
unsigned int i;
size_t count = 0;
@@ -262,12 +279,26 @@ static int wheel_down_button = 5;
static int wheel_left_button = 6;
static int wheel_right_button = 7;
static EventQueuePtr
EvdevNextInQueue(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
if (pEvdev->num_queue >= EVDEV_MAXQUEUE)
{
xf86Msg(X_NONE, "%s: dropping event due to full queue!\n", pInfo->name);
return NULL;
}
pEvdev->num_queue++;
return &pEvdev->queue[pEvdev->num_queue - 1];
}
void
EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
{
int code = ev->code + MIN_KEYCODE;
EventQueuePtr pQueue;
EvdevPtr pEvdev = pInfo->private;
/* Filter all repeated events from device.
We'll do softrepeat in the server, but only since 1.6 */
@@ -283,36 +314,37 @@ EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
)
return;
if (pEvdev->num_queue >= EVDEV_MAXQUEUE)
if ((pQueue = EvdevNextInQueue(pInfo)))
{
xf86Msg(X_NONE, "%s: dropping event due to full queue!\n", pInfo->name);
return;
pQueue->type = EV_QUEUE_KEY;
pQueue->key = code;
pQueue->val = value;
}
pQueue = &pEvdev->queue[pEvdev->num_queue];
pQueue->type = EV_QUEUE_KEY;
pQueue->key = code;
pQueue->val = value;
pEvdev->num_queue++;
}
void
EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value)
{
EventQueuePtr pQueue;
EvdevPtr pEvdev = pInfo->private;
if (pEvdev->num_queue >= EVDEV_MAXQUEUE)
if ((pQueue = EvdevNextInQueue(pInfo)))
{
xf86Msg(X_NONE, "%s: dropping event due to full queue!\n", pInfo->name);
return;
pQueue->type = EV_QUEUE_BTN;
pQueue->key = button;
pQueue->val = value;
}
}
pQueue = &pEvdev->queue[pEvdev->num_queue];
pQueue->type = EV_QUEUE_BTN;
pQueue->key = button;
pQueue->val = value;
pEvdev->num_queue++;
void
EvdevQueueProximityEvent(InputInfoPtr pInfo, int value)
{
EventQueuePtr pQueue;
if ((pQueue = EvdevNextInQueue(pInfo)))
{
pQueue->type = EV_QUEUE_PROXIMITY;
pQueue->key = 0;
pQueue->val = value;
}
}
/**
@@ -352,24 +384,24 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
*num_v = *first_v = 0;
/* convert to relative motion for touchpads */
if (pEvdev->abs && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
if (pEvdev->tool) { /* meaning, touch is active */
if (pEvdev->abs_queued && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
if (pEvdev->proximity) {
if (pEvdev->old_vals[0] != -1)
pEvdev->delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
if (pEvdev->old_vals[1] != -1)
pEvdev->delta[REL_Y] = pEvdev->vals[1] - pEvdev->old_vals[1];
if (pEvdev->abs & ABS_X_VALUE)
if (pEvdev->abs_queued & ABS_X_VALUE)
pEvdev->old_vals[0] = pEvdev->vals[0];
if (pEvdev->abs & ABS_Y_VALUE)
if (pEvdev->abs_queued & ABS_Y_VALUE)
pEvdev->old_vals[1] = pEvdev->vals[1];
} else {
pEvdev->old_vals[0] = pEvdev->old_vals[1] = -1;
}
pEvdev->abs = 0;
pEvdev->rel = 1;
pEvdev->abs_queued = 0;
pEvdev->rel_queued = 1;
}
if (pEvdev->rel) {
if (pEvdev->rel_queued) {
int first = REL_CNT, last = 0;
int i;
@@ -400,21 +432,29 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
*first_v = first;
}
/*
* Some devices only generate valid abs coords when BTN_DIGI is
* Some devices only generate valid abs coords when BTN_TOOL_PEN is
* pressed. On wacom tablets, this means that the pen is in
* proximity of the tablet. After the pen is removed, BTN_DIGI is
* proximity of the tablet. After the pen is removed, BTN_TOOL_PEN is
* released, and a (0, 0) absolute event is generated. Checking
* pEvdev->digi here, lets us ignore that event. pEvdev is
* pEvdev->proximity here lets us ignore that event. pEvdev is
* initialized to 1 so devices that doesn't use this scheme still
* just works.
*/
else if (pEvdev->abs && pEvdev->tool) {
else if (pEvdev->abs_queued && pEvdev->proximity) {
memcpy(v, pEvdev->vals, sizeof(int) * pEvdev->num_vals);
if (pEvdev->swap_axes) {
int tmp = v[0];
v[0] = v[1];
v[1] = tmp;
v[0] = xf86ScaleAxis(v[1],
pEvdev->absinfo[ABS_X].maximum,
pEvdev->absinfo[ABS_X].minimum,
pEvdev->absinfo[ABS_Y].maximum,
pEvdev->absinfo[ABS_Y].minimum);
v[1] = xf86ScaleAxis(tmp,
pEvdev->absinfo[ABS_Y].maximum,
pEvdev->absinfo[ABS_Y].minimum,
pEvdev->absinfo[ABS_X].maximum,
pEvdev->absinfo[ABS_X].minimum);
}
if (pEvdev->flags & EVDEV_CALIBRATED)
@@ -441,6 +481,70 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
}
}
static void
EvdevProcessProximityEvent(InputInfoPtr pInfo, struct input_event *ev)
{
EvdevPtr pEvdev = pInfo->private;
pEvdev->prox_queued = 1;
EvdevQueueProximityEvent(pInfo, ev->value);
}
/**
* Proximity handling is rather weird because of tablet-specific issues.
* Some tablets, notably Wacoms, send a 0/0 coordinate in the same EV_SYN as
* the out-of-proximity notify. We need to ignore those, hence we only
* actually post valuator events when we're in proximity.
*
* Other tablets send the x/y coordinates, then EV_SYN, then the proximity
* event. For those, we need to remember x/y to post it when the proximity
* comes.
*
* If we're not in proximity and we get valuator events, remember that, they
* won't be posted though. If we move into proximity without valuators, use
* the last ones we got and let the rest of the code post them.
*/
static int
EvdevProcessProximityState(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
int prox_state = 0;
int i;
/* no proximity change in the queue */
if (!pEvdev->prox_queued)
{
if (pEvdev->abs_queued && !pEvdev->proximity)
pEvdev->abs_prox = pEvdev->abs_queued;
return 0;
}
for (i = 0; i < pEvdev->num_queue; i++)
{
if (pEvdev->queue[i].type == EV_QUEUE_PROXIMITY)
{
prox_state = pEvdev->queue[i].val;
break;
}
}
if ((prox_state && !pEvdev->proximity) ||
(!prox_state && pEvdev->proximity))
{
/* We're about to go into/out of proximity but have no abs events
* within the EV_SYN. Use the last coordinates we have. */
if (!pEvdev->abs_queued && pEvdev->abs_prox)
{
pEvdev->abs_queued = pEvdev->abs_prox;
pEvdev->abs_prox = 0;
}
}
pEvdev->proximity = prox_state;
return 1;
}
/**
* Take a button input event and process it accordingly.
*/
@@ -510,7 +614,7 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
if (EvdevWheelEmuFilterMotion(pInfo, ev))
return;
pEvdev->rel = 1;
pEvdev->rel_queued = 1;
pEvdev->delta[ev->code] += value;
break;
}
@@ -540,11 +644,11 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
if (ev->code == ABS_X)
pEvdev->abs |= ABS_X_VALUE;
pEvdev->abs_queued |= ABS_X_VALUE;
else if (ev->code == ABS_Y)
pEvdev->abs |= ABS_Y_VALUE;
pEvdev->abs_queued |= ABS_Y_VALUE;
else
pEvdev->abs |= ABS_VALUE;
pEvdev->abs_queued |= ABS_VALUE;
}
/**
@@ -553,7 +657,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
static void
EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
{
int value;
int value, i;
EvdevPtr pEvdev = pInfo->private;
/* Get the signed value, earlier kernels had this as unsigned */
@@ -564,18 +668,16 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
if (value == 2)
return;
switch (ev->code) {
case BTN_TOOL_PEN:
case BTN_TOOL_RUBBER:
case BTN_TOOL_BRUSH:
case BTN_TOOL_PENCIL:
case BTN_TOOL_AIRBRUSH:
case BTN_TOOL_FINGER:
case BTN_TOOL_MOUSE:
case BTN_TOOL_LENS:
pEvdev->tool = value ? ev->code : 0;
break;
for (i = 0; i < ArrayLength(proximity_bits); i++)
{
if (ev->code == proximity_bits[i])
{
EvdevProcessProximityEvent(pInfo, ev);
return;
}
}
switch (ev->code) {
case BTN_TOUCH:
if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET)))
break;
@@ -594,13 +696,13 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
* Post the relative motion events.
*/
void
EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS])
{
EvdevPtr pEvdev = pInfo->private;
if (pEvdev->rel) {
xf86PostMotionEventP(pInfo->dev, FALSE, *first_v, *num_v, v + *first_v);
if (pEvdev->rel_queued) {
xf86PostMotionEventP(pInfo->dev, FALSE, first_v, num_v, v + first_v);
}
}
@@ -608,29 +710,50 @@ EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
* Post the absolute motion events.
*/
void
EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS])
{
EvdevPtr pEvdev = pInfo->private;
/*
* Some devices only generate valid abs coords when BTN_DIGI is
* Some devices only generate valid abs coords when BTN_TOOL_PEN is
* pressed. On wacom tablets, this means that the pen is in
* proximity of the tablet. After the pen is removed, BTN_DIGI is
* proximity of the tablet. After the pen is removed, BTN_TOOL_PEN is
* released, and a (0, 0) absolute event is generated. Checking
* pEvdev->tool here, lets us ignore that event. pEvdev->tool is
* pEvdev->proximity here lets us ignore that event. pEvdev->proximity is
* initialized to 1 so devices that don't use this scheme still
* just work.
*/
if (pEvdev->abs && pEvdev->tool) {
xf86PostMotionEventP(pInfo->dev, TRUE, *first_v, *num_v, v);
if (pEvdev->abs_queued && pEvdev->proximity) {
xf86PostMotionEventP(pInfo->dev, TRUE, first_v, num_v, v + first_v);
}
}
static void
EvdevPostProximityEvents(InputInfoPtr pInfo, int which, int num_v, int first_v,
int v[MAX_VALUATORS])
{
int i;
EvdevPtr pEvdev = pInfo->private;
for (i = 0; pEvdev->prox_queued && i < pEvdev->num_queue; i++) {
switch (pEvdev->queue[i].type) {
case EV_QUEUE_KEY:
case EV_QUEUE_BTN:
break;
case EV_QUEUE_PROXIMITY:
if (pEvdev->queue[i].val == which)
xf86PostProximityEventP(pInfo->dev, which, first_v, num_v,
v + first_v);
break;
}
}
}
/**
* Post the queued key/button events.
*/
static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS])
{
int i;
@@ -643,11 +766,18 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
pEvdev->queue[i].val);
break;
case EV_QUEUE_BTN:
/* FIXME: Add xf86PostButtonEventP to the X server so that we may
* pass the valuators on ButtonPress/Release events, too. Currently
* only MotionNotify events contain the pointer position. */
xf86PostButtonEvent(pInfo->dev, 0, pEvdev->queue[i].key,
pEvdev->queue[i].val, 0, 0);
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 11
if (pEvdev->abs_queued && pEvdev->proximity) {
xf86PostButtonEventP(pInfo->dev, 1, pEvdev->queue[i].key,
pEvdev->queue[i].val, first_v, num_v,
v + first_v);
} else
#endif
xf86PostButtonEvent(pInfo->dev, 0, pEvdev->queue[i].key,
pEvdev->queue[i].val, 0, 0);
break;
case EV_QUEUE_PROXIMITY:
break;
}
}
@@ -664,17 +794,23 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
int v[MAX_VALUATORS] = {};
EvdevPtr pEvdev = pInfo->private;
EvdevProcessProximityState(pInfo);
EvdevProcessValuators(pInfo, v, &num_v, &first_v);
EvdevPostRelativeMotionEvents(pInfo, &num_v, &first_v, v);
EvdevPostAbsoluteMotionEvents(pInfo, &num_v, &first_v, v);
EvdevPostQueuedEvents(pInfo, &num_v, &first_v, v);
EvdevPostProximityEvents(pInfo, TRUE, num_v, first_v, v);
EvdevPostRelativeMotionEvents(pInfo, num_v, first_v, v);
EvdevPostAbsoluteMotionEvents(pInfo, num_v, first_v, v);
EvdevPostQueuedEvents(pInfo, num_v, first_v, v);
EvdevPostProximityEvents(pInfo, FALSE, num_v, first_v, v);
memset(pEvdev->delta, 0, sizeof(pEvdev->delta));
memset(pEvdev->queue, 0, sizeof(pEvdev->queue));
pEvdev->num_queue = 0;
pEvdev->abs = 0;
pEvdev->rel = 0;
pEvdev->abs_queued = 0;
pEvdev->rel_queued = 0;
pEvdev->prox_queued = 0;
}
/**
@@ -1126,8 +1262,6 @@ EvdevAddKeyClass(DeviceIntPtr device)
#endif
pInfo->flags |= XI86_KEYBOARD_CAPABLE;
return Success;
}
@@ -1145,7 +1279,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
if (!TestBit(EV_ABS, pEvdev->bitmask))
return !Success;
num_axes = CountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX));
num_axes = EvdevCountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX));
if (num_axes < 1)
return !Success;
@@ -1198,32 +1332,29 @@ EvdevAddAbsClass(DeviceIntPtr device)
#endif
pEvdev->absinfo[axis].minimum,
pEvdev->absinfo[axis].maximum,
resolution, 0, resolution);
resolution, 0, resolution
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
, Absolute
#endif
);
xf86InitValuatorDefaults(device, axnum);
pEvdev->old_vals[axnum] = -1;
}
free(atoms);
for (i = 0; i < ArrayLength(proximity_bits); i++)
{
if (TestBit(proximity_bits[i], pEvdev->key_bitmask))
{
InitProximityClassDeviceStruct(device);
break;
}
}
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
return !Success;
if ((TestBit(ABS_X, pEvdev->abs_bitmask) &&
TestBit(ABS_Y, pEvdev->abs_bitmask)) ||
(TestBit(ABS_RX, pEvdev->abs_bitmask) &&
TestBit(ABS_RY, pEvdev->abs_bitmask)) ||
(TestBit(ABS_HAT0X, pEvdev->abs_bitmask) &&
TestBit(ABS_HAT0Y, pEvdev->abs_bitmask)) ||
(TestBit(ABS_HAT1X, pEvdev->abs_bitmask) &&
TestBit(ABS_HAT1Y, pEvdev->abs_bitmask)) ||
(TestBit(ABS_HAT2X, pEvdev->abs_bitmask) &&
TestBit(ABS_HAT2Y, pEvdev->abs_bitmask)) ||
(TestBit(ABS_HAT3X, pEvdev->abs_bitmask) &&
TestBit(ABS_HAT3Y, pEvdev->abs_bitmask)) ||
(TestBit(ABS_TILT_X, pEvdev->abs_bitmask) &&
TestBit(ABS_TILT_Y, pEvdev->abs_bitmask)))
pInfo->flags |= XI86_POINTER_CAPABLE;
if (pEvdev->flags & EVDEV_TOUCHPAD)
pEvdev->flags |= EVDEV_RELATIVE_MODE;
else
@@ -1259,7 +1390,7 @@ EvdevAddRelClass(DeviceIntPtr device)
if (!TestBit(EV_REL, pEvdev->bitmask))
return !Success;
num_axes = CountBits(pEvdev->rel_bitmask, NLONGS(REL_MAX));
num_axes = EvdevCountBits(pEvdev->rel_bitmask, NLONGS(REL_MAX));
if (num_axes < 1)
return !Success;
@@ -1321,14 +1452,16 @@ EvdevAddRelClass(DeviceIntPtr device)
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
atoms[axnum],
#endif
-1, -1, 1, 0, 1);
-1, -1, 1, 0, 1
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
, Relative
#endif
);
xf86InitValuatorDefaults(device, axnum);
}
free(atoms);
pInfo->flags |= XI86_POINTER_CAPABLE;
return Success;
}
@@ -1542,12 +1675,14 @@ EvdevOn(DeviceIntPtr device)
{
InputInfoPtr pInfo;
EvdevPtr pEvdev;
int rc = Success;
pInfo = device->public.devicePrivate;
pEvdev = pInfo->private;
/* after PreInit fd is still open */
if (!EvdevOpenDevice(pInfo))
return !Success;
rc = EvdevOpenDevice(pInfo);
if (rc != Success)
return rc;
EvdevGrabDevice(pInfo, 1, 0);
@@ -1782,6 +1917,7 @@ EvdevProbe(InputInfoPtr pInfo)
int has_lmr; /* left middle right */
int ignore_abs = 0, ignore_rel = 0;
EvdevPtr pEvdev = pInfo->private;
int rc = 1;
/* Trinary state for ignoring axes:
- unset: do the normal thing.
@@ -1888,7 +2024,9 @@ EvdevProbe(InputInfoPtr pInfo)
if ((TestBit(ABS_X, pEvdev->abs_bitmask) &&
TestBit(ABS_Y, pEvdev->abs_bitmask))) {
xf86Msg(X_PROBED, "%s: Found x and y absolute axes\n", pInfo->name);
if (TestBit(BTN_TOOL_PEN, pEvdev->key_bitmask))
if (TestBit(BTN_TOOL_PEN, pEvdev->key_bitmask) ||
TestBit(BTN_STYLUS, pEvdev->key_bitmask) ||
TestBit(BTN_STYLUS2, pEvdev->key_bitmask))
{
xf86Msg(X_PROBED, "%s: Found absolute tablet.\n", pInfo->name);
pEvdev->flags |= EVDEV_TABLET;
@@ -1946,8 +2084,7 @@ EvdevProbe(InputInfoPtr pInfo)
}
if (has_rel_axes || has_abs_axes || num_buttons) {
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
XI86_CONFIGURED;
pInfo->flags |= XI86_SEND_DRAG_EVENTS;
if (pEvdev->flags & EVDEV_TOUCHPAD) {
xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name);
pInfo->type_name = XI_TOUCHPAD;
@@ -1961,30 +2098,29 @@ EvdevProbe(InputInfoPtr pInfo)
xf86Msg(X_INFO, "%s: Configuring as mouse\n", pInfo->name);
pInfo->type_name = XI_MOUSE;
}
rc = 0;
}
if (has_keys) {
xf86Msg(X_INFO, "%s: Configuring as keyboard\n", pInfo->name);
pInfo->flags |= XI86_KEYBOARD_CAPABLE | XI86_CONFIGURED;
pInfo->type_name = XI_KEYBOARD;
rc = 0;
}
if (has_scroll && (pInfo->flags & XI86_CONFIGURED) &&
(pInfo->flags & XI86_POINTER_CAPABLE) == 0)
if (has_scroll &&
(has_rel_axes || has_abs_axes || num_buttons || has_keys))
{
xf86Msg(X_INFO, "%s: Adding scrollwheel support\n", pInfo->name);
pInfo->flags |= XI86_POINTER_CAPABLE;
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
}
if ((pInfo->flags & XI86_CONFIGURED) == 0) {
if (rc)
xf86Msg(X_WARNING, "%s: Don't know how to use device\n",
pInfo->name);
return 1;
}
return 0;
return rc;
}
static void
@@ -2007,7 +2143,7 @@ EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4])
}
}
static BOOL
static int
EvdevOpenDevice(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
@@ -2018,7 +2154,7 @@ EvdevOpenDevice(InputInfoPtr pInfo)
device = xf86CheckStrOption(pInfo->options, "Device", NULL);
if (!device) {
xf86Msg(X_ERROR, "%s: No device specified.\n", pInfo->name);
return FALSE;
return BadValue;
}
pEvdev->device = device;
@@ -2033,7 +2169,7 @@ EvdevOpenDevice(InputInfoPtr pInfo)
if (pInfo->fd < 0) {
xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device);
return FALSE;
return BadValue;
}
}
@@ -2044,17 +2180,19 @@ EvdevOpenDevice(InputInfoPtr pInfo)
xf86Msg(X_WARNING, "%s: device file is duplicate. Ignoring.\n",
pInfo->name);
close(pInfo->fd);
return FALSE;
return BadMatch;
}
return TRUE;
return Success;
}
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
static int NewEvdevPreInit(InputDriverPtr, InputInfoPtr, int);
static InputInfoPtr
EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
InputInfoPtr pInfo;
EvdevPtr pEvdev;
if (!(pInfo = xf86AllocateInput(drv, 0)))
return NULL;
@@ -2063,13 +2201,9 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pInfo->fd = -1;
pInfo->name = dev->identifier;
pInfo->flags = 0;
pInfo->type_name = "UNKNOWN";
pInfo->device_control = EvdevProc;
pInfo->read_input = EvdevReadInput;
pInfo->history_size = 0;
pInfo->control_proc = NULL;
pInfo->close_proc = NULL;
pInfo->switch_mode = EvdevSwitchMode;
pInfo->conversion_proc = NULL;
pInfo->reverse_conversion_proc = NULL;
pInfo->dev = NULL;
@@ -2078,27 +2212,53 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pInfo->conf_idev = dev;
pInfo->private = NULL;
xf86CollectInputOptions(pInfo, (const char**)evdevDefaults, NULL);
xf86ProcessCommonOptions(pInfo, pInfo->options);
if (NewEvdevPreInit(drv, pInfo, flags) == Success)
{
pInfo->flags |= XI86_CONFIGURED;
return pInfo;
}
xf86DeleteInput(pInfo, 0);
return NULL;
}
static int
NewEvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
#else
static int
EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
#endif
{
EvdevPtr pEvdev;
int rc = BadAlloc;
if (!(pEvdev = calloc(sizeof(EvdevRec), 1)))
goto error;
pInfo->private = pEvdev;
pInfo->type_name = "UNKNOWN";
pInfo->device_control = EvdevProc;
pInfo->read_input = EvdevReadInput;
pInfo->switch_mode = EvdevSwitchMode;
xf86CollectInputOptions(pInfo, evdevDefaults, NULL);
xf86ProcessCommonOptions(pInfo, pInfo->options);
if (!EvdevOpenDevice(pInfo))
rc = EvdevOpenDevice(pInfo);
if (rc != Success)
goto error;
/*
* We initialize pEvdev->tool to 1 so that device that doesn't use
* We initialize pEvdev->proximity to 1 so that device that doesn't use
* proximity will still report events.
*/
pEvdev->tool = 1;
pEvdev->proximity = 1;
/* Grabbing the event device stops in-kernel event forwarding. In other
words, it disables rfkill and the "Macintosh mouse button emulation".
Note that this needs a server that sets the console to RAW mode. */
pEvdev->grabDevice = xf86CheckBoolOption(dev->commonOptions, "GrabDevice", 0);
pEvdev->grabDevice = xf86CheckBoolOption(pInfo->options, "GrabDevice", 0);
/* If grabDevice is set, ungrab immediately since we only want to grab
* between DEVICE_ON and DEVICE_OFF. If we never get DEVICE_ON, don't
@@ -2107,6 +2267,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
xf86Msg(X_WARNING, "%s: Device may already be configured.\n",
pInfo->name);
rc = BadMatch;
goto error;
}
@@ -2114,6 +2275,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
if (EvdevCacheCompare(pInfo, FALSE) ||
EvdevProbe(pInfo)) {
rc = BadMatch;
goto error;
}
@@ -2126,13 +2288,12 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
EvdevDragLockPreInit(pInfo);
}
return pInfo;
return Success;
error:
if (pInfo->fd >= 0)
close(pInfo->fd);
xf86DeleteInput(pInfo, 0);
return NULL;
return rc;
}
_X_EXPORT InputDriverRec EVDEV = {
@@ -2142,7 +2303,9 @@ _X_EXPORT InputDriverRec EVDEV = {
EvdevPreInit,
NULL,
NULL,
0
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
evdevDefaults
#endif
};
static void
@@ -2188,70 +2351,33 @@ _X_EXPORT XF86ModuleData evdevModuleData =
unsigned int
EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code)
{
unsigned int button = 0;
switch (code)
{
/* Mouse buttons */
case BTN_LEFT:
return 1;
case BTN_MIDDLE:
return 2;
case BTN_RIGHT:
return 3;
case BTN_SIDE ... BTN_JOYSTICK - 1:
return 8 + code - BTN_SIDE;
switch(code) {
case BTN_LEFT:
button = 1;
break;
/* Generic buttons */
case BTN_0 ... BTN_2:
return 1 + code - BTN_0;
case BTN_3 ... BTN_MOUSE - 1:
return 8 + code - BTN_3;
case BTN_RIGHT:
button = 3;
break;
/* Tablet stylus buttons */
case BTN_TOUCH ... BTN_STYLUS2:
return 1 + code - BTN_TOUCH;
case BTN_MIDDLE:
button = 2;
break;
/* Treat BTN_[0-2] as LMR buttons on devices that do not advertise
BTN_LEFT, BTN_MIDDLE, BTN_RIGHT.
Otherwise, treat BTN_[0+n] as button 5+n.
XXX: This causes duplicate mappings for BTN_0 + n and BTN_SIDE + n
*/
case BTN_0:
button = (TestBit(BTN_LEFT, pEvdev->key_bitmask)) ? 8 : 1;
break;
case BTN_1:
button = (TestBit(BTN_MIDDLE, pEvdev->key_bitmask)) ? 9 : 2;
break;
case BTN_2:
button = (TestBit(BTN_RIGHT, pEvdev->key_bitmask)) ? 10 : 3;
break;
/* FIXME: BTN_3.. and BTN_SIDE.. have the same button mapping */
case BTN_3:
case BTN_4:
case BTN_5:
case BTN_6:
case BTN_7:
case BTN_8:
case BTN_9:
button = (code - BTN_0 + 5);
break;
case BTN_SIDE:
case BTN_EXTRA:
case BTN_FORWARD:
case BTN_BACK:
case BTN_TASK:
button = (code - BTN_LEFT + 5);
break;
default:
if ((code > BTN_TASK) && (code < KEY_OK)) {
if (code < BTN_JOYSTICK) {
if (code < BTN_MOUSE)
button = (code - BTN_0 + 5);
else
button = (code - BTN_LEFT + 5);
}
}
/* The rest */
default:
/* Ignore */
return 0;
}
if (button > EVDEV_MAXBUTTONS)
return 0;
return button;
}
#ifdef HAVE_PROPERTIES
@@ -2293,6 +2419,35 @@ static char* abs_labels[] = {
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_VOLUME /* 0x20 */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 10
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
AXIS_LABEL_PROP_ABS_MT_POSITION_X, /* 0x35 */
AXIS_LABEL_PROP_ABS_MT_POSITION_Y, /* 0x36 */
AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, /* 0x37 */
AXIS_LABEL_PROP_ABS_MT_BLOB_ID, /* 0x38 */
AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
#endif
};
static char* rel_labels[] = {

View File

@@ -109,6 +109,7 @@ typedef struct {
enum {
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
EV_QUEUE_BTN, /* xf86PostButtonEvent() */
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
} type;
int key; /* May be either a key code or button number. */
int val; /* State of the key/button; pressed or released. */
@@ -124,14 +125,15 @@ typedef struct {
int old_vals[MAX_VALUATORS]; /* Translate absolute inputs to relative */
int flags;
int tool;
int proximity;
int num_buttons; /* number of buttons */
BOOL swap_axes;
BOOL invert_x;
BOOL invert_y;
int delta[REL_CNT];
unsigned int abs, rel;
unsigned int abs_queued, rel_queued, prox_queued;
unsigned int abs_prox; /* valuators posted while out of prox? */
/* XKB stuff has to be per-device rather than per-driver */
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
@@ -198,11 +200,12 @@ typedef struct {
/* Event posting functions */
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value);
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS]);
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS]);
unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);