2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2019-06-13 09:36:07 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
|
|
|
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
|
2019-06-13 09:36:07 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2019-06-13 09:36:07 +00:00
|
|
|
#include "abstract_wayland_output.h"
|
2020-01-02 14:55:03 +00:00
|
|
|
|
|
|
|
#include "screens.h"
|
2019-06-13 09:36:07 +00:00
|
|
|
#include "wayland_server.h"
|
|
|
|
|
|
|
|
// KWayland
|
2020-04-29 15:18:41 +00:00
|
|
|
#include <KWaylandServer/display.h>
|
|
|
|
#include <KWaylandServer/outputchangeset.h>
|
2020-08-20 14:53:10 +00:00
|
|
|
#include <KWaylandServer/xdgoutput_v1_interface.h>
|
2019-06-13 09:36:07 +00:00
|
|
|
// KF5
|
|
|
|
#include <KLocalizedString>
|
|
|
|
|
2020-08-12 16:52:08 +00:00
|
|
|
#include <QMatrix4x4>
|
2019-06-13 09:36:07 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
AbstractWaylandOutput::AbstractWaylandOutput(QObject *parent)
|
|
|
|
: AbstractOutput(parent)
|
|
|
|
{
|
2020-12-09 21:24:41 +00:00
|
|
|
m_waylandOutput = new KWaylandServer::OutputInterface(waylandServer()->display(), this);
|
|
|
|
m_waylandOutputDevice = new KWaylandServer::OutputDeviceInterface(waylandServer()->display(), this);
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1 = waylandServer()->xdgOutputManagerV1()->createXdgOutput(m_waylandOutput, this);
|
2020-03-23 23:04:06 +00:00
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
connect(m_waylandOutput, &KWaylandServer::OutputInterface::dpmsModeRequested, this,
|
|
|
|
[this] (KWaylandServer::OutputInterface::DpmsMode mode) {
|
2020-03-23 23:04:06 +00:00
|
|
|
updateDpms(mode);
|
|
|
|
});
|
2020-08-13 15:32:17 +00:00
|
|
|
|
|
|
|
connect(m_waylandOutput, &KWaylandServer::OutputInterface::globalPositionChanged, this, &AbstractWaylandOutput::geometryChanged);
|
|
|
|
connect(m_waylandOutput, &KWaylandServer::OutputInterface::pixelSizeChanged, this, &AbstractWaylandOutput::geometryChanged);
|
|
|
|
connect(m_waylandOutput, &KWaylandServer::OutputInterface::scaleChanged, this, &AbstractWaylandOutput::geometryChanged);
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AbstractWaylandOutput::~AbstractWaylandOutput()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AbstractWaylandOutput::name() const
|
|
|
|
{
|
2020-04-08 09:38:41 +00:00
|
|
|
return m_name;
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
2021-03-10 08:50:32 +00:00
|
|
|
QString AbstractWaylandOutput::uuid() const
|
2019-08-28 18:54:37 +00:00
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->uuid();
|
|
|
|
}
|
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
QRect AbstractWaylandOutput::geometry() const
|
|
|
|
{
|
2019-08-27 14:19:47 +00:00
|
|
|
return QRect(globalPos(), pixelSize() / scale());
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QSize AbstractWaylandOutput::physicalSize() const
|
|
|
|
{
|
2019-08-27 14:52:39 +00:00
|
|
|
return orientateSize(m_waylandOutputDevice->physicalSize());
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int AbstractWaylandOutput::refreshRate() const
|
|
|
|
{
|
2019-08-28 20:58:21 +00:00
|
|
|
return m_waylandOutputDevice->refreshRate();
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
2019-08-27 12:41:16 +00:00
|
|
|
QPoint AbstractWaylandOutput::globalPos() const
|
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->globalPosition();
|
|
|
|
}
|
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
void AbstractWaylandOutput::setGlobalPos(const QPoint &pos)
|
|
|
|
{
|
2019-08-27 11:07:11 +00:00
|
|
|
m_waylandOutputDevice->setGlobalPosition(pos);
|
|
|
|
|
2020-03-23 23:04:06 +00:00
|
|
|
m_waylandOutput->setGlobalPosition(pos);
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->setLogicalPosition(pos);
|
2021-03-11 22:26:08 +00:00
|
|
|
m_waylandOutput->done();
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->done();
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
2020-11-24 17:31:06 +00:00
|
|
|
QString AbstractWaylandOutput::manufacturer() const
|
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->manufacturer();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AbstractWaylandOutput::model() const
|
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->model();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AbstractWaylandOutput::serialNumber() const
|
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->serialNumber();
|
|
|
|
}
|
|
|
|
|
2020-01-02 14:55:05 +00:00
|
|
|
QSize AbstractWaylandOutput::modeSize() const
|
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->pixelSize();
|
|
|
|
}
|
|
|
|
|
2019-08-27 14:19:47 +00:00
|
|
|
QSize AbstractWaylandOutput::pixelSize() const
|
|
|
|
{
|
|
|
|
return orientateSize(m_waylandOutputDevice->pixelSize());
|
|
|
|
}
|
|
|
|
|
2019-08-27 12:41:16 +00:00
|
|
|
qreal AbstractWaylandOutput::scale() const
|
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->scaleF();
|
|
|
|
}
|
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
void AbstractWaylandOutput::setScale(qreal scale)
|
|
|
|
{
|
2019-08-27 11:07:11 +00:00
|
|
|
m_waylandOutputDevice->setScaleF(scale);
|
|
|
|
|
2020-03-23 23:04:06 +00:00
|
|
|
// this is the scale that clients will ideally use for their buffers
|
|
|
|
// this has to be an int which is fine
|
2019-06-13 09:36:07 +00:00
|
|
|
|
2020-03-23 23:04:06 +00:00
|
|
|
// I don't know whether we want to round or ceil
|
|
|
|
// or maybe even set this to 3 when we're scaling to 1.5
|
|
|
|
// don't treat this like it's chosen deliberately
|
|
|
|
m_waylandOutput->setScale(std::ceil(scale));
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->setLogicalSize(pixelSize() / scale);
|
2021-03-11 22:26:08 +00:00
|
|
|
m_waylandOutput->done();
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->done();
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
using DeviceInterface = KWaylandServer::OutputDeviceInterface;
|
2019-11-24 10:42:30 +00:00
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
KWaylandServer::OutputInterface::Transform toOutputTransform(DeviceInterface::Transform transform)
|
2019-11-24 10:42:30 +00:00
|
|
|
{
|
|
|
|
using Transform = DeviceInterface::Transform;
|
2020-04-29 15:18:41 +00:00
|
|
|
using OutputTransform = KWaylandServer::OutputInterface::Transform;
|
2019-11-24 10:42:30 +00:00
|
|
|
|
|
|
|
switch (transform) {
|
|
|
|
case Transform::Rotated90:
|
|
|
|
return OutputTransform::Rotated90;
|
|
|
|
case Transform::Rotated180:
|
|
|
|
return OutputTransform::Rotated180;
|
|
|
|
case Transform::Rotated270:
|
|
|
|
return OutputTransform::Rotated270;
|
|
|
|
case Transform::Flipped:
|
|
|
|
return OutputTransform::Flipped;
|
|
|
|
case Transform::Flipped90:
|
|
|
|
return OutputTransform::Flipped90;
|
|
|
|
case Transform::Flipped180:
|
|
|
|
return OutputTransform::Flipped180;
|
|
|
|
case Transform::Flipped270:
|
|
|
|
return OutputTransform::Flipped270;
|
|
|
|
default:
|
|
|
|
return OutputTransform::Normal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractWaylandOutput::setTransform(DeviceInterface::Transform transform)
|
|
|
|
{
|
|
|
|
m_waylandOutputDevice->setTransform(transform);
|
|
|
|
|
2020-03-23 23:04:06 +00:00
|
|
|
m_waylandOutput->setTransform(toOutputTransform(transform));
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->setLogicalSize(pixelSize() / scale());
|
2021-03-11 22:26:08 +00:00
|
|
|
m_waylandOutput->done();
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->done();
|
2019-11-24 10:42:30 +00:00
|
|
|
}
|
|
|
|
|
2019-11-26 22:53:17 +00:00
|
|
|
inline
|
|
|
|
AbstractWaylandOutput::Transform toTransform(DeviceInterface::Transform deviceTransform)
|
|
|
|
{
|
|
|
|
return static_cast<AbstractWaylandOutput::Transform>(deviceTransform);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
DeviceInterface::Transform toDeviceTransform(AbstractWaylandOutput::Transform transform)
|
|
|
|
{
|
|
|
|
return static_cast<DeviceInterface::Transform>(transform);
|
|
|
|
}
|
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
void AbstractWaylandOutput::applyChanges(const KWaylandServer::OutputChangeSet *changeSet)
|
2019-06-13 09:36:07 +00:00
|
|
|
{
|
2019-08-28 18:54:37 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Apply changes to the Wayland output.";
|
2019-08-25 12:22:12 +00:00
|
|
|
bool emitModeChanged = false;
|
2020-01-02 14:55:03 +00:00
|
|
|
bool overallSizeCheckNeeded = false;
|
2019-06-13 09:36:07 +00:00
|
|
|
|
2019-08-28 18:54:37 +00:00
|
|
|
// Enablement changes are handled by platform.
|
|
|
|
if (changeSet->modeChanged()) {
|
|
|
|
qCDebug(KWIN_CORE) << "Setting new mode:" << changeSet->mode();
|
|
|
|
m_waylandOutputDevice->setCurrentMode(changeSet->mode());
|
|
|
|
updateMode(changeSet->mode());
|
2019-08-25 12:22:12 +00:00
|
|
|
emitModeChanged = true;
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
2019-08-28 18:54:37 +00:00
|
|
|
if (changeSet->transformChanged()) {
|
|
|
|
qCDebug(KWIN_CORE) << "Server setting transform: " << (int)(changeSet->transform());
|
2019-11-24 10:42:30 +00:00
|
|
|
setTransform(changeSet->transform());
|
2020-01-02 14:55:07 +00:00
|
|
|
updateTransform(toTransform(changeSet->transform()));
|
2019-08-25 12:22:12 +00:00
|
|
|
emitModeChanged = true;
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
2019-08-28 18:54:37 +00:00
|
|
|
if (changeSet->positionChanged()) {
|
|
|
|
qCDebug(KWIN_CORE) << "Server setting position: " << changeSet->position();
|
|
|
|
setGlobalPos(changeSet->position());
|
2019-06-13 09:36:07 +00:00
|
|
|
// may just work already!
|
2020-01-02 14:55:03 +00:00
|
|
|
overallSizeCheckNeeded = true;
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
2019-08-28 18:54:37 +00:00
|
|
|
if (changeSet->scaleChanged()) {
|
2020-03-15 19:59:29 +00:00
|
|
|
qCDebug(KWIN_CORE) << "Setting scale:" << changeSet->scaleF();
|
2019-08-28 18:54:37 +00:00
|
|
|
setScale(changeSet->scaleF());
|
2019-08-25 12:22:12 +00:00
|
|
|
emitModeChanged = true;
|
|
|
|
}
|
|
|
|
|
2020-01-02 14:55:03 +00:00
|
|
|
overallSizeCheckNeeded |= emitModeChanged;
|
|
|
|
if (overallSizeCheckNeeded) {
|
|
|
|
emit screens()->changed();
|
|
|
|
}
|
|
|
|
|
2019-08-25 12:22:12 +00:00
|
|
|
if (emitModeChanged) {
|
|
|
|
emit modeChanged();
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-28 18:54:37 +00:00
|
|
|
bool AbstractWaylandOutput::isEnabled() const
|
|
|
|
{
|
|
|
|
return m_waylandOutputDevice->enabled() == DeviceInterface::Enablement::Enabled;
|
|
|
|
}
|
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
void AbstractWaylandOutput::setEnabled(bool enable)
|
|
|
|
{
|
|
|
|
if (enable == isEnabled()) {
|
|
|
|
return;
|
|
|
|
}
|
2019-08-31 08:27:04 +00:00
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
if (enable) {
|
2020-03-23 23:04:06 +00:00
|
|
|
m_waylandOutputDevice->setEnabled(DeviceInterface::Enablement::Enabled);
|
|
|
|
m_waylandOutput->create();
|
2019-08-31 08:27:04 +00:00
|
|
|
updateEnablement(true);
|
2019-06-13 09:36:07 +00:00
|
|
|
} else {
|
2020-03-23 23:04:06 +00:00
|
|
|
m_waylandOutputDevice->setEnabled(DeviceInterface::Enablement::Disabled);
|
|
|
|
m_waylandOutput->destroy();
|
2019-08-31 08:27:04 +00:00
|
|
|
// xdg-output is destroyed in KWayland on wl_output going away.
|
|
|
|
updateEnablement(false);
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
2021-01-22 08:22:24 +00:00
|
|
|
|
|
|
|
emit enabledChanged();
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
2020-04-08 09:38:41 +00:00
|
|
|
QString AbstractWaylandOutput::description() const
|
|
|
|
{
|
|
|
|
return QStringLiteral("%1 %2").arg(m_waylandOutputDevice->manufacturer()).arg(
|
|
|
|
m_waylandOutputDevice->model());
|
|
|
|
}
|
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
void AbstractWaylandOutput::setWaylandMode(const QSize &size, int refreshRate)
|
|
|
|
{
|
|
|
|
m_waylandOutput->setCurrentMode(size, refreshRate);
|
2020-12-15 20:20:10 +00:00
|
|
|
m_waylandOutputDevice->setCurrentMode(size, refreshRate);
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->setLogicalSize(pixelSize() / scale());
|
2021-03-11 22:26:08 +00:00
|
|
|
m_waylandOutput->done();
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->done();
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
2019-08-28 18:54:37 +00:00
|
|
|
void AbstractWaylandOutput::initInterfaces(const QString &model, const QString &manufacturer,
|
2021-03-10 08:50:32 +00:00
|
|
|
const QString &uuid, const QSize &physicalSize,
|
2020-10-26 17:29:33 +00:00
|
|
|
const QVector<DeviceInterface::Mode> &modes,
|
|
|
|
const QByteArray &edid)
|
2019-06-13 09:36:07 +00:00
|
|
|
{
|
|
|
|
m_waylandOutputDevice->setUuid(uuid);
|
|
|
|
|
2021-01-14 08:21:59 +00:00
|
|
|
if (manufacturer.isEmpty()) {
|
2019-06-13 09:36:07 +00:00
|
|
|
m_waylandOutputDevice->setManufacturer(i18n("unknown"));
|
2021-01-14 08:21:59 +00:00
|
|
|
} else {
|
|
|
|
m_waylandOutputDevice->setManufacturer(manufacturer);
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
2020-10-26 17:29:33 +00:00
|
|
|
m_waylandOutputDevice->setEdid(edid);
|
2019-06-13 09:36:07 +00:00
|
|
|
|
|
|
|
m_waylandOutputDevice->setModel(model);
|
2019-08-27 14:52:39 +00:00
|
|
|
m_waylandOutputDevice->setPhysicalSize(physicalSize);
|
2019-06-13 09:36:07 +00:00
|
|
|
|
2020-03-23 23:04:06 +00:00
|
|
|
m_waylandOutput->setManufacturer(m_waylandOutputDevice->manufacturer());
|
|
|
|
m_waylandOutput->setModel(m_waylandOutputDevice->model());
|
|
|
|
m_waylandOutput->setPhysicalSize(m_waylandOutputDevice->physicalSize());
|
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
int i = 0;
|
|
|
|
for (auto mode : modes) {
|
|
|
|
qCDebug(KWIN_CORE).nospace() << "Adding mode " << ++i << ": " << mode.size << " [" << mode.refreshRate << "]";
|
|
|
|
m_waylandOutputDevice->addMode(mode);
|
2020-03-23 23:04:06 +00:00
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
KWaylandServer::OutputInterface::ModeFlags flags;
|
2020-03-23 23:04:06 +00:00
|
|
|
if (mode.flags & DeviceInterface::ModeFlag::Current) {
|
2020-04-29 15:18:41 +00:00
|
|
|
flags |= KWaylandServer::OutputInterface::ModeFlag::Current;
|
2020-03-23 23:04:06 +00:00
|
|
|
}
|
|
|
|
if (mode.flags & DeviceInterface::ModeFlag::Preferred) {
|
2020-04-29 15:18:41 +00:00
|
|
|
flags |= KWaylandServer::OutputInterface::ModeFlag::Preferred;
|
2020-03-23 23:04:06 +00:00
|
|
|
}
|
|
|
|
m_waylandOutput->addMode(mode.size, flags, mode.refreshRate);
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
2019-08-28 18:54:37 +00:00
|
|
|
|
2020-03-23 23:04:06 +00:00
|
|
|
// start off enabled
|
2020-04-08 09:38:41 +00:00
|
|
|
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->setName(name());
|
|
|
|
m_xdgOutputV1->setDescription(description());
|
|
|
|
m_xdgOutputV1->setLogicalSize(pixelSize() / scale());
|
2021-03-11 22:26:08 +00:00
|
|
|
m_waylandOutput->create();
|
|
|
|
m_waylandOutput->done();
|
2020-08-20 14:53:10 +00:00
|
|
|
m_xdgOutputV1->done();
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QSize AbstractWaylandOutput::orientateSize(const QSize &size) const
|
|
|
|
{
|
2019-11-24 10:42:30 +00:00
|
|
|
using Transform = DeviceInterface::Transform;
|
|
|
|
const Transform transform = m_waylandOutputDevice->transform();
|
|
|
|
if (transform == Transform::Rotated90 || transform == Transform::Rotated270 ||
|
|
|
|
transform == Transform::Flipped90 || transform == Transform::Flipped270) {
|
2019-06-13 09:36:07 +00:00
|
|
|
return size.transposed();
|
|
|
|
}
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2019-11-26 22:53:17 +00:00
|
|
|
void AbstractWaylandOutput::setTransform(Transform transform)
|
2019-11-24 15:51:59 +00:00
|
|
|
{
|
2019-11-26 22:53:17 +00:00
|
|
|
const auto deviceTransform = toDeviceTransform(transform);
|
|
|
|
if (deviceTransform == m_waylandOutputDevice->transform()) {
|
2019-11-24 15:51:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-11-26 22:53:17 +00:00
|
|
|
setTransform(deviceTransform);
|
2019-11-24 15:51:59 +00:00
|
|
|
emit modeChanged();
|
|
|
|
}
|
|
|
|
|
2019-11-26 22:53:17 +00:00
|
|
|
AbstractWaylandOutput::Transform AbstractWaylandOutput::transform() const
|
2019-11-24 11:26:18 +00:00
|
|
|
{
|
2019-11-26 22:53:17 +00:00
|
|
|
return static_cast<Transform>(m_waylandOutputDevice->transform());
|
2019-11-24 11:26:18 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 20:57:15 +00:00
|
|
|
QMatrix4x4 AbstractWaylandOutput::logicalToNativeMatrix(const QRect &rect, qreal scale, Transform transform)
|
2020-08-12 16:52:08 +00:00
|
|
|
{
|
|
|
|
QMatrix4x4 matrix;
|
2020-10-13 20:57:15 +00:00
|
|
|
matrix.scale(scale);
|
2020-08-12 16:52:08 +00:00
|
|
|
|
2020-10-13 20:57:15 +00:00
|
|
|
switch (transform) {
|
2020-10-13 20:15:46 +00:00
|
|
|
case Transform::Normal:
|
|
|
|
case Transform::Flipped:
|
|
|
|
break;
|
|
|
|
case Transform::Rotated90:
|
|
|
|
case Transform::Flipped90:
|
|
|
|
matrix.translate(0, rect.width());
|
|
|
|
matrix.rotate(-90, 0, 0, 1);
|
|
|
|
break;
|
|
|
|
case Transform::Rotated180:
|
|
|
|
case Transform::Flipped180:
|
|
|
|
matrix.translate(rect.width(), rect.height());
|
|
|
|
matrix.rotate(-180, 0, 0, 1);
|
|
|
|
break;
|
|
|
|
case Transform::Rotated270:
|
|
|
|
case Transform::Flipped270:
|
|
|
|
matrix.translate(rect.height(), 0);
|
|
|
|
matrix.rotate(-270, 0, 0, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-13 20:57:15 +00:00
|
|
|
switch (transform) {
|
2020-10-13 20:15:46 +00:00
|
|
|
case Transform::Flipped:
|
|
|
|
case Transform::Flipped90:
|
|
|
|
case Transform::Flipped180:
|
|
|
|
case Transform::Flipped270:
|
|
|
|
matrix.translate(rect.width(), 0);
|
|
|
|
matrix.scale(-1, 1);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
matrix.translate(-rect.x(), -rect.y());
|
|
|
|
|
2020-08-12 16:52:08 +00:00
|
|
|
return matrix;
|
|
|
|
}
|
|
|
|
|
2021-02-02 13:26:43 +00:00
|
|
|
void AbstractWaylandOutput::recordingStarted()
|
|
|
|
{
|
|
|
|
m_recorders++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AbstractWaylandOutput::recordingStopped()
|
|
|
|
{
|
|
|
|
m_recorders--;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AbstractWaylandOutput::isBeingRecorded()
|
|
|
|
{
|
|
|
|
return m_recorders;
|
|
|
|
}
|
|
|
|
|
2019-06-13 09:36:07 +00:00
|
|
|
}
|