wayland: Remove QtWayland extensions

These were added a very long time ago and seem to serve no purpose now, as the functionality they provided is now in core Wayland protocols, current information on their usage and status is nonexistent, no modern compositor seems to support them, and the code paths are untested and subject to bit-rot at this point. It also causes duplicate symbol issues when statically linking an application to both Qt and SDL.
main
Frank Praznik 2023-11-07 10:36:07 -05:00
parent 5f920d6639
commit 1a57f6bb29
9 changed files with 0 additions and 819 deletions

View File

@ -329,7 +329,6 @@ set_option(SDL_WAYLAND "Use Wayland video driver" ${UNIX_SYS})
dep_option(SDL_WAYLAND_SHARED "Dynamically load Wayland support" ON "SDL_WAYLAND" OFF) dep_option(SDL_WAYLAND_SHARED "Dynamically load Wayland support" ON "SDL_WAYLAND" OFF)
dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" OFF) dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" OFF)
dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR;SDL_WAYLAND_SHARED" OFF) dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR;SDL_WAYLAND_SHARED" OFF)
dep_option(SDL_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "SDL_WAYLAND" OFF)
dep_option(SDL_RPI "Use Raspberry Pi video driver" ON "UNIX_SYS;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF) dep_option(SDL_RPI "Use Raspberry Pi video driver" ON "UNIX_SYS;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF)
dep_option(SDL_ROCKCHIP "Use ROCKCHIP Hardware Acceleration video driver" ON "UNIX_SYS;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF) dep_option(SDL_ROCKCHIP "Use ROCKCHIP Hardware Acceleration video driver" ON "UNIX_SYS;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF)
set_option(SDL_COCOA "Use Cocoa video driver" ${APPLE}) set_option(SDL_COCOA "Use Cocoa video driver" ${APPLE})

View File

@ -533,11 +533,6 @@ macro(CheckWayland)
WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL3_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}") WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL3_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}")
endforeach() endforeach()
if(SDL_WAYLAND_QT_TOUCH)
set(HAVE_WAYLAND_QT_TOUCH TRUE)
set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
endif()
if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO)
message(WARNING "You must have SDL_LoadObject() support for dynamic Wayland loading") message(WARNING "You must have SDL_LoadObject() support for dynamic Wayland loading")
endif() endif()

View File

@ -393,7 +393,6 @@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
#cmakedefine SDL_VIDEO_DRIVER_WINRT @SDL_VIDEO_DRIVER_WINRT@ #cmakedefine SDL_VIDEO_DRIVER_WINRT @SDL_VIDEO_DRIVER_WINRT@
#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@ #cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@

View File

@ -1,283 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 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.
*/
/* Contributed by Thomas Perl <thomas.perl@jollamobile.com> */
#include "SDL_internal.h"
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
#include "SDL_waylandtouch.h"
#include "SDL_waylandevents_c.h"
#include "../../events/SDL_touch_c.h"
struct SDL_WaylandTouch
{
struct qt_touch_extension *touch_extension;
};
/**
* Qt TouchPointState
* adapted from qtbase/src/corelib/global/qnamespace.h
**/
enum QtWaylandTouchPointState
{
QtWaylandTouchPointPressed = 0x01,
QtWaylandTouchPointMoved = 0x02,
/*
Never sent by the server:
QtWaylandTouchPointStationary = 0x04,
*/
QtWaylandTouchPointReleased = 0x08,
};
static void touch_handle_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)
{
/**
* Event is assembled in QtWayland in TouchExtensionGlobal::postTouchEvent
* (src/compositor/wayland_wrapper/qwltouch.cpp)
**/
SDL_VideoData *viddata = data;
float FIXED_TO_FLOAT = 1. / 10000.;
float xf = FIXED_TO_FLOAT * normalized_x;
float yf = FIXED_TO_FLOAT * normalized_y;
float PRESSURE_TO_FLOAT = 1. / 255.;
float pressuref = PRESSURE_TO_FLOAT * pressure;
uint32_t touchState = state & 0xFFFF;
/*
Other fields that are sent by the server (qwltouch.cpp),
but not used at the moment can be decoded in this way:
uint32_t sentPointCount = state >> 16;
uint32_t touchFlags = flags & 0xFFFF;
uint32_t capabilities = flags >> 16;
*/
SDL_Window *window = NULL;
SDL_TouchID deviceId = 1;
if (SDL_AddTouch(deviceId, SDL_TOUCH_DEVICE_DIRECT, "qt_touch_extension") < 0) {
SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
}
/* FIXME: This should be the window the given wayland surface is associated
* with, but how do we get the wayland surface? */
window = SDL_GetMouseFocus();
if (window == NULL) {
window = SDL_GetKeyboardFocus();
}
switch (touchState) {
case QtWaylandTouchPointPressed:
case QtWaylandTouchPointReleased:
SDL_SendTouch(Wayland_GetTouchTimestamp(viddata->input, time), deviceId, (SDL_FingerID)id,
window, (touchState == QtWaylandTouchPointPressed), xf, yf, pressuref);
break;
case QtWaylandTouchPointMoved:
SDL_SendTouchMotion(Wayland_GetTouchTimestamp(viddata->input, time), deviceId, (SDL_FingerID)id,
window, xf, yf, pressuref);
break;
default:
/* Should not happen */
break;
}
}
static void touch_handle_configure(void *data,
struct qt_touch_extension *qt_touch_extension,
uint32_t flags)
{
}
/* wayland-qt-touch-extension.c BEGINS */
static const struct qt_touch_extension_listener touch_listener = {
touch_handle_touch,
touch_handle_configure,
};
static const struct wl_interface *qt_touch_extension_types[] = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
static const struct wl_message qt_touch_extension_requests[] = {
{ "dummy", "", qt_touch_extension_types + 0 },
};
static const struct wl_message qt_touch_extension_events[] = {
{ "touch", "uuuiiiiiiuiiua", qt_touch_extension_types + 0 },
{ "configure", "u", qt_touch_extension_types + 0 },
};
const struct wl_interface qt_touch_extension_interface = {
"qt_touch_extension",
1,
1,
qt_touch_extension_requests,
2,
qt_touch_extension_events,
};
/* wayland-qt-touch-extension.c ENDS */
/* wayland-qt-windowmanager.c BEGINS */
static const struct wl_interface *qt_windowmanager_types[] = {
NULL,
NULL,
};
static const struct wl_message qt_windowmanager_requests[] = {
{ "open_url", "us", qt_windowmanager_types + 0 },
};
static const struct wl_message qt_windowmanager_events[] = {
{ "hints", "i", qt_windowmanager_types + 0 },
{ "quit", "", qt_windowmanager_types + 0 },
};
const struct wl_interface qt_windowmanager_interface = {
"qt_windowmanager",
1,
1,
qt_windowmanager_requests,
2,
qt_windowmanager_events,
};
/* wayland-qt-windowmanager.c ENDS */
/* wayland-qt-surface-extension.c BEGINS */
#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
extern const struct wl_interface wl_surface_interface;
#endif
static const struct wl_interface *qt_surface_extension_types[] = {
NULL,
NULL,
&qt_extended_surface_interface,
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
/* FIXME: Set this dynamically to (*WAYLAND_wl_surface_interface) ?
* The value comes from auto generated code and does
* not appear to actually be used anywhere
*/
NULL,
#else
&wl_surface_interface,
#endif
};
static const struct wl_message qt_surface_extension_requests[] = {
{ "get_extended_surface", "no", qt_surface_extension_types + 2 },
};
const struct wl_interface qt_surface_extension_interface = {
"qt_surface_extension",
1,
1,
qt_surface_extension_requests,
0,
NULL,
};
static const struct wl_message qt_extended_surface_requests[] = {
{ "update_generic_property", "sa", qt_surface_extension_types + 0 },
{ "set_content_orientation", "i", qt_surface_extension_types + 0 },
{ "set_window_flags", "i", qt_surface_extension_types + 0 },
};
static const struct wl_message qt_extended_surface_events[] = {
{ "onscreen_visibility", "i", qt_surface_extension_types + 0 },
{ "set_generic_property", "sa", qt_surface_extension_types + 0 },
{ "close", "", qt_surface_extension_types + 0 },
};
const struct wl_interface qt_extended_surface_interface = {
"qt_extended_surface",
1,
3,
qt_extended_surface_requests,
3,
qt_extended_surface_events,
};
/* wayland-qt-surface-extension.c ENDS */
void Wayland_touch_create(SDL_VideoData *data, uint32_t id)
{
struct SDL_WaylandTouch *touch;
if (data->touch) {
Wayland_touch_destroy(data);
}
/* !!! FIXME: check for failure, call SDL_OutOfMemory() */
data->touch = SDL_malloc(sizeof(struct SDL_WaylandTouch));
touch = data->touch;
touch->touch_extension = wl_registry_bind(data->registry, id, &qt_touch_extension_interface, 1);
qt_touch_extension_add_listener(touch->touch_extension, &touch_listener, data);
}
void Wayland_touch_destroy(SDL_VideoData *data)
{
if (data->touch) {
struct SDL_WaylandTouch *touch = data->touch;
if (touch->touch_extension) {
qt_touch_extension_destroy(touch->touch_extension);
}
SDL_free(data->touch);
data->touch = NULL;
}
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */

View File

@ -1,334 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 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.
*/
#ifndef SDL_waylandtouch_h_
#define SDL_waylandtouch_h_
#include "SDL_internal.h"
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
#include "SDL_waylandvideo.h"
#include <stdint.h>
#include <stddef.h>
#include "wayland-util.h"
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)
{
WAYLAND_wl_proxy_destroy((struct wl_proxy *)qt_surface_extension);
}
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 == NULL)
return NULL;
WAYLAND_wl_proxy_marshal((struct wl_proxy *)qt_surface_extension,
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)
{
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *)qt_extended_surface, user_data);
}
static inline void *qt_extended_surface_get_user_data(struct qt_extended_surface *qt_extended_surface)
{
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *)qt_extended_surface);
}
static inline void qt_extended_surface_destroy(struct qt_extended_surface *qt_extended_surface)
{
WAYLAND_wl_proxy_destroy((struct wl_proxy *)qt_extended_surface);
}
static inline void qt_extended_surface_update_generic_property(struct qt_extended_surface *qt_extended_surface, const char *name, struct wl_array *value)
{
WAYLAND_wl_proxy_marshal((struct wl_proxy *)qt_extended_surface,
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)
{
WAYLAND_wl_proxy_marshal((struct wl_proxy *)qt_extended_surface,
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)
{
WAYLAND_wl_proxy_marshal((struct wl_proxy *)qt_extended_surface,
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)
{
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *)qt_touch_extension, user_data);
}
static inline void *qt_touch_extension_get_user_data(struct qt_touch_extension *qt_touch_extension)
{
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *)qt_touch_extension);
}
static inline void qt_touch_extension_destroy(struct qt_touch_extension *qt_touch_extension)
{
WAYLAND_wl_proxy_destroy((struct wl_proxy *)qt_touch_extension);
}
static inline void qt_touch_extension_dummy(struct qt_touch_extension *qt_touch_extension)
{
WAYLAND_wl_proxy_marshal((struct wl_proxy *)qt_touch_extension,
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)
{
WAYLAND_wl_proxy_set_user_data((struct wl_proxy *)qt_windowmanager, user_data);
}
static inline void *qt_windowmanager_get_user_data(struct qt_windowmanager *qt_windowmanager)
{
return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *)qt_windowmanager);
}
static inline void qt_windowmanager_destroy(struct qt_windowmanager *qt_windowmanager)
{
WAYLAND_wl_proxy_destroy((struct wl_proxy *)qt_windowmanager);
}
static inline void qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t remaining, const char *url)
{
WAYLAND_wl_proxy_marshal((struct wl_proxy *)qt_windowmanager,
QT_WINDOWMANAGER_OPEN_URL, remaining, url);
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
#endif /* SDL_waylandtouch_h_ */

View File

@ -32,7 +32,6 @@
#include "SDL_waylandopengles.h" #include "SDL_waylandopengles.h"
#include "SDL_waylandmouse.h" #include "SDL_waylandmouse.h"
#include "SDL_waylandkeyboard.h" #include "SDL_waylandkeyboard.h"
#include "SDL_waylandtouch.h"
#include "SDL_waylandclipboard.h" #include "SDL_waylandclipboard.h"
#include "SDL_waylandvulkan.h" #include "SDL_waylandvulkan.h"
@ -711,23 +710,6 @@ static void Wayland_init_xdg_output(SDL_VideoData *d)
} }
} }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
static void windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager,
int32_t show_is_fullscreen)
{
}
static void windowmanager_quit(void *data, struct qt_windowmanager *qt_windowmanager)
{
SDL_SendQuit();
}
static const struct qt_windowmanager_listener windowmanager_listener = {
windowmanager_hints,
windowmanager_quit,
};
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
static void handle_ping_xdg_wm_base(void *data, struct xdg_wm_base *xdg, uint32_t serial) static void handle_ping_xdg_wm_base(void *data, struct xdg_wm_base *xdg, uint32_t serial)
{ {
xdg_wm_base_pong(xdg, serial); xdg_wm_base_pong(xdg, serial);
@ -804,17 +786,6 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint
if (d->input) { if (d->input) {
Wayland_RegisterTimestampListeners(d->input); Wayland_RegisterTimestampListeners(d->input);
} }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
} else if (SDL_strcmp(interface, "qt_touch_extension") == 0) {
Wayland_touch_create(d, id);
} else if (SDL_strcmp(interface, "qt_surface_extension") == 0) {
d->surface_extension = wl_registry_bind(registry, id,
&qt_surface_extension_interface, 1);
} else if (SDL_strcmp(interface, "qt_windowmanager") == 0) {
d->windowmanager = wl_registry_bind(registry, id,
&qt_windowmanager_interface, 1);
qt_windowmanager_add_listener(d->windowmanager, &windowmanager_listener, d);
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
} }
} }
@ -991,19 +962,6 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
WAYLAND_xkb_context_unref(data->xkb_context); WAYLAND_xkb_context_unref(data->xkb_context);
data->xkb_context = NULL; data->xkb_context = NULL;
} }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
if (data->windowmanager) {
qt_windowmanager_destroy(data->windowmanager);
data->windowmanager = NULL;
}
if (data->surface_extension) {
qt_surface_extension_destroy(data->surface_extension);
data->surface_extension = NULL;
}
Wayland_touch_destroy(data);
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
if (data->tablet_manager) { if (data->tablet_manager) {
zwp_tablet_manager_v2_destroy((struct zwp_tablet_manager_v2 *)data->tablet_manager); zwp_tablet_manager_v2_destroy((struct zwp_tablet_manager_v2 *)data->tablet_manager);

View File

@ -35,12 +35,6 @@ struct xkb_context;
struct SDL_WaylandInput; struct SDL_WaylandInput;
struct SDL_WaylandTabletManager; struct SDL_WaylandTabletManager;
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
struct SDL_WaylandTouch;
struct qt_surface_extension;
struct qt_windowmanager;
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
typedef struct typedef struct
{ {
struct wl_cursor_theme *theme; struct wl_cursor_theme *theme;
@ -84,12 +78,6 @@ struct SDL_VideoData
struct SDL_WaylandTabletManager *tablet_manager; struct SDL_WaylandTabletManager *tablet_manager;
struct wl_list output_list; struct wl_list output_list;
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
struct SDL_WaylandTouch *touch;
struct qt_surface_extension *surface_extension;
struct qt_windowmanager *windowmanager;
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
int relative_mouse_mode; int relative_mouse_mode;
}; };

View File

@ -30,7 +30,6 @@
#include "SDL_waylandevents_c.h" #include "SDL_waylandevents_c.h"
#include "SDL_waylandwindow.h" #include "SDL_waylandwindow.h"
#include "SDL_waylandvideo.h" #include "SDL_waylandvideo.h"
#include "SDL_waylandtouch.h"
#include "../../SDL_hints_c.h" #include "../../SDL_hints_c.h"
#include "xdg-shell-client-protocol.h" #include "xdg-shell-client-protocol.h"
@ -1100,31 +1099,6 @@ static struct libdecor_frame_interface libdecor_frame_interface = {
}; };
#endif #endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
static void handle_onscreen_visibility(void *data,
struct qt_extended_surface *qt_extended_surface, int32_t visible)
{
}
static void handle_set_generic_property(void *data,
struct qt_extended_surface *qt_extended_surface, const char *name,
struct wl_array *value)
{
}
static void handle_close(void *data, struct qt_extended_surface *qt_extended_surface)
{
SDL_WindowData *window = (SDL_WindowData *)data;
SDL_SendWindowEvent(window->sdlwindow, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
}
static const struct qt_extended_surface_listener extended_surface_listener = {
handle_onscreen_visibility,
handle_set_generic_property,
handle_close,
};
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
static void Wayland_HandlePreferredScaleChanged(SDL_WindowData *window_data, float factor) static void Wayland_HandlePreferredScaleChanged(SDL_WindowData *window_data, float factor)
{ {
const float old_factor = window_data->windowed_scale_factor; const float old_factor = window_data->windowed_scale_factor;
@ -1785,92 +1759,6 @@ int Wayland_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOpe
return 0; return 0;
} }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
static void SDLCALL QtExtendedSurface_OnHintChanged(void *userdata, const char *name,
const char *oldValue, const char *newValue)
{
struct qt_extended_surface *qt_extended_surface = userdata;
int i;
static struct
{
const char *name;
int32_t value;
} orientations[] = {
{ "portrait", QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION },
{ "landscape", QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION },
{ "inverted-portrait", QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION },
{ "inverted-landscape", QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION }
};
if (name == NULL) {
return;
}
if (SDL_strcmp(name, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION) == 0) {
int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
if (newValue != NULL) {
const char *value_attempt = newValue;
orientation = 0;
while (value_attempt != NULL && *value_attempt != 0) {
const char *value_attempt_end = SDL_strchr(value_attempt, ',');
size_t value_attempt_len = (value_attempt_end != NULL) ? (value_attempt_end - value_attempt)
: SDL_strlen(value_attempt);
for (i = 0; i < SDL_arraysize(orientations); i += 1) {
if ((value_attempt_len == SDL_strlen(orientations[i].name)) &&
(SDL_strncasecmp(orientations[i].name, value_attempt, value_attempt_len) == 0)) {
orientation |= orientations[i].value;
break;
}
}
value_attempt = (value_attempt_end != NULL) ? (value_attempt_end + 1) : NULL;
}
}
qt_extended_surface_set_content_orientation(qt_extended_surface, orientation);
} else if (SDL_strcmp(name, SDL_HINT_QTWAYLAND_WINDOW_FLAGS) == 0) {
uint32_t flags = 0;
if (newValue != NULL) {
char *tmp = SDL_strdup(newValue);
char *saveptr = NULL;
char *flag = SDL_strtok_r(tmp, " ", &saveptr);
while (flag) {
if (SDL_strcmp(flag, "OverridesSystemGestures") == 0) {
flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
} else if (SDL_strcmp(flag, "StaysOnTop") == 0) {
flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP;
} else if (SDL_strcmp(flag, "BypassWindowManager") == 0) {
// See https://github.com/qtproject/qtwayland/commit/fb4267103d
flags |= 4 /* QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER */;
}
flag = SDL_strtok_r(NULL, " ", &saveptr);
}
SDL_free(tmp);
}
qt_extended_surface_set_window_flags(qt_extended_surface, flags);
}
}
static void QtExtendedSurface_Subscribe(struct qt_extended_surface *surface, const char *name)
{
SDL_AddHintCallback(name, QtExtendedSurface_OnHintChanged, surface);
}
static void QtExtendedSurface_Unsubscribe(struct qt_extended_surface *surface, const char *name)
{
SDL_DelHintCallback(name, QtExtendedSurface_OnHintChanged, surface);
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
void Wayland_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, void Wayland_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window,
SDL_VideoDisplay *display, SDL_bool fullscreen) SDL_VideoDisplay *display, SDL_bool fullscreen)
{ {
@ -2173,16 +2061,6 @@ int Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
data->surface_frame_callback = wl_surface_frame(data->surface); data->surface_frame_callback = wl_surface_frame(data->surface);
wl_callback_add_listener(data->surface_frame_callback, &surface_frame_listener, data); wl_callback_add_listener(data->surface_frame_callback, &surface_frame_listener, data);
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
if (c->surface_extension) {
data->extended_surface = qt_surface_extension_get_extended_surface(
c->surface_extension, data->surface);
QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION);
QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS);
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
if (window->flags & SDL_WINDOW_TRANSPARENT) { if (window->flags & SDL_WINDOW_TRANSPARENT) {
if (_this->gl_config.alpha_size == 0) { if (_this->gl_config.alpha_size == 0) {
_this->gl_config.alpha_size = 8; _this->gl_config.alpha_size = 8;
@ -2202,14 +2080,6 @@ int Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
#endif #endif
} }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
if (data->extended_surface) {
qt_extended_surface_set_user_data(data->extended_surface, data);
qt_extended_surface_add_listener(data->extended_surface,
&extended_surface_listener, data);
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
if (c->relative_mouse_mode) { if (c->relative_mouse_mode) {
Wayland_input_lock_pointer(c->input); Wayland_input_lock_pointer(c->input);
} }
@ -2434,13 +2304,6 @@ void Wayland_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
wl_callback_destroy(wind->surface_frame_callback); wl_callback_destroy(wind->surface_frame_callback);
} }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
if (wind->extended_surface) {
QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION);
QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS);
qt_extended_surface_destroy(wind->extended_surface);
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
wl_surface_destroy(wind->surface); wl_surface_destroy(wind->surface);
SDL_free(wind); SDL_free(wind);

View File

@ -102,10 +102,6 @@ struct SDL_WindowData
SDL_AtomicInt swap_interval_ready; SDL_AtomicInt swap_interval_ready;
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
struct qt_extended_surface *extended_surface;
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
SDL_DisplayData **outputs; SDL_DisplayData **outputs;
int num_outputs; int num_outputs;