From e18abd0049421a98e61c15c2d56cfe2821cf4739 Mon Sep 17 00:00:00 2001 From: Chase Douglas Date: Mon, 8 Nov 2010 11:08:01 -0500 Subject: Add experimental XI 2.1 multitouch support This multitouch addition only supports slotted MT evdev protocol devices. Support must be enabled at configure time using --enable-multitouch. Signed-off-by: Chase Douglas Amendments: XI_TouchMotion -> XI_TouchUpdate, rename mtMask to mt_mask Signed-off-by: Peter Hutterer --- src/evdev.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/evdev.h') diff --git a/src/evdev.h b/src/evdev.h index b2e2f42..6e3b850 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -109,9 +109,20 @@ typedef struct { EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */ EV_QUEUE_BTN, /* xf86PostButtonEvent() */ EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */ +#ifdef MULTITOUCH + EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */ +#endif } type; - int key; /* May be either a key code or button number. */ - int val; /* State of the key/button; pressed or released. */ + union { + int key; /* May be either a key code or button number. */ +#ifdef MULTITOUCH + unsigned int touch; /* Touch ID */ +#endif + } detail; + int val; /* State of the key/button/touch; pressed or released. */ +#ifdef MULTITOUCH + ValuatorMask *touchMask; +#endif } EventQueueRec, *EventQueuePtr; typedef struct { @@ -126,6 +137,12 @@ typedef struct { ValuatorMask *vals; /* new values coming in */ ValuatorMask *old_vals; /* old values for calculating relative motion */ ValuatorMask *prox; /* last values set while not in proximity */ +#ifdef MULTITOUCH + ValuatorMask *mt_mask; + int cur_slot; + BOOL close_slot; + BOOL open_slot; +#endif int flags; int in_proximity; /* device in proximity */ @@ -216,6 +233,10 @@ typedef struct { void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value); void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value); void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value); +#ifdef MULTITOUCH +void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, + ValuatorMask *mask, uint16_t type); +#endif 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, -- cgit v1.2.3 From c9a2b4e9ce9b15e57241184df78c72ec8f6a4705 Mon Sep 17 00:00:00 2001 From: Chase Douglas Date: Mon, 8 Nov 2010 14:35:02 -0500 Subject: Use MTDev for multitouch devices MTDev translates all multitouch devices to the slotted evdev protocol. This provides a clean and uniform interface and reduces message handling inside the input module and X. Signed-off-by: Chase Douglas --- src/evdev.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/evdev.h') diff --git a/src/evdev.h b/src/evdev.h index 6e3b850..c588b5d 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -39,6 +39,10 @@ #include #include +#ifdef MULTITOUCH +#include +#endif + #ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */ #define EV_CNT (EV_MAX+1) #endif @@ -142,6 +146,7 @@ typedef struct { int cur_slot; BOOL close_slot; BOOL open_slot; + struct mtdev *mtdev; #endif int flags; -- cgit v1.2.3 From 9411749f76c31a8054ded62a6fb767c8135b4d4e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Oct 2011 13:09:30 +1000 Subject: Replace open_slot/close_slot with a SlotState enum Signed-off-by: Peter Hutterer --- src/evdev.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/evdev.h') diff --git a/src/evdev.h b/src/evdev.h index c588b5d..165aea4 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -100,6 +100,12 @@ enum fkeymode { FKEYMODE_MMKEYS, /* function keys send multimedia keys */ }; +enum SlotState { + SLOTSTATE_OPEN = 8, + SLOTSTATE_CLOSE, + SLOTSTATE_EMPTY, +}; + /* axis specific data for wheel emulation */ typedef struct { int up_button; @@ -144,8 +150,7 @@ typedef struct { #ifdef MULTITOUCH ValuatorMask *mt_mask; int cur_slot; - BOOL close_slot; - BOOL open_slot; + enum SlotState slot_state; struct mtdev *mtdev; #endif -- cgit v1.2.3 From 2ce305129ca94394096f4d697d51eb120de2940b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Oct 2011 13:21:18 +1000 Subject: Skip event posting for empty slots. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ABS_MT_SLOT comes before any other events. The following order of events is common for protocol B devices (and mtdev): ... EV_SYN ABS_MT_SLOT → posting here means we miss on the position information ABS_MT_POSITION_X ABS_MT_POSITION_Y ABS_MT_SLOT ABS_MT_POSITION_X ABS_MT_POSITION_Y EV_SYN Store the stot state as SLOT_EMPTY after posting an event (i.e. EV_SYN and ABS_MT_SLOT) and then don't post until the next slot/syn event. Signed-off-by: Peter Hutterer --- src/evdev.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/evdev.h') diff --git a/src/evdev.h b/src/evdev.h index 165aea4..27e404c 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -103,6 +103,7 @@ enum fkeymode { enum SlotState { SLOTSTATE_OPEN = 8, SLOTSTATE_CLOSE, + SLOTSTATE_UPDATE, SLOTSTATE_EMPTY, }; -- cgit v1.2.3 From 5e9b027807cc205dc9c4efbb8360ac4b20317682 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 31 Oct 2011 08:58:18 +1000 Subject: Replace 0/1 button values with enums BUTTON_PRESS is much harder to confuse with a button number than a simple 1. Signed-off-by: Peter Hutterer --- src/evdev.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/evdev.h') diff --git a/src/evdev.h b/src/evdev.h index 27e404c..5fd99ff 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -107,6 +107,11 @@ enum SlotState { SLOTSTATE_EMPTY, }; +enum ButtonAction { + BUTTON_RELEASE = 0, + BUTTON_PRESS = 1 +}; + /* axis specific data for wheel emulation */ typedef struct { int up_button; @@ -248,7 +253,7 @@ void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value); void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, ValuatorMask *mask, uint16_t type); #endif -void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value); +void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act); void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count); void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v, int v[MAX_VALUATORS]); -- cgit v1.2.3