diff options
author | Oliver McFadden <oliver.mcfadden@nokia.com> | 2009-07-23 13:19:49 +0300 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-29 15:26:53 +1000 |
commit | 1f641d75edba7394201c1c53938215bae696791b (patch) | |
tree | 9d44183a4bf6d2173c8dd4677799ab7de4cf9f7d /src/evdev.h | |
parent | Don't register middle mouse button emulation handlers for keyboards. (diff) | |
download | xf86-input-evdev-1f641d75edba7394201c1c53938215bae696791b.tar.gz xf86-input-evdev-1f641d75edba7394201c1c53938215bae696791b.tar.bz2 xf86-input-evdev-1f641d75edba7394201c1c53938215bae696791b.zip |
evdev: Only send the events at synchronization time.
Instead of just posting the button/key press/release events to the
server as soon as they arrive, add them to an internal queue and post
them once we receive an EV_SYN synchronization event.
The motion events are always sent first, followed by the queued events.
There will be one motion event and possibly many queued button/key
events posted every EV_SYN event.
Note that the size of the event queue (EVDEV_MAXQUEUE) is arbitrary and
you may change it. If we receive more events than the queue can handle,
those events are dropped and a warning message printed.
Tested on my Lenovo T400 using evdev for all input devices; keyboard,
touchpad, and trackpoint.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/evdev.h')
-rw-r--r-- | src/evdev.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/evdev.h b/src/evdev.h index 5b95369..23ee003 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -54,6 +54,7 @@ #endif #define EVDEV_MAXBUTTONS 32 +#define EVDEV_MAXQUEUE 32 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3 #define HAVE_PROPERTIES 1 @@ -87,6 +88,16 @@ typedef struct { int traveled_distance; } WheelAxis, *WheelAxisPtr; +/* Event queue used to defer keyboard/button events until EV_SYN time. */ +typedef struct { + enum { + EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */ + EV_QUEUE_BTN, /* xf86PostButtonEvent() */ + } type; + int key; /* May be either a key code or button number. */ + int val; /* State of the key/button; pressed or released. */ +} EventQueueRec, *EventQueuePtr; + typedef struct { const char *device; int grabDevice; /* grab the event device? */ @@ -103,6 +114,9 @@ typedef struct { BOOL invert_x; BOOL invert_y; + int delta[REL_CNT]; + unsigned int abs, rel; + /* XKB stuff has to be per-device rather than per-driver */ #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5 XkbComponentNamesRec xkbnames; @@ -159,6 +173,10 @@ typedef struct { /* minor/major number */ dev_t min_maj; + + /* Event queue used to defer keyboard/button events until EV_SYN time. */ + int num_queue; + EventQueueRec queue[EVDEV_MAXQUEUE]; } EvdevRec, *EvdevPtr; unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code); |