summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/wayland-protocols/include/protocol/pointer-gestures-unstable-v1-client-protocol.h
blob: 415dd83001ae343464b39aa0ca49c7a996be2eb9 (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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
/* Generated by wayland-scanner 1.13.0 */

#ifndef POINTER_GESTURES_UNSTABLE_V1_CLIENT_PROTOCOL_H
#define POINTER_GESTURES_UNSTABLE_V1_CLIENT_PROTOCOL_H

#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"

#ifdef  __cplusplus
extern "C" {
#endif

/**
 * @page page_pointer_gestures_unstable_v1 The pointer_gestures_unstable_v1 protocol
 * @section page_ifaces_pointer_gestures_unstable_v1 Interfaces
 * - @subpage page_iface_zwp_pointer_gestures_v1 - touchpad gestures
 * - @subpage page_iface_zwp_pointer_gesture_swipe_v1 - a swipe gesture object
 * - @subpage page_iface_zwp_pointer_gesture_pinch_v1 - a pinch gesture object
 */
struct wl_pointer;
struct wl_surface;
struct zwp_pointer_gesture_pinch_v1;
struct zwp_pointer_gesture_swipe_v1;
struct zwp_pointer_gestures_v1;

/**
 * @page page_iface_zwp_pointer_gestures_v1 zwp_pointer_gestures_v1
 * @section page_iface_zwp_pointer_gestures_v1_desc Description
 *
 * A global interface to provide semantic touchpad gestures for a given
 * pointer.
 *
 * Two gestures are currently supported: swipe and zoom/rotate.
 * All gestures follow a three-stage cycle: begin, update, end and
 * are identified by a unique id.
 *
 * Warning! The protocol described in this file is experimental and
 * backward incompatible changes may be made. Backward compatible changes
 * may be added together with the corresponding interface version bump.
 * Backward incompatible changes are done by bumping the version number in
 * the protocol and interface names and resetting the interface version.
 * Once the protocol is to be declared stable, the 'z' prefix and the
 * version number in the protocol and interface names are removed and the
 * interface version number is reset.
 * @section page_iface_zwp_pointer_gestures_v1_api API
 * See @ref iface_zwp_pointer_gestures_v1.
 */
/**
 * @defgroup iface_zwp_pointer_gestures_v1 The zwp_pointer_gestures_v1 interface
 *
 * A global interface to provide semantic touchpad gestures for a given
 * pointer.
 *
 * Two gestures are currently supported: swipe and zoom/rotate.
 * All gestures follow a three-stage cycle: begin, update, end and
 * are identified by a unique id.
 *
 * Warning! The protocol described in this file is experimental and
 * backward incompatible changes may be made. Backward compatible changes
 * may be added together with the corresponding interface version bump.
 * Backward incompatible changes are done by bumping the version number in
 * the protocol and interface names and resetting the interface version.
 * Once the protocol is to be declared stable, the 'z' prefix and the
 * version number in the protocol and interface names are removed and the
 * interface version number is reset.
 */
extern const struct wl_interface zwp_pointer_gestures_v1_interface;
/**
 * @page page_iface_zwp_pointer_gesture_swipe_v1 zwp_pointer_gesture_swipe_v1
 * @section page_iface_zwp_pointer_gesture_swipe_v1_desc Description
 *
 * A swipe gesture object notifies a client about a multi-finger swipe
 * gesture detected on an indirect input device such as a touchpad.
 * The gesture is usually initiated by multiple fingers moving in the
 * same direction but once initiated the direction may change.
 * The precise conditions of when such a gesture is detected are
 * implementation-dependent.
 *
 * A gesture consists of three stages: begin, update (optional) and end.
 * There cannot be multiple simultaneous pinch or swipe gestures on a
 * same pointer/seat, how compositors prevent these situations is
 * implementation-dependent.
 *
 * A gesture may be cancelled by the compositor or the hardware.
 * Clients should not consider performing permanent or irreversible
 * actions until the end of a gesture has been received.
 * @section page_iface_zwp_pointer_gesture_swipe_v1_api API
 * See @ref iface_zwp_pointer_gesture_swipe_v1.
 */
/**
 * @defgroup iface_zwp_pointer_gesture_swipe_v1 The zwp_pointer_gesture_swipe_v1 interface
 *
 * A swipe gesture object notifies a client about a multi-finger swipe
 * gesture detected on an indirect input device such as a touchpad.
 * The gesture is usually initiated by multiple fingers moving in the
 * same direction but once initiated the direction may change.
 * The precise conditions of when such a gesture is detected are
 * implementation-dependent.
 *
 * A gesture consists of three stages: begin, update (optional) and end.
 * There cannot be multiple simultaneous pinch or swipe gestures on a
 * same pointer/seat, how compositors prevent these situations is
 * implementation-dependent.
 *
 * A gesture may be cancelled by the compositor or the hardware.
 * Clients should not consider performing permanent or irreversible
 * actions until the end of a gesture has been received.
 */
extern const struct wl_interface zwp_pointer_gesture_swipe_v1_interface;
/**
 * @page page_iface_zwp_pointer_gesture_pinch_v1 zwp_pointer_gesture_pinch_v1
 * @section page_iface_zwp_pointer_gesture_pinch_v1_desc Description
 *
 * A pinch gesture object notifies a client about a multi-finger pinch
 * gesture detected on an indirect input device such as a touchpad.
 * The gesture is usually initiated by multiple fingers moving towards
 * each other or away from each other, or by two or more fingers rotating
 * around a logical center of gravity. The precise conditions of when
 * such a gesture is detected are implementation-dependent.
 *
 * A gesture consists of three stages: begin, update (optional) and end.
 * There cannot be multiple simultaneous pinch or swipe gestures on a
 * same pointer/seat, how compositors prevent these situations is
 * implementation-dependent.
 *
 * A gesture may be cancelled by the compositor or the hardware.
 * Clients should not consider performing permanent or irreversible
 * actions until the end of a gesture has been received.
 * @section page_iface_zwp_pointer_gesture_pinch_v1_api API
 * See @ref iface_zwp_pointer_gesture_pinch_v1.
 */
/**
 * @defgroup iface_zwp_pointer_gesture_pinch_v1 The zwp_pointer_gesture_pinch_v1 interface
 *
 * A pinch gesture object notifies a client about a multi-finger pinch
 * gesture detected on an indirect input device such as a touchpad.
 * The gesture is usually initiated by multiple fingers moving towards
 * each other or away from each other, or by two or more fingers rotating
 * around a logical center of gravity. The precise conditions of when
 * such a gesture is detected are implementation-dependent.
 *
 * A gesture consists of three stages: begin, update (optional) and end.
 * There cannot be multiple simultaneous pinch or swipe gestures on a
 * same pointer/seat, how compositors prevent these situations is
 * implementation-dependent.
 *
 * A gesture may be cancelled by the compositor or the hardware.
 * Clients should not consider performing permanent or irreversible
 * actions until the end of a gesture has been received.
 */
extern const struct wl_interface zwp_pointer_gesture_pinch_v1_interface;

#define ZWP_POINTER_GESTURES_V1_GET_SWIPE_GESTURE 0
#define ZWP_POINTER_GESTURES_V1_GET_PINCH_GESTURE 1


/**
 * @ingroup iface_zwp_pointer_gestures_v1
 */
#define ZWP_POINTER_GESTURES_V1_GET_SWIPE_GESTURE_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_pointer_gestures_v1
 */
#define ZWP_POINTER_GESTURES_V1_GET_PINCH_GESTURE_SINCE_VERSION 1

/** @ingroup iface_zwp_pointer_gestures_v1 */
static inline void
zwp_pointer_gestures_v1_set_user_data(struct zwp_pointer_gestures_v1 *zwp_pointer_gestures_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_gestures_v1, user_data);
}

/** @ingroup iface_zwp_pointer_gestures_v1 */
static inline void *
zwp_pointer_gestures_v1_get_user_data(struct zwp_pointer_gestures_v1 *zwp_pointer_gestures_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_gestures_v1);
}

static inline uint32_t
zwp_pointer_gestures_v1_get_version(struct zwp_pointer_gestures_v1 *zwp_pointer_gestures_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_pointer_gestures_v1);
}

/** @ingroup iface_zwp_pointer_gestures_v1 */
static inline void
zwp_pointer_gestures_v1_destroy(struct zwp_pointer_gestures_v1 *zwp_pointer_gestures_v1)
{
	wl_proxy_destroy((struct wl_proxy *) zwp_pointer_gestures_v1);
}

/**
 * @ingroup iface_zwp_pointer_gestures_v1
 *
 * Create a swipe gesture object. See the
 * wl_pointer_gesture_swipe interface for details.
 */
static inline struct zwp_pointer_gesture_swipe_v1 *
zwp_pointer_gestures_v1_get_swipe_gesture(struct zwp_pointer_gestures_v1 *zwp_pointer_gestures_v1, struct wl_pointer *pointer)
{
	struct wl_proxy *id;

	id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_gestures_v1,
			 ZWP_POINTER_GESTURES_V1_GET_SWIPE_GESTURE, &zwp_pointer_gesture_swipe_v1_interface, NULL, pointer);

	return (struct zwp_pointer_gesture_swipe_v1 *) id;
}

/**
 * @ingroup iface_zwp_pointer_gestures_v1
 *
 * Create a pinch gesture object. See the
 * wl_pointer_gesture_pinch interface for details.
 */
static inline struct zwp_pointer_gesture_pinch_v1 *
zwp_pointer_gestures_v1_get_pinch_gesture(struct zwp_pointer_gestures_v1 *zwp_pointer_gestures_v1, struct wl_pointer *pointer)
{
	struct wl_proxy *id;

	id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_pointer_gestures_v1,
			 ZWP_POINTER_GESTURES_V1_GET_PINCH_GESTURE, &zwp_pointer_gesture_pinch_v1_interface, NULL, pointer);

	return (struct zwp_pointer_gesture_pinch_v1 *) id;
}

/**
 * @ingroup iface_zwp_pointer_gesture_swipe_v1
 * @struct zwp_pointer_gesture_swipe_v1_listener
 */
struct zwp_pointer_gesture_swipe_v1_listener {
	/**
	 * multi-finger swipe begin
	 *
	 * This event is sent when a multi-finger swipe gesture is
	 * detected on the device.
	 * @param time timestamp with millisecond granularity
	 * @param fingers number of fingers
	 */
	void (*begin)(void *data,
		      struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1,
		      uint32_t serial,
		      uint32_t time,
		      struct wl_surface *surface,
		      uint32_t fingers);
	/**
	 * multi-finger swipe motion
	 *
	 * This event is sent when a multi-finger swipe gesture changes
	 * the position of the logical center.
	 *
	 * The dx and dy coordinates are relative coordinates of the
	 * logical center of the gesture compared to the previous event.
	 * @param time timestamp with millisecond granularity
	 * @param dx delta x coordinate in surface coordinate space
	 * @param dy delta y coordinate in surface coordinate space
	 */
	void (*update)(void *data,
		       struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1,
		       uint32_t time,
		       wl_fixed_t dx,
		       wl_fixed_t dy);
	/**
	 * multi-finger swipe end
	 *
	 * This event is sent when a multi-finger swipe gesture ceases to
	 * be valid. This may happen when one or more fingers are lifted or
	 * the gesture is cancelled.
	 *
	 * When a gesture is cancelled, the client should undo state
	 * changes caused by this gesture. What causes a gesture to be
	 * cancelled is implementation-dependent.
	 * @param time timestamp with millisecond granularity
	 * @param cancelled 1 if the gesture was cancelled, 0 otherwise
	 */
	void (*end)(void *data,
		    struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1,
		    uint32_t serial,
		    uint32_t time,
		    int32_t cancelled);
};

/**
 * @ingroup iface_zwp_pointer_gesture_swipe_v1
 */
static inline int
zwp_pointer_gesture_swipe_v1_add_listener(struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1,
					  const struct zwp_pointer_gesture_swipe_v1_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) zwp_pointer_gesture_swipe_v1,
				     (void (**)(void)) listener, data);
}

#define ZWP_POINTER_GESTURE_SWIPE_V1_DESTROY 0

/**
 * @ingroup iface_zwp_pointer_gesture_swipe_v1
 */
#define ZWP_POINTER_GESTURE_SWIPE_V1_BEGIN_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_pointer_gesture_swipe_v1
 */
#define ZWP_POINTER_GESTURE_SWIPE_V1_UPDATE_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_pointer_gesture_swipe_v1
 */
#define ZWP_POINTER_GESTURE_SWIPE_V1_END_SINCE_VERSION 1

/**
 * @ingroup iface_zwp_pointer_gesture_swipe_v1
 */
#define ZWP_POINTER_GESTURE_SWIPE_V1_DESTROY_SINCE_VERSION 1

/** @ingroup iface_zwp_pointer_gesture_swipe_v1 */
static inline void
zwp_pointer_gesture_swipe_v1_set_user_data(struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_gesture_swipe_v1, user_data);
}

/** @ingroup iface_zwp_pointer_gesture_swipe_v1 */
static inline void *
zwp_pointer_gesture_swipe_v1_get_user_data(struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_gesture_swipe_v1);
}

static inline uint32_t
zwp_pointer_gesture_swipe_v1_get_version(struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_pointer_gesture_swipe_v1);
}

/**
 * @ingroup iface_zwp_pointer_gesture_swipe_v1
 */
static inline void
zwp_pointer_gesture_swipe_v1_destroy(struct zwp_pointer_gesture_swipe_v1 *zwp_pointer_gesture_swipe_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_pointer_gesture_swipe_v1,
			 ZWP_POINTER_GESTURE_SWIPE_V1_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) zwp_pointer_gesture_swipe_v1);
}

/**
 * @ingroup iface_zwp_pointer_gesture_pinch_v1
 * @struct zwp_pointer_gesture_pinch_v1_listener
 */
struct zwp_pointer_gesture_pinch_v1_listener {
	/**
	 * multi-finger pinch begin
	 *
	 * This event is sent when a multi-finger pinch gesture is
	 * detected on the device.
	 * @param time timestamp with millisecond granularity
	 * @param fingers number of fingers
	 */
	void (*begin)(void *data,
		      struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1,
		      uint32_t serial,
		      uint32_t time,
		      struct wl_surface *surface,
		      uint32_t fingers);
	/**
	 * multi-finger pinch motion
	 *
	 * This event is sent when a multi-finger pinch gesture changes
	 * the position of the logical center, the rotation or the relative
	 * scale.
	 *
	 * The dx and dy coordinates are relative coordinates in the
	 * surface coordinate space of the logical center of the gesture.
	 *
	 * The scale factor is an absolute scale compared to the
	 * pointer_gesture_pinch.begin event, e.g. a scale of 2 means the
	 * fingers are now twice as far apart as on
	 * pointer_gesture_pinch.begin.
	 *
	 * The rotation is the relative angle in degrees clockwise compared
	 * to the previous pointer_gesture_pinch.begin or
	 * pointer_gesture_pinch.update event.
	 * @param time timestamp with millisecond granularity
	 * @param dx delta x coordinate in surface coordinate space
	 * @param dy delta y coordinate in surface coordinate space
	 * @param scale scale relative to the initial finger position
	 * @param rotation angle in degrees cw relative to the previous event
	 */
	void (*update)(void *data,
		       struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1,
		       uint32_t time,
		       wl_fixed_t dx,
		       wl_fixed_t dy,
		       wl_fixed_t scale,
		       wl_fixed_t rotation);
	/**
	 * multi-finger pinch end
	 *
	 * This event is sent when a multi-finger pinch gesture ceases to
	 * be valid. This may happen when one or more fingers are lifted or
	 * the gesture is cancelled.
	 *
	 * When a gesture is cancelled, the client should undo state
	 * changes caused by this gesture. What causes a gesture to be
	 * cancelled is implementation-dependent.
	 * @param time timestamp with millisecond granularity
	 * @param cancelled 1 if the gesture was cancelled, 0 otherwise
	 */
	void (*end)(void *data,
		    struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1,
		    uint32_t serial,
		    uint32_t time,
		    int32_t cancelled);
};

/**
 * @ingroup iface_zwp_pointer_gesture_pinch_v1
 */
static inline int
zwp_pointer_gesture_pinch_v1_add_listener(struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1,
					  const struct zwp_pointer_gesture_pinch_v1_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) zwp_pointer_gesture_pinch_v1,
				     (void (**)(void)) listener, data);
}

#define ZWP_POINTER_GESTURE_PINCH_V1_DESTROY 0

/**
 * @ingroup iface_zwp_pointer_gesture_pinch_v1
 */
#define ZWP_POINTER_GESTURE_PINCH_V1_BEGIN_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_pointer_gesture_pinch_v1
 */
#define ZWP_POINTER_GESTURE_PINCH_V1_UPDATE_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_pointer_gesture_pinch_v1
 */
#define ZWP_POINTER_GESTURE_PINCH_V1_END_SINCE_VERSION 1

/**
 * @ingroup iface_zwp_pointer_gesture_pinch_v1
 */
#define ZWP_POINTER_GESTURE_PINCH_V1_DESTROY_SINCE_VERSION 1

/** @ingroup iface_zwp_pointer_gesture_pinch_v1 */
static inline void
zwp_pointer_gesture_pinch_v1_set_user_data(struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_gesture_pinch_v1, user_data);
}

/** @ingroup iface_zwp_pointer_gesture_pinch_v1 */
static inline void *
zwp_pointer_gesture_pinch_v1_get_user_data(struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_gesture_pinch_v1);
}

static inline uint32_t
zwp_pointer_gesture_pinch_v1_get_version(struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_pointer_gesture_pinch_v1);
}

/**
 * @ingroup iface_zwp_pointer_gesture_pinch_v1
 */
static inline void
zwp_pointer_gesture_pinch_v1_destroy(struct zwp_pointer_gesture_pinch_v1 *zwp_pointer_gesture_pinch_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_pointer_gesture_pinch_v1,
			 ZWP_POINTER_GESTURE_PINCH_V1_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) zwp_pointer_gesture_pinch_v1);
}

#ifdef  __cplusplus
}
#endif

#endif