diff options
author | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-10-10 22:17:41 +0300 |
---|---|---|
committer | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-10-13 10:05:39 +0200 |
commit | 44e471834e193478d14ba8cfafd857a3bea867cc (patch) | |
tree | 3f38c418b17c4b09d8f97dfdad54ac0282463e3b | |
parent | 5558b42ff8536efdacb94b85a9bd4a00217314df (diff) |
Be compatible with older compositors
When binding globals take care of the version the compositor provides
and don't call requests that the compositor doesn't implement.
Change-Id: Iea0c534fb9e005720857e2778e380b6a9c22a6f3
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 7 | ||||
-rw-r--r-- | src/client/qwaylanddisplay_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandinputdevice.cpp | 4 | ||||
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandscreen.cpp | 4 | ||||
-rw-r--r-- | src/client/qwaylandscreen_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandwindow.cpp | 3 |
7 files changed, 15 insertions, 9 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 8649a497c..fda2c204e 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -226,13 +226,14 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin struct ::wl_registry *registry = object(); if (interface == QStringLiteral("wl_output")) { - QWaylandScreen *screen = new QWaylandScreen(this, id); + QWaylandScreen *screen = new QWaylandScreen(this, version, id); mScreens.append(screen); // We need to get the output events before creating surfaces forceRoundTrip(); mWaylandIntegration->screenAdded(screen); } else if (interface == QStringLiteral("wl_compositor")) { - mCompositor.init(registry, id, 3); + mCompositorVersion = qMin((int)version, 3); + mCompositor.init(registry, id, mCompositorVersion); } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1)); } else if (interface == QStringLiteral("xdg_shell") @@ -241,7 +242,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("wl_shell")){ mShell.reset(new QtWayland::wl_shell(registry, id, 1)); } else if (interface == QStringLiteral("wl_seat")) { - QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); + QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, version, id); mInputDevices.append(inputDevice); } else if (interface == QStringLiteral("wl_data_device_manager")) { mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id)); diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 796c54756..8d1d26bba 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -116,6 +116,7 @@ public: const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } QtWayland::wl_compositor *compositor() { return &mCompositor; } + int compositorVersion() const { return mCompositorVersion; } QtWayland::wl_shell *shell() { return mShell.data(); } QtWayland::xdg_shell *shellXdg(); @@ -198,6 +199,7 @@ private: int mWritableNotificationFd; bool mScreensInitialized; QList<RegistryGlobal> mGlobals; + int mCompositorVersion; void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE; diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 6ec7b5df4..39d1705c0 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -228,9 +228,9 @@ public: QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints; }; -QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) +QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) : QObject() - , QtWayland::wl_seat(display->wl_registry(), id, 2) + , QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 2)) , mQDisplay(display) , mDisplay(display->wl_display()) , mCaps(0) diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 23e1fc740..630640f87 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -75,7 +75,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice { Q_OBJECT public: - QWaylandInputDevice(QWaylandDisplay *display, uint32_t id); + QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id); ~QWaylandInputDevice(); uint32_t capabilities() const { return mCaps; } diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp index 5c625ed42..6e48c442e 100644 --- a/src/client/qwaylandscreen.cpp +++ b/src/client/qwaylandscreen.cpp @@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE -QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) +QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) : QPlatformScreen() - , QtWayland::wl_output(waylandDisplay->wl_registry(), id, 2) + , QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2)) , m_outputId(id) , mWaylandDisplay(waylandDisplay) , mExtendedOutput(0) diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h index 49eeea671..d3173e0c9 100644 --- a/src/client/qwaylandscreen_p.h +++ b/src/client/qwaylandscreen_p.h @@ -56,7 +56,7 @@ class QWaylandExtendedOutput; class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output { public: - QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id); + QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); ~QWaylandScreen(); QWaylandDisplay *display() const; diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index d1ea6c1f9..6c4a339f1 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -429,6 +429,9 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { + if (mDisplay->compositorVersion() < 2) + return; + wl_output_transform transform; bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation; switch (orientation) { |