input: add a TouchClassRec to the devices

These structs will be used to store touch-related data, events and
information.

Drivers must call InitTouchClassDeviceStruct to set up a multi-touch capable
device.

Touchpoints for the DDX and the DIX are handled separately - touchpoints
submitted by the driver/DDX will be stored in the DDXTouchPointInfoRec. Once
the touchpoints are processed by the DIX, new TouchPointInfoRecs are created
and stored. This process is already used for pointer events with the
last.valuators field.

Note that this patch does not actually add the generation of touch events,
only the required structs.

TouchListeners are (future) recipients of touch or emulated pointer events.
Each listener is in a state, depending which event they have already
received. The type of listener defines how the listener got to be one.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
Daniel Stone
2011-12-14 12:46:40 +10:00
committed by Peter Hutterer
parent 098b837440
commit 3fb258ca28
8 changed files with 362 additions and 1 deletions

View File

@@ -300,6 +300,55 @@ typedef struct _ValuatorClassRec {
int v_scroll_axis; /* vert smooth-scrolling axis */
} ValuatorClassRec;
typedef struct _TouchPointInfo {
/* client_id must be first element, see GetTouchEvents */
uint32_t client_id; /* touch ID as seen in client events */
int sourceid; /* Source device's ID for this touchpoint */
Bool active; /* whether or not the touch is active */
Bool pending_finish; /* true if the touch is physically inactive
* but still owned by a grab */
SpriteRec sprite; /* window trace for delivery */
ValuatorMask *valuators; /* last recorded axis values */
struct _TouchListener {
XID listener; /* grabs/event selection IDs receiving
* events for this touch */
enum TouchListenerType type;
enum TouchListenerState state;
enum InputLevel level; /* matters only for emulating touches */
} *listeners;
int num_listeners;
int num_grabs; /* number of open grabs on this touch
* which have not accepted or rejected */
Bool emulate_pointer;
DeviceEvent *history; /* History of events on this touchpoint */
size_t history_elements; /* Number of current elements in history */
size_t history_size; /* Size of history in elements */
} TouchPointInfoRec;
typedef struct _TouchListener TouchListener;
typedef struct _DDXTouchPointInfo {
/* client_id must be first element, see GetTouchEvents */
uint32_t client_id; /* touch ID as seen in client events */
Bool active; /* whether or not the touch is active */
uint32_t ddx_id; /* touch ID given by the DDX */
Bool emulate_pointer;
ValuatorMask* valuators; /* last recorded axis values */
} DDXTouchPointInfoRec;
typedef struct _TouchClassRec {
int sourceid;
TouchPointInfoPtr touches;
unsigned short num_touches; /* number of allocated touches */
unsigned short max_touches; /* maximum number of touches, may be 0 */
CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */
/* for pointer-emulation */
CARD8 buttonsDown; /* number of buttons down */
unsigned short state; /* logical button state */
Mask motionMask;
} TouchClassRec;
typedef struct _ButtonClassRec {
int sourceid;
CARD8 numButtons;
@@ -383,6 +432,7 @@ typedef struct _LedFeedbackClassRec {
typedef struct _ClassesRec {
KeyClassPtr key;
ValuatorClassPtr valuator;
TouchClassPtr touch;
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
@@ -510,6 +560,7 @@ typedef struct _DeviceIntRec {
int id;
KeyClassPtr key;
ValuatorClassPtr valuator;
TouchClassPtr touch;
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
@@ -541,6 +592,8 @@ typedef struct _DeviceIntRec {
int numValuators;
DeviceIntPtr slave;
ValuatorMask *scroll;
int num_touches; /* size of the touches array */
DDXTouchPointInfoPtr touches;
} last;
/* Input device property handling. */