summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-01-16 10:39:42 +0100
committerJohan Helsing <johan.helsing@qt.io>2019-01-17 10:55:28 +0000
commitce7fef539a3e8a155d1c821686479503164f5983 (patch)
tree77203332b0917ce76ba8e9a601fdddeb219ac5fa
parent061934bd54757cdac423571c2096eb405bcee297 (diff)
Client: Implement xdg-output-unstable-v1 version 2
Adds handler for the new name event and updates tests accordingly. This means QScreen::name() will now typically return strings like: "VGA-1", "WL-1", "DP-2", "HDMI-A-1" instead of "Screen25", "Screen26", "Screen27" etc. Change-Id: I3d5748a2fd0d772e2344ac53f0ed808790a84ba5 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
-rw-r--r--src/client/qwaylanddisplay.cpp2
-rw-r--r--src/client/qwaylandscreen.cpp5
-rw-r--r--src/client/qwaylandscreen_p.h1
-rw-r--r--tests/auto/client/xdgoutput/tst_xdgoutput.cpp6
4 files changed, 13 insertions, 1 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 91c1d411..fc4241f8 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -278,7 +278,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, 1));
+ mXdgOutputManager.reset(new QtWayland::zxdg_output_manager_v1(registry, id, qMin(2, int(version))));
for (auto *screen : qAsConst(mScreens))
screen->initXdgOutput(xdgOutputManager());
forceRoundTrip();
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index 38d61f88..a6caae0d 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -292,6 +292,11 @@ void QWaylandScreen::zxdg_output_v1_done()
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry());
}
+void QWaylandScreen::zxdg_output_v1_name(const QString &name)
+{
+ mOutputName = name;
}
+} // namespace QtWaylandClient
+
QT_END_NAMESPACE
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
index 6e4ed94f..36009cce 100644
--- a/src/client/qwaylandscreen_p.h
+++ b/src/client/qwaylandscreen_p.h
@@ -122,6 +122,7 @@ private:
void zxdg_output_v1_logical_position(int32_t x, int32_t y) override;
void zxdg_output_v1_logical_size(int32_t width, int32_t height) override;
void zxdg_output_v1_done() override;
+ void zxdg_output_v1_name(const QString &name) override;
int m_outputId;
QWaylandDisplay *mWaylandDisplay = nullptr;
diff --git a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
index 6da2c35e..a628810d 100644
--- a/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
+++ b/tests/auto/client/xdgoutput/tst_xdgoutput.cpp
@@ -100,6 +100,7 @@ public:
add<XdgOutputManagerV1>(version);
});
}
+ XdgOutputV1 *xdgOutput(int i = 0) { return get<XdgOutputManagerV1>()->getXdgOutput(output(i)); }
};
class tst_xdgoutput : public QObject, private XdgOutputV1Compositor
@@ -121,9 +122,14 @@ void tst_xdgoutput::primaryScreen()
{
// Verify that the client has bound to the global
QCOMPOSITOR_TRY_COMPARE(get<XdgOutputManagerV1>()->resourceMap().size(), 1);
+ exec([=] {
+ auto *resource = xdgOutput()->resourceMap().value(client());
+ QCOMPARE(resource->version(), 2);
+ });
auto *s = QGuiApplication::primaryScreen();
QTRY_COMPARE(s->size(), QSize(1920, 1080));
QTRY_COMPARE(s->geometry().topLeft(), QPoint(0, 0));
+ QTRY_COMPARE(s->name(), QString("WL-1"));
}
void tst_xdgoutput::overrideGeometry()