Explicitly define the interface versions
Currently a global is bound with the version the interface has in the xml file. This is a problem for apps that explicitly link to libwayland-client because they may link to a newer libwayland, so the version of some interface may be higher than the one that it is actually implemented. Change-Id: Id0dbe6c0f1e05fe91954b9d8d9472d42d2053cdc Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
parent
f4e576fbe9
commit
611716293c
@ -45,7 +45,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QWaylandHardwareIntegration::QWaylandHardwareIntegration(struct ::wl_registry *registry, int id)
|
QWaylandHardwareIntegration::QWaylandHardwareIntegration(struct ::wl_registry *registry, int id)
|
||||||
: qt_hardware_integration(registry, id)
|
: qt_hardware_integration(registry, id, 1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id)
|
QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id)
|
||||||
: wl_data_device_manager(display->wl_registry(), id)
|
: wl_data_device_manager(display->wl_registry(), id, 1)
|
||||||
, m_display(display)
|
, m_display(display)
|
||||||
{
|
{
|
||||||
// Create transfer devices for all input devices.
|
// Create transfer devices for all input devices.
|
||||||
|
@ -219,33 +219,33 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
// We need to get the output events before creating surfaces
|
// We need to get the output events before creating surfaces
|
||||||
forceRoundTrip();
|
forceRoundTrip();
|
||||||
} else if (interface == QStringLiteral("wl_compositor")) {
|
} else if (interface == QStringLiteral("wl_compositor")) {
|
||||||
mCompositor.init(registry, id);
|
mCompositor.init(registry, id, 3);
|
||||||
} else if (interface == QStringLiteral("wl_shm")) {
|
} else if (interface == QStringLiteral("wl_shm")) {
|
||||||
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
|
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
|
||||||
} else if (interface == QStringLiteral("xdg_shell")
|
} else if (interface == QStringLiteral("xdg_shell")
|
||||||
&& qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) {
|
&& qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) {
|
||||||
mShellXdg.reset(new QWaylandXdgShell(registry,id));
|
mShellXdg.reset(new QWaylandXdgShell(registry,id));
|
||||||
} else if (interface == QStringLiteral("wl_shell")){
|
} else if (interface == QStringLiteral("wl_shell")){
|
||||||
mShell.reset(new QtWayland::wl_shell(registry, id));
|
mShell.reset(new QtWayland::wl_shell(registry, id, 1));
|
||||||
} else if (interface == QStringLiteral("wl_seat")) {
|
} else if (interface == QStringLiteral("wl_seat")) {
|
||||||
QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id);
|
QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id);
|
||||||
mInputDevices.append(inputDevice);
|
mInputDevices.append(inputDevice);
|
||||||
} else if (interface == QStringLiteral("wl_data_device_manager")) {
|
} else if (interface == QStringLiteral("wl_data_device_manager")) {
|
||||||
mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
|
mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
|
||||||
} else if (interface == QStringLiteral("qt_output_extension")) {
|
} else if (interface == QStringLiteral("qt_output_extension")) {
|
||||||
mOutputExtension.reset(new QtWayland::qt_output_extension(registry, id));
|
mOutputExtension.reset(new QtWayland::qt_output_extension(registry, id, 1));
|
||||||
foreach (QPlatformScreen *screen, screens())
|
foreach (QPlatformScreen *screen, screens())
|
||||||
static_cast<QWaylandScreen *>(screen)->createExtendedOutput();
|
static_cast<QWaylandScreen *>(screen)->createExtendedOutput();
|
||||||
} else if (interface == QStringLiteral("qt_surface_extension")) {
|
} else if (interface == QStringLiteral("qt_surface_extension")) {
|
||||||
mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id));
|
mWindowExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1));
|
||||||
} else if (interface == QStringLiteral("qt_sub_surface_extension")) {
|
} else if (interface == QStringLiteral("qt_sub_surface_extension")) {
|
||||||
mSubSurfaceExtension.reset(new QtWayland::qt_sub_surface_extension(registry, id));
|
mSubSurfaceExtension.reset(new QtWayland::qt_sub_surface_extension(registry, id, 1));
|
||||||
} else if (interface == QStringLiteral("qt_touch_extension")) {
|
} else if (interface == QStringLiteral("qt_touch_extension")) {
|
||||||
mTouchExtension.reset(new QWaylandTouchExtension(this, id));
|
mTouchExtension.reset(new QWaylandTouchExtension(this, id));
|
||||||
} else if (interface == QStringLiteral("qt_key_extension")) {
|
} else if (interface == QStringLiteral("qt_key_extension")) {
|
||||||
mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id));
|
mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id));
|
||||||
} else if (interface == QStringLiteral("wl_text_input_manager")) {
|
} else if (interface == QStringLiteral("wl_text_input_manager")) {
|
||||||
mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id));
|
mTextInputManager.reset(new QtWayland::wl_text_input_manager(registry, id, 1));
|
||||||
} else if (interface == QStringLiteral("qt_hardware_integration")) {
|
} else if (interface == QStringLiteral("qt_hardware_integration")) {
|
||||||
mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
|
mHardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id));
|
||||||
// make a roundtrip here since we need to receive the events sent by
|
// make a roundtrip here since we need to receive the events sent by
|
||||||
|
@ -228,7 +228,7 @@ public:
|
|||||||
|
|
||||||
QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id)
|
QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id)
|
||||||
: QObject()
|
: QObject()
|
||||||
, QtWayland::wl_seat(display->wl_registry(), id)
|
, QtWayland::wl_seat(display->wl_registry(), id, 2)
|
||||||
, mQDisplay(display)
|
, mQDisplay(display)
|
||||||
, mDisplay(display->wl_display())
|
, mDisplay(display->wl_display())
|
||||||
, mCaps(0)
|
, mCaps(0)
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id)
|
QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id)
|
||||||
: QtWayland::qt_key_extension(display->wl_registry(), id)
|
: QtWayland::qt_key_extension(display->wl_registry(), id, 2)
|
||||||
, m_display(display)
|
, m_display(display)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id)
|
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id)
|
||||||
: QPlatformScreen()
|
: QPlatformScreen()
|
||||||
, QtWayland::wl_output(waylandDisplay->wl_registry(), id)
|
, QtWayland::wl_output(waylandDisplay->wl_registry(), id, 2)
|
||||||
, mWaylandDisplay(waylandDisplay)
|
, mWaylandDisplay(waylandDisplay)
|
||||||
, mExtendedOutput(0)
|
, mExtendedOutput(0)
|
||||||
, mDepth(32)
|
, mDepth(32)
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id)
|
QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id)
|
||||||
: QtWayland::qt_touch_extension(display->wl_registry(), id),
|
: QtWayland::qt_touch_extension(display->wl_registry(), id, 1),
|
||||||
mDisplay(display),
|
mDisplay(display),
|
||||||
mTouchDevice(0),
|
mTouchDevice(0),
|
||||||
mPointsLeft(0),
|
mPointsLeft(0),
|
||||||
|
@ -95,7 +95,7 @@ void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(void *data, wl_reg
|
|||||||
{
|
{
|
||||||
Q_UNUSED(version);
|
Q_UNUSED(version);
|
||||||
if (interface == QStringLiteral("qt_windowmanager"))
|
if (interface == QStringLiteral("qt_windowmanager"))
|
||||||
static_cast<QWaylandWindowManagerIntegration *>(data)->init(registry, id);
|
static_cast<QWaylandWindowManagerIntegration *>(data)->init(registry, id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen)
|
void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen)
|
||||||
|
@ -57,7 +57,7 @@ QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id)
|
QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id)
|
||||||
: QtWayland::xdg_shell(registry, id)
|
: QtWayland::xdg_shell(registry, id, 1)
|
||||||
{
|
{
|
||||||
use_unstable_version(QtWayland::xdg_shell::version_current);
|
use_unstable_version(QtWayland::xdg_shell::version_current);
|
||||||
}
|
}
|
||||||
|
@ -822,13 +822,13 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
|
|
||||||
printf(" class %s %s\n {\n", clientExport.constData(), interfaceName);
|
printf(" class %s %s\n {\n", clientExport.constData(), interfaceName);
|
||||||
printf(" public:\n");
|
printf(" public:\n");
|
||||||
printf(" %s(struct ::wl_registry *registry, int id);\n", interfaceName);
|
printf(" %s(struct ::wl_registry *registry, int id, int version);\n", interfaceName);
|
||||||
printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName);
|
printf(" %s(struct ::%s *object);\n", interfaceName, interfaceName);
|
||||||
printf(" %s();\n", interfaceName);
|
printf(" %s();\n", interfaceName);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" virtual ~%s();\n", interfaceName);
|
printf(" virtual ~%s();\n", interfaceName);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" void init(struct ::wl_registry *registry, int id);\n");
|
printf(" void init(struct ::wl_registry *registry, int id, int version);\n");
|
||||||
printf(" void init(struct ::%s *object);\n", interfaceName);
|
printf(" void init(struct ::%s *object);\n", interfaceName);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName);
|
printf(" struct ::%s *object() { return m_%s; }\n", interfaceName, interfaceName);
|
||||||
@ -908,9 +908,9 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
|
|
||||||
bool hasEvents = !interface.events.isEmpty();
|
bool hasEvents = !interface.events.isEmpty();
|
||||||
|
|
||||||
printf(" %s::%s(struct ::wl_registry *registry, int id)\n", interfaceName, interfaceName);
|
printf(" %s::%s(struct ::wl_registry *registry, int id, int version)\n", interfaceName, interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" init(registry, id);\n");
|
printf(" init(registry, id, version);\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
@ -933,9 +933,9 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(" void %s::init(struct ::wl_registry *registry, int id)\n", interfaceName);
|
printf(" void %s::init(struct ::wl_registry *registry, int id, int version)\n", interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" m_%s = static_cast<struct ::%s *>(wl_registry_bind(registry, id, &%s_interface, %s_interface.version));\n", interfaceName, interfaceName, interfaceName, interfaceName);
|
printf(" m_%s = static_cast<struct ::%s *>(wl_registry_bind(registry, id, &%s_interface, version));\n", interfaceName, interfaceName, interfaceName);
|
||||||
if (hasEvents)
|
if (hasEvents)
|
||||||
printf(" init_listener();\n");
|
printf(" init_listener();\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user