mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
30 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c5ad6f8a0 | ||
|
|
6fd1d0860e | ||
|
|
31ba99e9ed | ||
|
|
a4aefca2ed | ||
|
|
20d7a0a4aa | ||
|
|
5e26ba8641 | ||
|
|
71dd18f728 | ||
|
|
c3e49f2b95 | ||
|
|
b06d3ffdcd | ||
|
|
3646371eef | ||
|
|
b48f4c41c0 | ||
|
|
185ad42078 | ||
|
|
7282e3ac6c | ||
|
|
c504852aa2 | ||
|
|
4bbf9c9125 | ||
|
|
684426a9d2 | ||
|
|
9664e5a487 | ||
|
|
0367e3871f | ||
|
|
617a09e298 | ||
|
|
b83515485b | ||
|
|
009d442aa3 | ||
|
|
10493de96e | ||
|
|
829facd516 | ||
|
|
fbafe59420 | ||
|
|
4964c61f4b | ||
|
|
92e8dc4961 | ||
|
|
e0e4b7d89b | ||
|
|
d2c11d36a0 | ||
|
|
2f636402d8 | ||
|
|
3d3565c069 |
@@ -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])
|
||||
|
||||
533
src/evdev.c
533
src/evdev.c
@@ -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[] = {
|
||||
|
||||
11
src/evdev.h
11
src/evdev.h
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user