24 #include "../../SDL_internal.h" 26 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 30 #include "../../events/SDL_touch_c.h" 32 struct SDL_WaylandTouch {
33 struct qt_touch_extension *touch_extension;
41 enum QtWaylandTouchPointState {
42 QtWaylandTouchPointPressed = 0x01,
43 QtWaylandTouchPointMoved = 0x02,
48 QtWaylandTouchPointReleased = 0x08,
52 touch_handle_touch(
void *
data,
53 struct qt_touch_extension *qt_touch_extension,
67 struct wl_array *rawdata)
74 float FIXED_TO_FLOAT = 1. / 10000.;
75 float xf = FIXED_TO_FLOAT *
x;
76 float yf = FIXED_TO_FLOAT *
y;
78 float PRESSURE_TO_FLOAT = 1. / 255.;
79 float pressuref = PRESSURE_TO_FLOAT * pressure;
81 uint32_t touchState = state & 0xFFFF;
93 SDL_Log(
"error: can't add touch %s, %d", __FILE__, __LINE__);
97 case QtWaylandTouchPointPressed:
98 case QtWaylandTouchPointReleased:
103 case QtWaylandTouchPointMoved:
113 touch_handle_configure(
void *data,
114 struct qt_touch_extension *qt_touch_extension,
122 static const struct qt_touch_extension_listener touch_listener = {
124 touch_handle_configure,
127 static const struct wl_interface *qt_touch_extension_types[] = {
144 static const struct wl_message qt_touch_extension_requests[] = {
145 {
"dummy",
"", qt_touch_extension_types + 0 },
148 static const struct wl_message qt_touch_extension_events[] = {
149 {
"touch",
"uuuiiiiiiuiiua", qt_touch_extension_types + 0 },
150 {
"configure",
"u", qt_touch_extension_types + 0 },
153 WL_EXPORT
const struct wl_interface qt_touch_extension_interface = {
154 "qt_touch_extension", 1,
155 1, qt_touch_extension_requests,
156 2, qt_touch_extension_events,
162 static const struct wl_interface *qt_windowmanager_types[] = {
167 static const struct wl_message qt_windowmanager_requests[] = {
168 {
"open_url",
"us", qt_windowmanager_types + 0 },
171 static const struct wl_message qt_windowmanager_events[] = {
172 {
"hints",
"i", qt_windowmanager_types + 0 },
173 {
"quit",
"", qt_windowmanager_types + 0 },
176 WL_EXPORT
const struct wl_interface qt_windowmanager_interface = {
177 "qt_windowmanager", 1,
178 1, qt_windowmanager_requests,
179 2, qt_windowmanager_events,
184 extern const struct wl_interface qt_extended_surface_interface;
185 #ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC 189 static const struct wl_interface *qt_surface_extension_types[] = {
192 &qt_extended_surface_interface,
193 #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC 204 static const struct wl_message qt_surface_extension_requests[] = {
205 {
"get_extended_surface",
"no", qt_surface_extension_types + 2 },
208 WL_EXPORT
const struct wl_interface qt_surface_extension_interface = {
209 "qt_surface_extension", 1,
210 1, qt_surface_extension_requests,
214 static const struct wl_message qt_extended_surface_requests[] = {
215 {
"update_generic_property",
"sa", qt_surface_extension_types + 0 },
216 {
"set_content_orientation",
"i", qt_surface_extension_types + 0 },
217 {
"set_window_flags",
"i", qt_surface_extension_types + 0 },
220 static const struct wl_message qt_extended_surface_events[] = {
221 {
"onscreen_visibility",
"i", qt_surface_extension_types + 0 },
222 {
"set_generic_property",
"sa", qt_surface_extension_types + 0 },
223 {
"close",
"", qt_surface_extension_types + 0 },
226 WL_EXPORT
const struct wl_interface qt_extended_surface_interface = {
227 "qt_extended_surface", 1,
228 3, qt_extended_surface_requests,
229 3, qt_extended_surface_events,
237 struct SDL_WaylandTouch *touch;
240 Wayland_touch_destroy(data);
244 data->touch =
SDL_malloc(
sizeof(
struct SDL_WaylandTouch));
248 qt_touch_extension_add_listener(touch->touch_extension, &touch_listener, data);
255 struct SDL_WaylandTouch *touch = data->touch;
256 if (touch->touch_extension) {
257 qt_touch_extension_destroy(touch->touch_extension);
EGLSurface EGLnsecsANDROID time
GLint GLint GLint GLint GLint x
static void * wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version)
int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, float x, float y, float pressure)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, float x, float y, float pressure)
const struct wl_interface wl_surface_interface
GLint GLint GLint GLint GLint GLint y
int SDL_AddTouch(SDL_TouchID touchID, const char *name)
GLint GLint GLsizei GLsizei height
struct wl_registry * registry