wayland: Implement wl_output version 4

wl_output version 4 adds name and description properties. Those
properties were added in wayland 1.20, which we already require.
This commit is contained in:
Vlad Zahorodnii 2022-09-05 14:37:10 +03:00
parent a0a472391e
commit 330a02d862
3 changed files with 24 additions and 1 deletions

View file

@ -18,7 +18,7 @@
namespace KWaylandServer
{
static const int s_version = 3;
static const int s_version = 4;
class OutputInterfacePrivate : public QtWaylandServer::wl_output
{
@ -43,6 +43,8 @@ public:
KWin::Output::SubPixel subPixel = KWin::Output::SubPixel::Unknown;
KWin::Output::Transform transform = KWin::Output::Transform::Normal;
OutputInterface::Mode mode;
QString name;
QString description;
private:
void output_destroy_global() override;
@ -158,6 +160,13 @@ void OutputInterfacePrivate::output_bind_resource(Resource *resource)
return; // We are waiting for the wl_output global to be destroyed.
}
if (resource->version() >= WL_OUTPUT_NAME_SINCE_VERSION) {
send_name(name);
}
if (resource->version() >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION) {
send_description(description);
}
sendMode(resource);
sendScale(resource);
sendGeometry(resource);
@ -242,6 +251,16 @@ void OutputInterface::setMode(const QSize &size, int refreshRate)
setMode({size, refreshRate});
}
void OutputInterface::setName(const QString &name)
{
d->name = name;
}
void OutputInterface::setDescription(const QString &description)
{
d->description = description;
}
QSize OutputInterface::physicalSize() const
{
return d->physicalSize;

View file

@ -76,6 +76,8 @@ public:
void setTransform(KWin::Output::Transform transform);
void setMode(const Mode &mode);
void setMode(const QSize &size, int refreshRate = 60000);
void setName(const QString &name);
void setDescription(const QString &description);
/**
* @returns all wl_resources bound for the @p client

View file

@ -20,6 +20,8 @@ WaylandOutput::WaylandOutput(Output *output, QObject *parent)
{
const QRect geometry = m_platformOutput->geometry();
m_waylandOutput->setName(output->name());
m_waylandOutput->setDescription(output->description());
m_waylandOutput->setTransform(output->transform());
m_waylandOutput->setManufacturer(output->manufacturer());
m_waylandOutput->setModel(output->model());