Don't include system versions of wayland protocol
wayland-client.h and wayland-server.h includes protocol generated for the version of wayland.xml corresponding to the libwayland version. This becomes a problem when we want to support a version of wayland.xml that's newer than the system libwayland. The solution is to include wayland-client-core.h and wayland-client-server.h instead. These headers don't include any wayland-scanner generated code, so we can safely compile and link code generated against the version of wayland.xml that we ship. [ChangeLog] Code generated by qtwaylandscanner now includes wayland-client-core.h and wayland-server-core.h instead of wayland-client.h and wayland-server.h. This might break source compatibility for code using custom wayland extensions. Fixes: QTBUG-70553 Change-Id: Ice0cdb60ecc4f936acc0e158b96f7978549f62c1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
72b789765e
commit
e7c0cbac89
@ -29,9 +29,7 @@ WAYLANDCLIENTSOURCES += \
|
||||
../extensions/qt-windowmanager.xml \
|
||||
../3rdparty/protocol/text-input-unstable-v2.xml \
|
||||
../3rdparty/protocol/xdg-output-unstable-v1.xml \
|
||||
|
||||
WAYLANDCLIENTSOURCES_SYSTEM += \
|
||||
../3rdparty/protocol/wayland.xml \
|
||||
../3rdparty/protocol/wayland.xml
|
||||
|
||||
SOURCES += qwaylandintegration.cpp \
|
||||
qwaylandnativeinterface.cpp \
|
||||
|
@ -51,7 +51,6 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <private/qwayland-wayland.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
|
||||
|
@ -53,8 +53,6 @@
|
||||
|
||||
#include <QtCore/QSize>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
@ -25,6 +25,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "qwayland-xdg-shell-unstable-v5_p.h"
|
||||
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_WARNING_PUSH
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
struct wl_registry;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
#include "wayland-client-core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -53,8 +53,6 @@
|
||||
|
||||
#include "qwayland-xdg-shell-unstable-v5_p.h"
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
||||
|
@ -56,8 +56,6 @@
|
||||
#include <QtCore/QSize>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
||||
|
@ -59,8 +59,6 @@
|
||||
#include <QtCore/QSize>
|
||||
#include <QtCore/QMargins>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindow;
|
||||
|
@ -60,8 +60,6 @@
|
||||
#include <QtCore/QSize>
|
||||
#include <QtGui/QRegion>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindow;
|
||||
|
@ -62,8 +62,6 @@
|
||||
#include <QtCore/QSize>
|
||||
#include <QtGui/QRegion>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindow;
|
||||
|
@ -61,8 +61,6 @@
|
||||
#include <QtGui/QImage>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -56,8 +56,7 @@
|
||||
#include <QtCore/QSize>
|
||||
#include <QtCore/QRect>
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -59,8 +59,6 @@
|
||||
#include <QtCore/QWaitCondition>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandshm_p.h>
|
||||
|
@ -56,7 +56,6 @@
|
||||
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <QtWaylandClient/private/qwayland-surface-extension.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -62,6 +62,9 @@
|
||||
#include <QtWaylandClient/private/qwayland-text-input-unstable-v2.h>
|
||||
#include <qwaylandinputmethodeventbuilder_p.h>
|
||||
|
||||
struct wl_callback;
|
||||
struct wl_callback_listener;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(qLcQpaInputMethods)
|
||||
|
@ -61,8 +61,6 @@
|
||||
#include <qpa/qplatformscreen.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
|
||||
#if QT_CONFIG(xkbcommon_evdev)
|
||||
|
@ -54,8 +54,6 @@
|
||||
#include <QtCore/QSize>
|
||||
#include <QObject>
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
|
||||
|
@ -49,8 +49,7 @@
|
||||
#include <QtGui/QPainter>
|
||||
#include <QMutexLocker>
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
@ -51,8 +51,6 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QScopedPointer>
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <QtServiceSupport/private/qgenericunixservices_p.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-qt-windowmanager.h>
|
||||
|
@ -440,7 +440,7 @@ bool Scanner::process()
|
||||
printf("#ifndef %s\n", inclusionGuard.constData());
|
||||
printf("#define %s\n", inclusionGuard.constData());
|
||||
printf("\n");
|
||||
printf("#include \"wayland-server.h\"\n");
|
||||
printf("#include \"wayland-server-core.h\"\n");
|
||||
if (m_headerPath.isEmpty())
|
||||
printf("#include \"wayland-%s-server-protocol.h\"\n", QByteArray(m_protocolName).replace('_', '-').constData());
|
||||
else
|
||||
@ -938,6 +938,8 @@ bool Scanner::process()
|
||||
printf("#include <QByteArray>\n");
|
||||
printf("#include <QString>\n");
|
||||
printf("\n");
|
||||
printf("struct wl_registry;\n");
|
||||
printf("\n");
|
||||
printf("QT_BEGIN_NAMESPACE\n");
|
||||
printf("QT_WARNING_PUSH\n");
|
||||
printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n");
|
||||
@ -1055,6 +1057,17 @@ bool Scanner::process()
|
||||
printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n");
|
||||
printf("\n");
|
||||
printf("namespace QtWayland {\n");
|
||||
printf("\n");
|
||||
|
||||
// wl_registry_bind is part of the protocol, so we can't use that... instead we use core
|
||||
// libwayland API to do the same thing a wayland-scanner generated wl_registry_bind would.
|
||||
printf("static inline void *wlRegistryBind(struct ::wl_registry *registry, uint32_t name, const struct ::wl_interface *interface, uint32_t version)\n");
|
||||
printf("{\n");
|
||||
printf(" const uint32_t bindOpCode = 0;\n");
|
||||
printf(" return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,\n");
|
||||
printf(" bindOpCode, interface, version, name, interface->name, version, NULL);\n");
|
||||
printf("}\n");
|
||||
printf("\n");
|
||||
for (int j = 0; j < interfaces.size(); ++j) {
|
||||
const WaylandInterface &interface = interfaces.at(j);
|
||||
|
||||
@ -1095,7 +1108,7 @@ bool Scanner::process()
|
||||
|
||||
printf(" void %s::init(struct ::wl_registry *registry, int id, int version)\n", interfaceName);
|
||||
printf(" {\n");
|
||||
printf(" m_%s = static_cast<struct ::%s *>(wl_registry_bind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName);
|
||||
printf(" m_%s = static_cast<struct ::%s *>(wlRegistryBind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName);
|
||||
if (hasEvents)
|
||||
printf(" init_listener();\n");
|
||||
printf(" }\n");
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
#include <qglobal.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wayland-server-core.h>
|
||||
|
||||
#include <QImage>
|
||||
#include <QMutex>
|
||||
@ -121,7 +121,6 @@ private:
|
||||
|
||||
wl_display *m_display = nullptr;
|
||||
wl_event_loop *m_loop = nullptr;
|
||||
wl_shm *m_shm = nullptr;
|
||||
int m_fd = -1;
|
||||
|
||||
uint32_t m_time = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user