summaryrefslogtreecommitdiff
path: root/gestureproto.h
blob: 16d6f958630f1ebef0e12fb43190c18aaeac76d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/*
 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice appear in all copies
 * and that both that copyright notice and this permission notice
 * appear in supporting documentation, and that the name of Red Hat
 * not be used in advertising or publicity pertaining to distribution
 * of the software without specific, written prior permission.  Red
 * Hat makes no representations about the suitability of this software
 * for any purpose.  It is provided "as is" without express or implied
 * warranty.
 *
 * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#ifndef _GESTUREPROTO_H_
#define _GESTUREPROTO_H_

#include <X11/extensions/gestureconst.h>
#include <X11/X.h>
#include <X11/Xmd.h>

#define Fixed	    INT32

#define GESTURE_EXT_NAME "X Gesture Extension"

#define GESTURE_MAJOR	0	/* current version numbers */
#define GESTURE_MINOR	1
#define GESTURE_PATCH	0

// Requests
#define X_GestureQueryVersion		0
#define X_GestureSelectEvents		1
#define X_GestureGetSelectedEvents	2
#define X_GestureGrabEvent			3
#define X_GestureUngrabEvent		4

//requests
typedef struct _GestureSelectEvents {
    CARD8 reqType;			/* always GestureReqCode */
    CARD8 gestureReqType;	/* always X_GestureSelectEvents */
    CARD16 length B16;
    CARD32 window B32;
    CARD32 mask B32;
} xGestureSelectEventsReq;
#define sz_xGestureSelectEventsReq	12

typedef struct _GestureGetSelectedEvents {
    CARD8 reqType;			/* always GestureReqCode */
    CARD8 gestureReqType;	/* always X_GestureGetSelectedEvents */
    CARD16 length B16;
    CARD32 window B32;
} xGestureGetSelectedEventsReq;
#define sz_xGestureGetSelectedEventsReq	8

typedef struct _GestureGrabEvent {
    CARD8 reqType;			/* always GestureReqCode */
    CARD8 gestureReqType;	/* always X_GestureGrabEvent */
    CARD16 length B16;
    CARD32 window B32;
    CARD32 eventType B32;		/* gesture event type such as "GestureNotifyFlick" */
    CARD8 num_finger;		/* number of fingers in a gesture event */
    CARD8 pad1;
    CARD16 pad2 B16;
    Time time B32;				/* client request timestamp */
} xGestureGrabEventReq;
#define sz_xGestureGrabEventReq	20

typedef struct _GestureUngrabEvent {
    CARD8 reqType;			/* always GestureReqCode */
    CARD8 gestureReqType;	/* always X_GestureUngrabEvent */
    CARD16 length B16;
    CARD32 window B32;
    CARD32 eventType B32;		/* gesture event type such as "GestureNotifyFlick" */
    CARD8 num_finger;		/* number of fingers in a gesture event */
    CARD8 pad1;
    CARD16 pad2 B16;
    Time time B32;				/* client request timestamp */
} xGestureUngrabEventReq;
#define sz_xGestureUngrabEventReq	20

typedef struct _GestureQueryVersion {
    CARD8 reqType;			/* always GestureReqCode */
    CARD8 gestureReqType;	/* always X_GestureQueryVersion */
    CARD16 length B16;
} xGestureQueryVersionReq;
#define sz_xGestureQueryVersionReq	4

//replys for synchronous reqs
typedef struct {
    BYTE type;					/* X_Reply */
    BOOL pad1;
    CARD16 sequenceNumber B16;
    CARD32 length B32;
    CARD32 mask;
    CARD32 pad2 B32;
    CARD32 pad3 B32;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
} xGestureGetSelectedEventsReply;
#define sz_xGestureGetSelectedEventsReply	32

typedef struct {
    BYTE type;					/* X_Reply */
    BYTE status;
    CARD16 sequenceNumber B16;
    CARD32 length B32;
    CARD32 pad1 B32;
    CARD32 pad2 B32;
    CARD32 pad3 B32;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
} xGestureGrabEventReply;
#define sz_xGestureGrabEventReply	32

typedef struct {
    BYTE type;					/* X_Reply */
    BYTE status;
    CARD16 sequenceNumber B16;
    CARD32 length B32;
    CARD32 pad1 B32;
    CARD32 pad2 B32;
    CARD32 pad3 B32;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
} xGestureUngrabEventReply;
#define sz_xGestureUngrabEventReply	32

typedef struct {
    BYTE type;					/* X_Reply */
    BOOL pad1;
    CARD16 sequenceNumber B16;
    CARD32 length B32;
    CARD16 majorVersion B16;	/* major version of Gesture extension protocol */
    CARD16 minorVersion B16;	/* minor version of Gesture extension protocol */
    CARD32 patchVersion B32;	 /* patch version of Gesture extension protocol */
    CARD32 pad3 B32;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
} xGestureQueryVersionReply;
#define sz_xGestureQueryVersionReply	32

//events
typedef struct _GestureNotifyGroup {
	BYTE type;			/* always GestureEventBase + event type */
	BYTE kind;			/* subevent type : GestureNotifyGroup */
	CARD16	sequenceNumber B16;
	Window window B32;
	Time time B32;		/* server timestamp when event happened */
	CARD8 groupid;
	CARD8 num_group;
	CARD16 pad1 B16;
	CARD32 pad2 B32;
	CARD32 pad3 B32;
	CARD32 pad4 B32;
	CARD32 pad5 B32;
} xGestureNotifyGroupEvent;
#define sz_xGestureNotifyGroupEvent	32

typedef struct _GestureNotifyFlick {
	BYTE type;			/* always GestureEventBase + event type */
	BYTE kind;			/* subevent type : GestureNotifyFlick */
	CARD16 sequenceNumber B16;
	Window window B32;
	Time time B32;		/* server timestamp when event happened */
	CARD8 num_finger;
	CARD8 direction;		/* 8 way direction (0 ~ 7) */
	CARD16 distance B16;	/* distance between first point and last point (pixel) */
	Time duration B32;	/* time difference between press and release (ms) */
	Fixed angle B32;		/* angel difference between horizontal line and flick line (radian) */
	CARD32 pad1 B32;
	CARD32 pad2 B32;
} xGestureNotifyFlickEvent;
#define sz_xGestureNotifyFlickEvent	32

typedef struct _GestureNotifyPan {
	BYTE type;			/* always GestureEventBase + event type */
	BYTE kind;			/* subevent type : GestureNotifyPan */
	CARD16	sequenceNumber B16;
	Window window B32;
	Time time B32;		/* server timestamp when event happened */
	CARD8 num_finger;
	CARD8 direction;		/* 8 way direction (0 ~ 7) */
	CARD16 distance B16;	/* distance between first point and last point (pixel)*/
	Time duration B32;	/* time difference between press and release (ms) */
	CARD16 dx B16;		/* x coordinate delta */
	CARD16 dy B16;		/* y coordinate delta */
	CARD32 pad1 B32;
	CARD32 pad2 B32;
} xGestureNotifyPanEvent;
#define sz_xGestureNotifyPanEvent	32

typedef struct _GestureNotifyPinchRotation {
	BYTE type;			/* always GestureEventBase + event type */
	BYTE kind;			/* subevent type : GestureNotifyPinchRotation */
	CARD16 sequenceNumber B16;
	Window window B32;
	Time time B32;		/* server timestamp when event happened */
	CARD8 num_finger;
	CARD8 pad1;
	CARD16 distance B16;	/* distance from center (pixel) */
	CARD16 cx B16;		/* center x coordinate */
	CARD16 cy B16;		/* center y coordinate */
	Fixed zoom B32;		/* zoom factor (base : 1.0) */
	Fixed angle B32;		/* angel difference between first line and current line (radian) */
	CARD32	pad2 B32;
} xGestureNotifyPinchRotationEvent;
#define sz_xGestureNotifyPinchRotationEvent	32

typedef struct _GestureNotifyTap {
	BYTE type;			/* always GestureEventBase + event type */
	BYTE kind;			/* subevent type : GestureNotifyTap */
	CARD16 sequenceNumber B16;
	Window window B32;
	Time time B32;		/* server timestamp when event happened */
	CARD8 num_finger;
	CARD8 pad1;
	CARD16 cx B16;		/* center x coordinate */
	CARD16 cy B16;		/* center y coordinate */
	CARD8 tap_repeat;	/* tap repeats such as SINGLE_TAP, DBL_TAP and so on */
	CARD8 pad2;
	CARD32 interval;		/* time difference between tap and previous tap (ms) */
	CARD32 pad3 B32;
	CARD32 pad4 B32;
} xGestureNotifyTapEvent;
#define sz_xGestureNotifyTapEvent	32

typedef struct _GestureNotifyTapNHold {
	BYTE type;			/* always GestureEventBase + event type */
	BYTE kind;			/* subevent type : GestureNotifyTapNHold */
	CARD16 sequenceNumber B16;
	Window window B32;
	Time time B32;		/* server timestamp when event happened */
	CARD8 num_finger;
	CARD8 pad1;
	CARD16 cx B16;		/* center x coordinate */
	CARD16 cy B16;		/* center y coordinate */
	CARD16 pad2 B16;
	Time interval B32;		/* time difference between tap and hold (ms) */
	Time holdtime B32;	/* hold time (ms) */
	CARD32 pad3 B32;
} xGestureNotifyTapNHoldEvent;
#define sz_xGestureNotifyTapNHoldEvent	32

typedef struct _GestureNotifyHold {
	BYTE type;			/* always GestureEventBase + event type */
	BYTE kind;			/* subevent type : GestureNotifyHold */
	CARD16 sequenceNumber B16;
	Window window B32;
	Time time B32;		/* server timestamp when event happened */
	CARD8 num_finger;
	CARD8 pad1;
	CARD16 cx B16;		/* center x coordinate */
	CARD16 cy B16;		/* center y coordinate */
	CARD16 pad2 B16;
	Time holdtime B32;	/* hold time (ms) */
	CARD32 pad3 B32;
	CARD32 pad4 B32;
} xGestureNotifyHoldEvent;
#define sz_xGestureNotifyHoldEvent	32

union _xGestureCommonEvent {
	struct {
		BYTE type;
		BYTE kind;
		CARD16	sequenceNumber B16;
		Window window B32;
		Time time B32;
	} any;
	xGestureNotifyGroupEvent gev;
	xGestureNotifyFlickEvent fev;
	xGestureNotifyPanEvent pev;
	xGestureNotifyPinchRotationEvent pcrev;
	xGestureNotifyTapEvent tev;
	xGestureNotifyTapNHoldEvent thev;
	xGestureNotifyHoldEvent hev;
};

typedef union _xGestureCommonEvent xGestureCommonEvent;

#endif//_GESTUREPROTO_H_