24 #include "../../SDL_internal.h"
26 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
32 #include "../../events/SDL_touch_c.h"
34 struct SDL_WaylandTouch {
35 struct qt_touch_extension *touch_extension;
43 enum QtWaylandTouchPointState {
44 QtWaylandTouchPointPressed = 0x01,
45 QtWaylandTouchPointMoved = 0x02,
50 QtWaylandTouchPointReleased = 0x08,
54 touch_handle_touch(
void *
data,
55 struct qt_touch_extension *qt_touch_extension,
69 struct wl_array *rawdata)
76 float FIXED_TO_FLOAT = 1. / 10000.;
77 float xf = FIXED_TO_FLOAT *
x;
78 float yf = FIXED_TO_FLOAT *
y;
80 float PRESSURE_TO_FLOAT = 1. / 255.;
81 float pressuref = PRESSURE_TO_FLOAT * pressure;
97 SDL_Log(
"error: can't add touch %s, %d", __FILE__, __LINE__);
107 switch (touchState) {
108 case QtWaylandTouchPointPressed:
109 case QtWaylandTouchPointReleased:
114 case QtWaylandTouchPointMoved:
124 touch_handle_configure(
void *
data,
125 struct qt_touch_extension *qt_touch_extension,
133 static const struct qt_touch_extension_listener touch_listener = {
135 touch_handle_configure,
138 static const struct wl_interface *qt_touch_extension_types[] = {
155 static const struct wl_message qt_touch_extension_requests[] = {
156 {
"dummy",
"", qt_touch_extension_types + 0 },
159 static const struct wl_message qt_touch_extension_events[] = {
160 {
"touch",
"uuuiiiiiiuiiua", qt_touch_extension_types + 0 },
161 {
"configure",
"u", qt_touch_extension_types + 0 },
164 WL_EXPORT
const struct wl_interface qt_touch_extension_interface = {
165 "qt_touch_extension", 1,
166 1, qt_touch_extension_requests,
167 2, qt_touch_extension_events,
173 static const struct wl_interface *qt_windowmanager_types[] = {
178 static const struct wl_message qt_windowmanager_requests[] = {
179 {
"open_url",
"us", qt_windowmanager_types + 0 },
182 static const struct wl_message qt_windowmanager_events[] = {
183 {
"hints",
"i", qt_windowmanager_types + 0 },
184 {
"quit",
"", qt_windowmanager_types + 0 },
187 WL_EXPORT
const struct wl_interface qt_windowmanager_interface = {
188 "qt_windowmanager", 1,
189 1, qt_windowmanager_requests,
190 2, qt_windowmanager_events,
195 #ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
199 static const struct wl_interface *qt_surface_extension_types[] = {
202 &qt_extended_surface_interface,
203 #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
214 static const struct wl_message qt_surface_extension_requests[] = {
215 {
"get_extended_surface",
"no", qt_surface_extension_types + 2 },
218 WL_EXPORT
const struct wl_interface qt_surface_extension_interface = {
219 "qt_surface_extension", 1,
220 1, qt_surface_extension_requests,
224 static const struct wl_message qt_extended_surface_requests[] = {
225 {
"update_generic_property",
"sa", qt_surface_extension_types + 0 },
226 {
"set_content_orientation",
"i", qt_surface_extension_types + 0 },
227 {
"set_window_flags",
"i", qt_surface_extension_types + 0 },
230 static const struct wl_message qt_extended_surface_events[] = {
231 {
"onscreen_visibility",
"i", qt_surface_extension_types + 0 },
232 {
"set_generic_property",
"sa", qt_surface_extension_types + 0 },
233 {
"close",
"", qt_surface_extension_types + 0 },
236 WL_EXPORT
const struct wl_interface qt_extended_surface_interface = {
237 "qt_extended_surface", 1,
238 3, qt_extended_surface_requests,
239 3, qt_extended_surface_events,
247 struct SDL_WaylandTouch *touch;
250 Wayland_touch_destroy(
data);
257 touch->touch_extension =
wl_registry_bind(
data->registry,
id, &qt_touch_extension_interface, 1);
258 qt_touch_extension_add_listener(touch->touch_extension, &touch_listener,
data);
265 struct SDL_WaylandTouch *touch =
data->touch;
266 if (touch->touch_extension) {
267 qt_touch_extension_destroy(touch->touch_extension);