Skip to content

Latest commit

 

History

History
352 lines (290 loc) · 11 KB

SDL_waylandtouch.h

File metadata and controls

352 lines (290 loc) · 11 KB
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
Jan 9, 2014
Jan 9, 2014
22
#include "../../SDL_internal.h"
23
24
25
26
27
28
29
30
31
32
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
#ifndef _SDL_waylandtouch_h
#define _SDL_waylandtouch_h
#include "SDL_waylandvideo.h"
#include <stdint.h>
#include <stddef.h>
#include "wayland-util.h"
Jan 9, 2014
Jan 9, 2014
33
34
#include "SDL_waylanddyn.h"
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
void Wayland_touch_create(SDL_VideoData *data, uint32_t id);
void Wayland_touch_destroy(SDL_VideoData *data);
struct qt_touch_extension;
/* Autogenerated QT headers */
/*
Support for Wayland with QmlCompositor as Server
================================================
The Wayland video driver has support for some additional features when
using QtWayland's "qmlcompositor" as Wayland server. This is needed for touch
input when running SDL applications under a qmlcompositor Wayland server.
The files following headers have been
generated from the Wayland XML Protocol Definition in QtWayland as follows:
Clone QtWayland from Git:
http://qt.gitorious.org/qt/qtwayland/
Generate headers and glue code:
for extension in touch-extension surface-extension windowmanager; do
wayland-scanner client-header < src/extensions/$extension.xml > wayland-qt-$extension.h
wayland-scanner code < src/extensions/$extension.xml > wayland-qt-$extension.c
done
*/
/* wayland-qt-surface-extension.h */
struct wl_client;
struct wl_resource;
struct qt_surface_extension;
struct qt_extended_surface;
extern const struct wl_interface qt_surface_extension_interface;
extern const struct wl_interface qt_extended_surface_interface;
#define QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE 0
static inline void
qt_surface_extension_set_user_data(struct qt_surface_extension *qt_surface_extension, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) qt_surface_extension, user_data);
}
static inline void *
qt_surface_extension_get_user_data(struct qt_surface_extension *qt_surface_extension)
{
return wl_proxy_get_user_data((struct wl_proxy *) qt_surface_extension);
}
static inline void
qt_surface_extension_destroy(struct qt_surface_extension *qt_surface_extension)
{
Jan 9, 2014
Jan 9, 2014
93
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
94
95
96
97
98
99
100
101
102
103
104
105
}
static inline struct qt_extended_surface *
qt_surface_extension_get_extended_surface(struct qt_surface_extension *qt_surface_extension, struct wl_surface *surface)
{
struct wl_proxy *id;
id = wl_proxy_create((struct wl_proxy *) qt_surface_extension,
&qt_extended_surface_interface);
if (!id)
return NULL;
Jan 9, 2014
Jan 9, 2014
106
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
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
QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE, id, surface);
return (struct qt_extended_surface *) id;
}
#ifndef QT_EXTENDED_SURFACE_ORIENTATION_ENUM
#define QT_EXTENDED_SURFACE_ORIENTATION_ENUM
enum qt_extended_surface_orientation {
QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION = 0,
QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION = 1,
QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION = 2,
QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION = 4,
QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION = 8,
};
#endif /* QT_EXTENDED_SURFACE_ORIENTATION_ENUM */
#ifndef QT_EXTENDED_SURFACE_WINDOWFLAG_ENUM
#define QT_EXTENDED_SURFACE_WINDOWFLAG_ENUM
enum qt_extended_surface_windowflag {
QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES = 1,
QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP = 2,
};
#endif /* QT_EXTENDED_SURFACE_WINDOWFLAG_ENUM */
struct qt_extended_surface_listener {
/**
* onscreen_visibility - (none)
* @visible: (none)
*/
void (*onscreen_visibility)(void *data,
struct qt_extended_surface *qt_extended_surface,
int32_t visible);
/**
* set_generic_property - (none)
* @name: (none)
* @value: (none)
*/
void (*set_generic_property)(void *data,
struct qt_extended_surface *qt_extended_surface,
const char *name,
struct wl_array *value);
/**
* close - (none)
*/
void (*close)(void *data,
struct qt_extended_surface *qt_extended_surface);
};
static inline int
qt_extended_surface_add_listener(struct qt_extended_surface *qt_extended_surface,
const struct qt_extended_surface_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) qt_extended_surface,
(void (**)(void)) listener, data);
}
#define QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY 0
#define QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION 1
#define QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS 2
static inline void
qt_extended_surface_set_user_data(struct qt_extended_surface *qt_extended_surface, void *user_data)
{
Jan 9, 2014
Jan 9, 2014
170
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
171
172
173
174
175
}
static inline void *
qt_extended_surface_get_user_data(struct qt_extended_surface *qt_extended_surface)
{
Jan 9, 2014
Jan 9, 2014
176
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
177
178
179
180
181
}
static inline void
qt_extended_surface_destroy(struct qt_extended_surface *qt_extended_surface)
{
Jan 9, 2014
Jan 9, 2014
182
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
183
184
185
186
187
}
static inline void
qt_extended_surface_update_generic_property(struct qt_extended_surface *qt_extended_surface, const char *name, struct wl_array *value)
{
Jan 9, 2014
Jan 9, 2014
188
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
189
190
191
192
193
194
QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY, name, value);
}
static inline void
qt_extended_surface_set_content_orientation(struct qt_extended_surface *qt_extended_surface, int32_t orientation)
{
Jan 9, 2014
Jan 9, 2014
195
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
196
197
198
199
200
201
QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION, orientation);
}
static inline void
qt_extended_surface_set_window_flags(struct qt_extended_surface *qt_extended_surface, int32_t flags)
{
Jan 9, 2014
Jan 9, 2014
202
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
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
QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS, flags);
}
/* wayland-qt-touch-extension.h */
extern const struct wl_interface qt_touch_extension_interface;
#ifndef QT_TOUCH_EXTENSION_FLAGS_ENUM
#define QT_TOUCH_EXTENSION_FLAGS_ENUM
enum qt_touch_extension_flags {
QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH = 0x1,
};
#endif /* QT_TOUCH_EXTENSION_FLAGS_ENUM */
struct qt_touch_extension_listener {
/**
* touch - (none)
* @time: (none)
* @id: (none)
* @state: (none)
* @x: (none)
* @y: (none)
* @normalized_x: (none)
* @normalized_y: (none)
* @width: (none)
* @height: (none)
* @pressure: (none)
* @velocity_x: (none)
* @velocity_y: (none)
* @flags: (none)
* @rawdata: (none)
*/
void (*touch)(void *data,
struct qt_touch_extension *qt_touch_extension,
uint32_t time,
uint32_t id,
uint32_t state,
int32_t x,
int32_t y,
int32_t normalized_x,
int32_t normalized_y,
int32_t width,
int32_t height,
uint32_t pressure,
int32_t velocity_x,
int32_t velocity_y,
uint32_t flags,
struct wl_array *rawdata);
/**
* configure - (none)
* @flags: (none)
*/
void (*configure)(void *data,
struct qt_touch_extension *qt_touch_extension,
uint32_t flags);
};
static inline int
qt_touch_extension_add_listener(struct qt_touch_extension *qt_touch_extension,
const struct qt_touch_extension_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) qt_touch_extension,
(void (**)(void)) listener, data);
}
#define QT_TOUCH_EXTENSION_DUMMY 0
static inline void
qt_touch_extension_set_user_data(struct qt_touch_extension *qt_touch_extension, void *user_data)
{
Jan 9, 2014
Jan 9, 2014
273
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
274
275
276
277
278
}
static inline void *
qt_touch_extension_get_user_data(struct qt_touch_extension *qt_touch_extension)
{
Jan 9, 2014
Jan 9, 2014
279
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
280
281
282
283
284
}
static inline void
qt_touch_extension_destroy(struct qt_touch_extension *qt_touch_extension)
{
Jan 9, 2014
Jan 9, 2014
285
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
286
287
288
289
290
}
static inline void
qt_touch_extension_dummy(struct qt_touch_extension *qt_touch_extension)
{
Jan 9, 2014
Jan 9, 2014
291
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
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
QT_TOUCH_EXTENSION_DUMMY);
}
/* wayland-qt-windowmanager.h */
extern const struct wl_interface qt_windowmanager_interface;
struct qt_windowmanager_listener {
/**
* hints - (none)
* @show_is_fullscreen: (none)
*/
void (*hints)(void *data,
struct qt_windowmanager *qt_windowmanager,
int32_t show_is_fullscreen);
/**
* quit - (none)
*/
void (*quit)(void *data,
struct qt_windowmanager *qt_windowmanager);
};
static inline int
qt_windowmanager_add_listener(struct qt_windowmanager *qt_windowmanager,
const struct qt_windowmanager_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) qt_windowmanager,
(void (**)(void)) listener, data);
}
#define QT_WINDOWMANAGER_OPEN_URL 0
static inline void
qt_windowmanager_set_user_data(struct qt_windowmanager *qt_windowmanager, void *user_data)
{
Jan 9, 2014
Jan 9, 2014
328
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
329
330
331
332
333
}
static inline void *
qt_windowmanager_get_user_data(struct qt_windowmanager *qt_windowmanager)
{
Jan 9, 2014
Jan 9, 2014
334
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
335
336
337
338
339
}
static inline void
qt_windowmanager_destroy(struct qt_windowmanager *qt_windowmanager)
{
Jan 9, 2014
Jan 9, 2014
340
WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
341
342
343
344
345
}
static inline void
qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t remaining, const char *url)
{
Jan 9, 2014
Jan 9, 2014
346
WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
347
348
349
350
351
352
QT_WINDOWMANAGER_OPEN_URL, remaining, url);
}
#endif /* _SDL_waylandtouch_h */
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */