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>
This commit is contained in:
parent
8c1ecf0196
commit
3187836ad3
@ -278,7 +278,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
forceRoundTrip();
|
forceRoundTrip();
|
||||||
}
|
}
|
||||||
} else if (interface == QLatin1String("zxdg_output_manager_v1")) {
|
} 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))
|
for (auto *screen : qAsConst(mScreens))
|
||||||
screen->initXdgOutput(xdgOutputManager());
|
screen->initXdgOutput(xdgOutputManager());
|
||||||
forceRoundTrip();
|
forceRoundTrip();
|
||||||
|
@ -292,6 +292,11 @@ void QWaylandScreen::zxdg_output_v1_done()
|
|||||||
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry());
|
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandScreen::zxdg_output_v1_name(const QString &name)
|
||||||
|
{
|
||||||
|
mOutputName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace QtWaylandClient
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -122,6 +122,7 @@ private:
|
|||||||
void zxdg_output_v1_logical_position(int32_t x, int32_t y) override;
|
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_logical_size(int32_t width, int32_t height) override;
|
||||||
void zxdg_output_v1_done() override;
|
void zxdg_output_v1_done() override;
|
||||||
|
void zxdg_output_v1_name(const QString &name) override;
|
||||||
|
|
||||||
int m_outputId;
|
int m_outputId;
|
||||||
QWaylandDisplay *mWaylandDisplay = nullptr;
|
QWaylandDisplay *mWaylandDisplay = nullptr;
|
||||||
|
@ -100,6 +100,7 @@ public:
|
|||||||
add<XdgOutputManagerV1>(version);
|
add<XdgOutputManagerV1>(version);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
XdgOutputV1 *xdgOutput(int i = 0) { return get<XdgOutputManagerV1>()->getXdgOutput(output(i)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class tst_xdgoutput : public QObject, private XdgOutputV1Compositor
|
class tst_xdgoutput : public QObject, private XdgOutputV1Compositor
|
||||||
@ -121,9 +122,14 @@ void tst_xdgoutput::primaryScreen()
|
|||||||
{
|
{
|
||||||
// Verify that the client has bound to the global
|
// Verify that the client has bound to the global
|
||||||
QCOMPOSITOR_TRY_COMPARE(get<XdgOutputManagerV1>()->resourceMap().size(), 1);
|
QCOMPOSITOR_TRY_COMPARE(get<XdgOutputManagerV1>()->resourceMap().size(), 1);
|
||||||
|
exec([=] {
|
||||||
|
auto *resource = xdgOutput()->resourceMap().value(client());
|
||||||
|
QCOMPARE(resource->version(), 2);
|
||||||
|
});
|
||||||
auto *s = QGuiApplication::primaryScreen();
|
auto *s = QGuiApplication::primaryScreen();
|
||||||
QTRY_COMPARE(s->size(), QSize(1920, 1080));
|
QTRY_COMPARE(s->size(), QSize(1920, 1080));
|
||||||
QTRY_COMPARE(s->geometry().topLeft(), QPoint(0, 0));
|
QTRY_COMPARE(s->geometry().topLeft(), QPoint(0, 0));
|
||||||
|
QTRY_COMPARE(s->name(), QString("WL-1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_xdgoutput::overrideGeometry()
|
void tst_xdgoutput::overrideGeometry()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user