summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2020-01-09 12:26:21 +0100
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2020-01-13 12:56:29 +0100
commitda13b1b130f520ee0bd9df0e9190db64a2ea4a93 (patch)
tree93ff1445c637f1de999eb9ea2e3ec9d24f38d522 /src
parente57fb37c66d0efa3eb1b9367d284dc5643406cda (diff)
Client: Upgrade to xdg-output-unstable-v1 version 3
[ChangeLog][QPA plugin] xdg-output-unstable-v1 version 3 is now supported. Change-Id: I054b2946e86175eabe76731bac94e5f287c4ee58 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylanddisplay.cpp2
-rw-r--r--src/client/qwaylanddisplay_p.h6
-rw-r--r--src/client/qwaylandscreen.cpp20
-rw-r--r--src/client/qwaylandscreen_p.h10
4 files changed, 30 insertions, 8 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index ffcc72ff9..37cb0e9bc 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -351,7 +351,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
forceRoundTrip();
}
} else if (interface == QLatin1String("zxdg_output_manager_v1")) {
- mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, qMin(2, int(version))));
+ mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version));
for (auto *screen : qAsConst(mWaitingScreens))
screen->initXdgOutput(xdgOutputManager());
forceRoundTrip();
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index e99ec1983..a52c89fe9 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -81,7 +81,6 @@ class QPlatformPlaceholderScreen;
namespace QtWayland {
class qt_surface_extension;
class zwp_text_input_manager_v2;
- class zxdg_output_manager_v1;
}
namespace QtWaylandClient {
@@ -91,6 +90,7 @@ Q_WAYLAND_CLIENT_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaWayland);
class QWaylandInputDevice;
class QWaylandBuffer;
class QWaylandScreen;
+class QWaylandXdgOutputManagerV1;
class QWaylandClientBufferIntegration;
class QWaylandWindowManagerIntegration;
class QWaylandDataDeviceManager;
@@ -165,7 +165,7 @@ public:
QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); }
QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); }
QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); }
- QtWayland::zxdg_output_manager_v1 *xdgOutputManager() const { return mXdgOutputManager.data(); }
+ QWaylandXdgOutputManagerV1 *xdgOutputManager() const { return mXdgOutputManager.data(); }
bool usingInputContextFromCompositor() const { return mUsingInputContextFromCompositor; }
@@ -255,7 +255,7 @@ private:
#endif
QScopedPointer<QtWayland::zwp_text_input_manager_v2> mTextInputManager;
QScopedPointer<QWaylandHardwareIntegration> mHardwareIntegration;
- QScopedPointer<QtWayland::zxdg_output_manager_v1> mXdgOutputManager;
+ QScopedPointer<QWaylandXdgOutputManagerV1> mXdgOutputManager;
QSocketNotifier *mReadNotifier = nullptr;
int mFd = -1;
int mWritableNotificationFd = -1;
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index 4f0cd9b0a..6cb337de3 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -53,6 +53,12 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
+QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version)
+ : QtWayland::zxdg_output_manager_v1(display->wl_registry(), id, qMin(3u, version))
+ , m_version(qMin(3u, version))
+{
+}
+
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
: QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2))
, m_outputId(id)
@@ -95,7 +101,7 @@ void QWaylandScreen::maybeInitialize()
updateXdgOutputProperties();
}
-void QWaylandScreen::initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager)
+void QWaylandScreen::initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager)
{
Q_ASSERT(xdgOutputManager);
if (zxdg_output_v1::isInitialized())
@@ -271,10 +277,15 @@ void QWaylandScreen::output_scale(int32_t factor)
void QWaylandScreen::output_done()
{
mOutputDone = true;
- if (mInitialized)
+ if (zxdg_output_v1::isInitialized() && mWaylandDisplay->xdgOutputManager()->version() >= 3)
+ mXdgOutputDone = true;
+ if (mInitialized) {
updateOutputProperties();
- else
+ if (zxdg_output_v1::isInitialized())
+ updateXdgOutputProperties();
+ } else {
maybeInitialize();
+ }
}
void QWaylandScreen::updateOutputProperties()
@@ -325,6 +336,9 @@ void QWaylandScreen::zxdg_output_v1_logical_size(int32_t width, int32_t height)
void QWaylandScreen::zxdg_output_v1_done()
{
+ if (Q_UNLIKELY(mWaylandDisplay->xdgOutputManager()->version() >= 3))
+ qWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor";
+
mXdgOutputDone = true;
if (mInitialized)
updateXdgOutputProperties();
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
index ae91c6211..df1c94f24 100644
--- a/src/client/qwaylandscreen_p.h
+++ b/src/client/qwaylandscreen_p.h
@@ -64,6 +64,14 @@ namespace QtWaylandClient {
class QWaylandDisplay;
class QWaylandCursor;
+class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
+public:
+ QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version);
+ uint version() const { return m_version; }
+private:
+ uint m_version = 1; // TODO: remove when we upgrade minimum libwayland requriement to 1.10
+};
+
class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1
{
public:
@@ -72,7 +80,7 @@ public:
void maybeInitialize();
- void initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager);
+ void initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager);
QWaylandDisplay *display() const;