core: Move Output::Transform enum to KWin namespace
Being in the KWin namespace has a couple of advantages: the enum can be forward declared, and the transform can be replaced with a slightly more complex but useful type.
This commit is contained in:
parent
9e898c0e68
commit
637e3a6389
19 changed files with 158 additions and 162 deletions
|
@ -437,17 +437,17 @@ DrmConnector::DrmContentType DrmConnector::kwinToDrmContentType(ContentType type
|
|||
}
|
||||
}
|
||||
|
||||
Output::Transform DrmConnector::toKWinTransform(PanelOrientation orientation)
|
||||
OutputTransform DrmConnector::toKWinTransform(PanelOrientation orientation)
|
||||
{
|
||||
switch (orientation) {
|
||||
case PanelOrientation::Normal:
|
||||
return KWin::Output::Transform::Normal;
|
||||
return KWin::OutputTransform::Normal;
|
||||
case PanelOrientation::RightUp:
|
||||
return KWin::Output::Transform::Rotated270;
|
||||
return KWin::OutputTransform::Rotated270;
|
||||
case PanelOrientation::LeftUp:
|
||||
return KWin::Output::Transform::Rotated90;
|
||||
return KWin::OutputTransform::Rotated90;
|
||||
case PanelOrientation::UpsideDown:
|
||||
return KWin::Output::Transform::Rotated180;
|
||||
return KWin::OutputTransform::Rotated180;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
DrmEnumProperty<Colorspace> colorspace;
|
||||
|
||||
static DrmContentType kwinToDrmContentType(ContentType type);
|
||||
static Output::Transform toKWinTransform(PanelOrientation orientation);
|
||||
static OutputTransform toKWinTransform(PanelOrientation orientation);
|
||||
static BroadcastRgbOptions rgbRangeToBroadcastRgb(Output::RgbRange rgbRange);
|
||||
static Output::RgbRange broadcastRgbToRgbRange(BroadcastRgbOptions rgbRange);
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ DrmOutput::DrmOutput(const std::shared_ptr<DrmConnector> &conn)
|
|||
.edid = *edid,
|
||||
.subPixel = conn->subpixel(),
|
||||
.capabilities = capabilities,
|
||||
.panelOrientation = conn->panelOrientation.isValid() ? DrmConnector::toKWinTransform(conn->panelOrientation.enumValue()) : Transform::Normal,
|
||||
.panelOrientation = conn->panelOrientation.isValid() ? DrmConnector::toKWinTransform(conn->panelOrientation.enumValue()) : OutputTransform::Normal,
|
||||
.internal = conn->isInternal(),
|
||||
.nonDesktop = conn->isNonDesktop(),
|
||||
});
|
||||
|
@ -295,25 +295,24 @@ bool DrmOutput::setDrmDpmsMode(DpmsMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
DrmPlane::Transformations outputToPlaneTransform(DrmOutput::Transform transform)
|
||||
DrmPlane::Transformations outputToPlaneTransform(OutputTransform transform)
|
||||
{
|
||||
using OutTrans = DrmOutput::Transform;
|
||||
using PlaneTrans = DrmPlane::Transformation;
|
||||
|
||||
// TODO: Do we want to support reflections (flips)?
|
||||
|
||||
switch (transform) {
|
||||
case OutTrans::Normal:
|
||||
case OutTrans::Flipped:
|
||||
case OutputTransform::Normal:
|
||||
case OutputTransform::Flipped:
|
||||
return PlaneTrans::Rotate0;
|
||||
case OutTrans::Rotated90:
|
||||
case OutTrans::Flipped90:
|
||||
case OutputTransform::Rotated90:
|
||||
case OutputTransform::Flipped90:
|
||||
return PlaneTrans::Rotate90;
|
||||
case OutTrans::Rotated180:
|
||||
case OutTrans::Flipped180:
|
||||
case OutputTransform::Rotated180:
|
||||
case OutputTransform::Flipped180:
|
||||
return PlaneTrans::Rotate180;
|
||||
case OutTrans::Rotated270:
|
||||
case OutTrans::Flipped270:
|
||||
case OutputTransform::Rotated270:
|
||||
case OutputTransform::Flipped270:
|
||||
return PlaneTrans::Rotate270;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
|
|
|
@ -168,25 +168,23 @@ void Connection::handleEvent()
|
|||
#ifndef KWIN_BUILD_TESTING
|
||||
QPointF devicePointToGlobalPosition(const QPointF &devicePos, const Output *output)
|
||||
{
|
||||
using Transform = Output::Transform;
|
||||
|
||||
QPointF pos = devicePos;
|
||||
// TODO: Do we need to handle the flipped cases differently?
|
||||
switch (output->transform()) {
|
||||
case Transform::Normal:
|
||||
case Transform::Flipped:
|
||||
case OutputTransform::Normal:
|
||||
case OutputTransform::Flipped:
|
||||
break;
|
||||
case Transform::Rotated90:
|
||||
case Transform::Flipped90:
|
||||
case OutputTransform::Rotated90:
|
||||
case OutputTransform::Flipped90:
|
||||
pos = QPointF(output->modeSize().height() - devicePos.y(), devicePos.x());
|
||||
break;
|
||||
case Transform::Rotated180:
|
||||
case Transform::Flipped180:
|
||||
case OutputTransform::Rotated180:
|
||||
case OutputTransform::Flipped180:
|
||||
pos = QPointF(output->modeSize().width() - devicePos.x(),
|
||||
output->modeSize().height() - devicePos.y());
|
||||
break;
|
||||
case Transform::Rotated270:
|
||||
case Transform::Flipped270:
|
||||
case OutputTransform::Rotated270:
|
||||
case OutputTransform::Flipped270:
|
||||
pos = QPointF(devicePos.y(), output->modeSize().width() - devicePos.x());
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -60,34 +60,34 @@ OutputMode::Flags OutputMode::flags() const
|
|||
return m_flags;
|
||||
}
|
||||
|
||||
Output::Transform invertOutputTransform(Output::Transform transform)
|
||||
OutputTransform invertOutputTransform(OutputTransform transform)
|
||||
{
|
||||
switch (transform) {
|
||||
case Output::Transform::Normal:
|
||||
return Output::Transform::Normal;
|
||||
case Output::Transform::Rotated90:
|
||||
return Output::Transform::Rotated270;
|
||||
case Output::Transform::Rotated180:
|
||||
return Output::Transform::Rotated180;
|
||||
case Output::Transform::Rotated270:
|
||||
return Output::Transform::Rotated90;
|
||||
case Output::Transform::Flipped:
|
||||
case Output::Transform::Flipped90:
|
||||
case Output::Transform::Flipped180:
|
||||
case Output::Transform::Flipped270:
|
||||
case OutputTransform::Normal:
|
||||
return OutputTransform::Normal;
|
||||
case OutputTransform::Rotated90:
|
||||
return OutputTransform::Rotated270;
|
||||
case OutputTransform::Rotated180:
|
||||
return OutputTransform::Rotated180;
|
||||
case OutputTransform::Rotated270:
|
||||
return OutputTransform::Rotated90;
|
||||
case OutputTransform::Flipped:
|
||||
case OutputTransform::Flipped90:
|
||||
case OutputTransform::Flipped180:
|
||||
case OutputTransform::Flipped270:
|
||||
return transform; // inverse transform of a flip transform is itself
|
||||
}
|
||||
}
|
||||
|
||||
QRectF applyOutputTransform(const QRectF &rect, const QSizeF &bounds, Output::Transform transform)
|
||||
QRectF applyOutputTransform(const QRectF &rect, const QSizeF &bounds, OutputTransform transform)
|
||||
{
|
||||
QRectF dest;
|
||||
|
||||
switch (transform) {
|
||||
case Output::Transform::Normal:
|
||||
case Output::Transform::Rotated180:
|
||||
case Output::Transform::Flipped:
|
||||
case Output::Transform::Flipped180:
|
||||
case OutputTransform::Normal:
|
||||
case OutputTransform::Rotated180:
|
||||
case OutputTransform::Flipped:
|
||||
case OutputTransform::Flipped180:
|
||||
dest.setWidth(rect.width());
|
||||
dest.setHeight(rect.height());
|
||||
break;
|
||||
|
@ -98,35 +98,35 @@ QRectF applyOutputTransform(const QRectF &rect, const QSizeF &bounds, Output::Tr
|
|||
}
|
||||
|
||||
switch (transform) {
|
||||
case Output::Transform::Normal:
|
||||
case OutputTransform::Normal:
|
||||
dest.moveLeft(rect.x());
|
||||
dest.moveTop(rect.y());
|
||||
break;
|
||||
case Output::Transform::Rotated90:
|
||||
case OutputTransform::Rotated90:
|
||||
dest.moveLeft(bounds.height() - (rect.y() + rect.height()));
|
||||
dest.moveTop(rect.x());
|
||||
break;
|
||||
case Output::Transform::Rotated180:
|
||||
case OutputTransform::Rotated180:
|
||||
dest.moveLeft(bounds.width() - (rect.x() + rect.width()));
|
||||
dest.moveTop(bounds.height() - (rect.y() + rect.height()));
|
||||
break;
|
||||
case Output::Transform::Rotated270:
|
||||
case OutputTransform::Rotated270:
|
||||
dest.moveLeft(rect.y());
|
||||
dest.moveTop(bounds.width() - (rect.x() + rect.width()));
|
||||
break;
|
||||
case Output::Transform::Flipped:
|
||||
case OutputTransform::Flipped:
|
||||
dest.moveLeft(bounds.width() - (rect.x() + rect.width()));
|
||||
dest.moveTop(rect.y());
|
||||
break;
|
||||
case Output::Transform::Flipped90:
|
||||
case OutputTransform::Flipped90:
|
||||
dest.moveLeft(rect.y());
|
||||
dest.moveTop(rect.x());
|
||||
break;
|
||||
case Output::Transform::Flipped180:
|
||||
case OutputTransform::Flipped180:
|
||||
dest.moveLeft(rect.x());
|
||||
dest.moveTop(bounds.height() - (rect.y() + rect.height()));
|
||||
break;
|
||||
case Output::Transform::Flipped270:
|
||||
case OutputTransform::Flipped270:
|
||||
dest.moveLeft(bounds.height() - (rect.y() + rect.height()));
|
||||
dest.moveTop(bounds.width() - (rect.x() + rect.width()));
|
||||
break;
|
||||
|
@ -168,7 +168,7 @@ QUuid Output::uuid() const
|
|||
return m_uuid;
|
||||
}
|
||||
|
||||
Output::Transform Output::transform() const
|
||||
OutputTransform Output::transform() const
|
||||
{
|
||||
return m_state.transform;
|
||||
}
|
||||
|
@ -389,10 +389,10 @@ void Output::setState(const State &state)
|
|||
QSize Output::orientateSize(const QSize &size) const
|
||||
{
|
||||
switch (m_state.transform) {
|
||||
case Transform::Rotated90:
|
||||
case Transform::Rotated270:
|
||||
case Transform::Flipped90:
|
||||
case Transform::Flipped270:
|
||||
case OutputTransform::Rotated90:
|
||||
case OutputTransform::Rotated270:
|
||||
case OutputTransform::Flipped90:
|
||||
case OutputTransform::Flipped270:
|
||||
return size.transposed();
|
||||
default:
|
||||
return size;
|
||||
|
@ -408,37 +408,37 @@ Output::DpmsMode Output::dpmsMode() const
|
|||
return m_state.dpmsMode;
|
||||
}
|
||||
|
||||
QMatrix4x4 Output::logicalToNativeMatrix(const QRectF &rect, qreal scale, Transform transform)
|
||||
QMatrix4x4 Output::logicalToNativeMatrix(const QRectF &rect, qreal scale, OutputTransform transform)
|
||||
{
|
||||
QMatrix4x4 matrix;
|
||||
matrix.scale(scale);
|
||||
|
||||
switch (transform) {
|
||||
case Transform::Normal:
|
||||
case Transform::Flipped:
|
||||
case OutputTransform::Normal:
|
||||
case OutputTransform::Flipped:
|
||||
break;
|
||||
case Transform::Rotated90:
|
||||
case Transform::Flipped90:
|
||||
case OutputTransform::Rotated90:
|
||||
case OutputTransform::Flipped90:
|
||||
matrix.translate(0, rect.width());
|
||||
matrix.rotate(-90, 0, 0, 1);
|
||||
break;
|
||||
case Transform::Rotated180:
|
||||
case Transform::Flipped180:
|
||||
case OutputTransform::Rotated180:
|
||||
case OutputTransform::Flipped180:
|
||||
matrix.translate(rect.width(), rect.height());
|
||||
matrix.rotate(-180, 0, 0, 1);
|
||||
break;
|
||||
case Transform::Rotated270:
|
||||
case Transform::Flipped270:
|
||||
case OutputTransform::Rotated270:
|
||||
case OutputTransform::Flipped270:
|
||||
matrix.translate(rect.height(), 0);
|
||||
matrix.rotate(-270, 0, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (transform) {
|
||||
case Transform::Flipped:
|
||||
case Transform::Flipped90:
|
||||
case Transform::Flipped180:
|
||||
case Transform::Flipped270:
|
||||
case OutputTransform::Flipped:
|
||||
case OutputTransform::Flipped90:
|
||||
case OutputTransform::Flipped180:
|
||||
case OutputTransform::Flipped270:
|
||||
matrix.translate(rect.width(), 0);
|
||||
matrix.scale(-1, 1);
|
||||
break;
|
||||
|
@ -504,7 +504,7 @@ void Output::setContentType(ContentType contentType)
|
|||
m_contentType = contentType;
|
||||
}
|
||||
|
||||
Output::Transform Output::panelOrientation() const
|
||||
OutputTransform Output::panelOrientation() const
|
||||
{
|
||||
return m_information.panelOrientation;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,17 @@ enum class ContentType {
|
|||
Game = 3,
|
||||
};
|
||||
|
||||
enum class OutputTransform {
|
||||
Normal,
|
||||
Rotated90,
|
||||
Rotated180,
|
||||
Rotated270,
|
||||
Flipped,
|
||||
Flipped90,
|
||||
Flipped180,
|
||||
Flipped270
|
||||
};
|
||||
|
||||
class KWIN_EXPORT OutputMode
|
||||
{
|
||||
public:
|
||||
|
@ -214,18 +225,7 @@ public:
|
|||
*/
|
||||
static std::chrono::milliseconds dimAnimationTime();
|
||||
|
||||
enum class Transform {
|
||||
Normal,
|
||||
Rotated90,
|
||||
Rotated180,
|
||||
Rotated270,
|
||||
Flipped,
|
||||
Flipped90,
|
||||
Flipped180,
|
||||
Flipped270
|
||||
};
|
||||
Q_ENUM(Transform)
|
||||
Transform transform() const;
|
||||
OutputTransform transform() const;
|
||||
QSize orientateSize(const QSize &size) const;
|
||||
|
||||
void applyChanges(const OutputConfiguration &config);
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
/**
|
||||
* Returns a matrix that can translate into the display's coordinates system
|
||||
*/
|
||||
static QMatrix4x4 logicalToNativeMatrix(const QRectF &rect, qreal scale, Transform transform);
|
||||
static QMatrix4x4 logicalToNativeMatrix(const QRectF &rect, qreal scale, OutputTransform transform);
|
||||
|
||||
void setVrrPolicy(RenderLoop::VrrPolicy policy);
|
||||
RenderLoop::VrrPolicy vrrPolicy() const;
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
|
||||
bool isPlaceholder() const;
|
||||
bool isNonDesktop() const;
|
||||
Transform panelOrientation() const;
|
||||
OutputTransform panelOrientation() const;
|
||||
bool wideColorGamut() const;
|
||||
bool highDynamicRange() const;
|
||||
uint32_t sdrBrightness() const;
|
||||
|
@ -335,7 +335,7 @@ protected:
|
|||
Edid edid;
|
||||
SubPixel subPixel = SubPixel::Unknown;
|
||||
Capabilities capabilities;
|
||||
Transform panelOrientation = Transform::Normal;
|
||||
OutputTransform panelOrientation = OutputTransform::Normal;
|
||||
bool internal = false;
|
||||
bool placeholder = false;
|
||||
bool nonDesktop = false;
|
||||
|
@ -345,7 +345,7 @@ protected:
|
|||
{
|
||||
QPoint position;
|
||||
qreal scale = 1;
|
||||
Transform transform = Transform::Normal;
|
||||
OutputTransform transform = OutputTransform::Normal;
|
||||
QList<std::shared_ptr<OutputMode>> modes;
|
||||
std::shared_ptr<OutputMode> currentMode;
|
||||
DpmsMode dpmsMode = DpmsMode::On;
|
||||
|
@ -372,8 +372,8 @@ protected:
|
|||
};
|
||||
|
||||
// TODO: Introduce an OutputTransform type with two methods: invert + apply?
|
||||
KWIN_EXPORT Output::Transform invertOutputTransform(Output::Transform transform);
|
||||
KWIN_EXPORT QRectF applyOutputTransform(const QRectF &rect, const QSizeF &bounds, Output::Transform transform);
|
||||
KWIN_EXPORT OutputTransform invertOutputTransform(OutputTransform transform);
|
||||
KWIN_EXPORT QRectF applyOutputTransform(const QRectF &rect, const QSizeF &bounds, OutputTransform transform);
|
||||
|
||||
inline QRect Output::rect() const
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
std::optional<bool> enabled;
|
||||
std::optional<QPoint> pos;
|
||||
std::optional<double> scale;
|
||||
std::optional<Output::Transform> transform;
|
||||
std::optional<OutputTransform> transform;
|
||||
std::optional<uint32_t> overscan;
|
||||
std::optional<Output::RgbRange> rgbRange;
|
||||
std::optional<RenderLoop::VrrPolicy> vrrPolicy;
|
||||
|
|
|
@ -148,17 +148,17 @@ enum Rotation {
|
|||
Right = 8,
|
||||
};
|
||||
|
||||
Output::Transform toKWinTransform(int rotation)
|
||||
OutputTransform toKWinTransform(int rotation)
|
||||
{
|
||||
switch (Rotation(rotation)) {
|
||||
case None:
|
||||
return Output::Transform::Normal;
|
||||
return OutputTransform::Normal;
|
||||
case Left:
|
||||
return Output::Transform::Rotated90;
|
||||
return OutputTransform::Rotated90;
|
||||
case Inverted:
|
||||
return Output::Transform::Rotated180;
|
||||
return OutputTransform::Rotated180;
|
||||
case Right:
|
||||
return Output::Transform::Rotated270;
|
||||
return OutputTransform::Rotated270;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@ void SurfaceItem::setBufferSourceBox(const QRectF &box)
|
|||
m_bufferSourceBox = box;
|
||||
}
|
||||
|
||||
Output::Transform SurfaceItem::bufferTransform() const
|
||||
OutputTransform SurfaceItem::bufferTransform() const
|
||||
{
|
||||
return m_bufferTransform;
|
||||
}
|
||||
|
||||
void SurfaceItem::setBufferTransform(Output::Transform transform)
|
||||
void SurfaceItem::setBufferTransform(OutputTransform transform)
|
||||
{
|
||||
m_bufferTransform = transform;
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public:
|
|||
QRectF bufferSourceBox() const;
|
||||
void setBufferSourceBox(const QRectF &box);
|
||||
|
||||
Output::Transform bufferTransform() const;
|
||||
void setBufferTransform(Output::Transform transform);
|
||||
OutputTransform bufferTransform() const;
|
||||
void setBufferTransform(OutputTransform transform);
|
||||
|
||||
QSize bufferSize() const;
|
||||
void setBufferSize(const QSize &size);
|
||||
|
@ -64,7 +64,7 @@ protected:
|
|||
WindowQuadList buildQuads() const override;
|
||||
|
||||
QRegion m_damage;
|
||||
Output::Transform m_bufferTransform;
|
||||
OutputTransform m_bufferTransform;
|
||||
QRectF m_bufferSourceBox;
|
||||
QSize m_bufferSize;
|
||||
std::unique_ptr<SurfacePixmap> m_pixmap;
|
||||
|
|
|
@ -277,20 +277,20 @@ void TestWaylandOutput::testSubPixel()
|
|||
void TestWaylandOutput::testTransform_data()
|
||||
{
|
||||
QTest::addColumn<KWayland::Client::Output::Transform>("expected");
|
||||
QTest::addColumn<KWin::Output::Transform>("actual");
|
||||
QTest::addColumn<KWin::OutputTransform>("actual");
|
||||
|
||||
QTest::newRow("90") << KWayland::Client::Output::Transform::Rotated90 << KWin::Output::Transform::Rotated90;
|
||||
QTest::newRow("180") << KWayland::Client::Output::Transform::Rotated180 << KWin::Output::Transform::Rotated180;
|
||||
QTest::newRow("270") << KWayland::Client::Output::Transform::Rotated270 << KWin::Output::Transform::Rotated270;
|
||||
QTest::newRow("Flipped") << KWayland::Client::Output::Transform::Flipped << KWin::Output::Transform::Flipped;
|
||||
QTest::newRow("Flipped 90") << KWayland::Client::Output::Transform::Flipped90 << KWin::Output::Transform::Flipped90;
|
||||
QTest::newRow("Flipped 180") << KWayland::Client::Output::Transform::Flipped180 << KWin::Output::Transform::Flipped180;
|
||||
QTest::newRow("Flipped 280") << KWayland::Client::Output::Transform::Flipped270 << KWin::Output::Transform::Flipped270;
|
||||
QTest::newRow("90") << KWayland::Client::Output::Transform::Rotated90 << KWin::OutputTransform::Rotated90;
|
||||
QTest::newRow("180") << KWayland::Client::Output::Transform::Rotated180 << KWin::OutputTransform::Rotated180;
|
||||
QTest::newRow("270") << KWayland::Client::Output::Transform::Rotated270 << KWin::OutputTransform::Rotated270;
|
||||
QTest::newRow("Flipped") << KWayland::Client::Output::Transform::Flipped << KWin::OutputTransform::Flipped;
|
||||
QTest::newRow("Flipped 90") << KWayland::Client::Output::Transform::Flipped90 << KWin::OutputTransform::Flipped90;
|
||||
QTest::newRow("Flipped 180") << KWayland::Client::Output::Transform::Flipped180 << KWin::OutputTransform::Flipped180;
|
||||
QTest::newRow("Flipped 280") << KWayland::Client::Output::Transform::Flipped270 << KWin::OutputTransform::Flipped270;
|
||||
}
|
||||
|
||||
void TestWaylandOutput::testTransform()
|
||||
{
|
||||
QFETCH(KWin::Output::Transform, actual);
|
||||
QFETCH(KWin::OutputTransform, actual);
|
||||
|
||||
auto outputHandle = std::make_unique<FakeOutput>();
|
||||
outputHandle->setMode(QSize(1024, 768), 60000);
|
||||
|
@ -319,7 +319,7 @@ void TestWaylandOutput::testTransform()
|
|||
|
||||
// change back to normal
|
||||
outputChanged.clear();
|
||||
outputHandle->setTransform(KWin::Output::Transform::Normal);
|
||||
outputHandle->setTransform(KWin::OutputTransform::Normal);
|
||||
if (outputChanged.isEmpty()) {
|
||||
QVERIFY(outputChanged.wait());
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
QString model;
|
||||
int scale = 1;
|
||||
KWin::Output::SubPixel subPixel = KWin::Output::SubPixel::Unknown;
|
||||
KWin::Output::Transform transform = KWin::Output::Transform::Normal;
|
||||
KWin::OutputTransform transform = KWin::OutputTransform::Normal;
|
||||
QSize modeSize;
|
||||
int refreshRate = 0;
|
||||
QString name;
|
||||
|
@ -75,24 +75,24 @@ void OutputInterfacePrivate::sendScale(Resource *resource)
|
|||
}
|
||||
}
|
||||
|
||||
static quint32 kwaylandServerTransformToWaylandTransform(KWin::Output::Transform transform)
|
||||
static quint32 kwaylandServerTransformToWaylandTransform(KWin::OutputTransform transform)
|
||||
{
|
||||
switch (transform) {
|
||||
case KWin::Output::Transform::Normal:
|
||||
case KWin::OutputTransform::Normal:
|
||||
return OutputInterfacePrivate::transform_normal;
|
||||
case KWin::Output::Transform::Rotated90:
|
||||
case KWin::OutputTransform::Rotated90:
|
||||
return OutputInterfacePrivate::transform_90;
|
||||
case KWin::Output::Transform::Rotated180:
|
||||
case KWin::OutputTransform::Rotated180:
|
||||
return OutputInterfacePrivate::transform_180;
|
||||
case KWin::Output::Transform::Rotated270:
|
||||
case KWin::OutputTransform::Rotated270:
|
||||
return OutputInterfacePrivate::transform_270;
|
||||
case KWin::Output::Transform::Flipped:
|
||||
case KWin::OutputTransform::Flipped:
|
||||
return OutputInterfacePrivate::transform_flipped;
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
case KWin::OutputTransform::Flipped90:
|
||||
return OutputInterfacePrivate::transform_flipped_90;
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
case KWin::OutputTransform::Flipped180:
|
||||
return OutputInterfacePrivate::transform_flipped_180;
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
case KWin::OutputTransform::Flipped270:
|
||||
return OutputInterfacePrivate::transform_flipped_270;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
|
@ -224,7 +224,7 @@ OutputInterface::OutputInterface(Display *display, KWin::Output *handle, QObject
|
|||
});
|
||||
|
||||
connect(handle, &KWin::Output::transformChanged, this, [this]() {
|
||||
const KWin::Output::Transform transform = d->handle->transform();
|
||||
const KWin::OutputTransform transform = d->handle->transform();
|
||||
if (d->transform != transform) {
|
||||
d->transform = transform;
|
||||
const auto resources = d->resourceMap();
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace KWaylandServer
|
|||
|
||||
static const quint32 s_version = 3;
|
||||
|
||||
static QtWaylandServer::kde_output_device_v2::transform kwinTransformToOutputDeviceTransform(Output::Transform transform)
|
||||
static QtWaylandServer::kde_output_device_v2::transform kwinTransformToOutputDeviceTransform(OutputTransform transform)
|
||||
{
|
||||
return static_cast<QtWaylandServer::kde_output_device_v2::transform>(transform);
|
||||
}
|
||||
|
|
|
@ -131,22 +131,22 @@ void OutputConfigurationV2Interface::kde_output_configuration_v2_transform(Resou
|
|||
auto toTransform = [transform]() {
|
||||
switch (transform) {
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
return Output::Transform::Rotated90;
|
||||
return OutputTransform::Rotated90;
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
return Output::Transform::Rotated180;
|
||||
return OutputTransform::Rotated180;
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
return Output::Transform::Rotated270;
|
||||
return OutputTransform::Rotated270;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||
return Output::Transform::Flipped;
|
||||
return OutputTransform::Flipped;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
return Output::Transform::Flipped90;
|
||||
return OutputTransform::Flipped90;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
return Output::Transform::Flipped180;
|
||||
return OutputTransform::Flipped180;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
return Output::Transform::Flipped270;
|
||||
return OutputTransform::Flipped270;
|
||||
case WL_OUTPUT_TRANSFORM_NORMAL:
|
||||
default:
|
||||
return Output::Transform::Normal;
|
||||
return OutputTransform::Normal;
|
||||
}
|
||||
};
|
||||
auto _transform = toTransform();
|
||||
|
|
|
@ -322,7 +322,7 @@ void SurfaceInterfacePrivate::surface_set_buffer_transform(Resource *resource, i
|
|||
wl_resource_post_error(resource->handle, error_invalid_transform, "buffer transform must be a valid transform (%d specified)", transform);
|
||||
return;
|
||||
}
|
||||
pending.bufferTransform = KWin::Output::Transform(transform);
|
||||
pending.bufferTransform = KWin::OutputTransform(transform);
|
||||
pending.bufferTransformIsSet = true;
|
||||
}
|
||||
|
||||
|
@ -423,34 +423,34 @@ QMatrix4x4 SurfaceInterfacePrivate::buildSurfaceToBufferMatrix()
|
|||
surfaceToBufferMatrix.scale(scaleOverride, scaleOverride);
|
||||
|
||||
switch (current.bufferTransform) {
|
||||
case KWin::Output::Transform::Normal:
|
||||
case KWin::Output::Transform::Flipped:
|
||||
case KWin::OutputTransform::Normal:
|
||||
case KWin::OutputTransform::Flipped:
|
||||
break;
|
||||
case KWin::Output::Transform::Rotated90:
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
case KWin::OutputTransform::Rotated90:
|
||||
case KWin::OutputTransform::Flipped90:
|
||||
surfaceToBufferMatrix.translate(0, bufferSize.height() / current.bufferScale);
|
||||
surfaceToBufferMatrix.rotate(-90, 0, 0, 1);
|
||||
break;
|
||||
case KWin::Output::Transform::Rotated180:
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
case KWin::OutputTransform::Rotated180:
|
||||
case KWin::OutputTransform::Flipped180:
|
||||
surfaceToBufferMatrix.translate(bufferSize.width() / current.bufferScale, bufferSize.height() / current.bufferScale);
|
||||
surfaceToBufferMatrix.rotate(-180, 0, 0, 1);
|
||||
break;
|
||||
case KWin::Output::Transform::Rotated270:
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
case KWin::OutputTransform::Rotated270:
|
||||
case KWin::OutputTransform::Flipped270:
|
||||
surfaceToBufferMatrix.translate(bufferSize.width() / current.bufferScale, 0);
|
||||
surfaceToBufferMatrix.rotate(-270, 0, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (current.bufferTransform) {
|
||||
case KWin::Output::Transform::Flipped:
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
case KWin::OutputTransform::Flipped:
|
||||
case KWin::OutputTransform::Flipped180:
|
||||
surfaceToBufferMatrix.translate(bufferSize.width() / current.bufferScale, 0);
|
||||
surfaceToBufferMatrix.scale(-1, 1);
|
||||
break;
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
case KWin::OutputTransform::Flipped90:
|
||||
case KWin::OutputTransform::Flipped270:
|
||||
surfaceToBufferMatrix.translate(bufferSize.height() / current.bufferScale, 0);
|
||||
surfaceToBufferMatrix.scale(-1, 1);
|
||||
break;
|
||||
|
@ -574,16 +574,16 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next)
|
|||
|
||||
implicitSurfaceSize = current.buffer->size() / current.bufferScale;
|
||||
switch (current.bufferTransform) {
|
||||
case KWin::Output::Transform::Rotated90:
|
||||
case KWin::Output::Transform::Rotated270:
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
case KWin::OutputTransform::Rotated90:
|
||||
case KWin::OutputTransform::Rotated270:
|
||||
case KWin::OutputTransform::Flipped90:
|
||||
case KWin::OutputTransform::Flipped270:
|
||||
implicitSurfaceSize.transpose();
|
||||
break;
|
||||
case KWin::Output::Transform::Normal:
|
||||
case KWin::Output::Transform::Rotated180:
|
||||
case KWin::Output::Transform::Flipped:
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
case KWin::OutputTransform::Normal:
|
||||
case KWin::OutputTransform::Rotated180:
|
||||
case KWin::OutputTransform::Flipped:
|
||||
case KWin::OutputTransform::Flipped180:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ QRectF SurfaceInterface::bufferSourceBox() const
|
|||
return KWin::applyOutputTransform(box, d->bufferSize, KWin::invertOutputTransform(d->current.bufferTransform));
|
||||
}
|
||||
|
||||
KWin::Output::Transform SurfaceInterface::bufferTransform() const
|
||||
KWin::OutputTransform SurfaceInterface::bufferTransform() const
|
||||
{
|
||||
return d->current.bufferTransform;
|
||||
}
|
||||
|
@ -1117,7 +1117,7 @@ void SurfaceInterface::setPreferredBufferScale(qreal scale)
|
|||
}
|
||||
}
|
||||
|
||||
void SurfaceInterface::setPreferredBufferTransform(KWin::Output::Transform transform)
|
||||
void SurfaceInterface::setPreferredBufferTransform(KWin::OutputTransform transform)
|
||||
{
|
||||
if (transform == d->preferredBufferTransform) {
|
||||
return;
|
||||
|
|
|
@ -77,7 +77,6 @@ class KWIN_EXPORT SurfaceInterface : public QObject
|
|||
* The current input region.
|
||||
*/
|
||||
Q_PROPERTY(QRegion input READ input NOTIFY inputChanged)
|
||||
Q_PROPERTY(KWin::Output::Transform bufferTransform READ bufferTransform NOTIFY bufferTransformChanged)
|
||||
Q_PROPERTY(QSizeF size READ size NOTIFY sizeChanged)
|
||||
public:
|
||||
explicit SurfaceInterface(CompositorInterface *compositor, wl_resource *resource);
|
||||
|
@ -153,7 +152,7 @@ public:
|
|||
* If the surface is on an output that is rotated 90 degrees clockwise, the buffer will
|
||||
* be rotated 90 degrees counter clockwise.
|
||||
*/
|
||||
KWin::Output::Transform bufferTransform() const;
|
||||
KWin::OutputTransform bufferTransform() const;
|
||||
/**
|
||||
* @returns the current GraphicsBuffer, might be @c nullptr.
|
||||
*/
|
||||
|
@ -336,7 +335,7 @@ public:
|
|||
* This indicates to the client the preferred buffer transform to use when
|
||||
* attaching buffers to this surface.
|
||||
*/
|
||||
void setPreferredBufferTransform(KWin::Output::Transform transform);
|
||||
void setPreferredBufferTransform(KWin::OutputTransform transform);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
|
@ -371,7 +370,7 @@ Q_SIGNALS:
|
|||
/**
|
||||
* This signal is emitted when the buffer transform has changed.
|
||||
*/
|
||||
void bufferTransformChanged(KWin::Output::Transform);
|
||||
void bufferTransformChanged(KWin::OutputTransform);
|
||||
/**
|
||||
* This signal is emitted when the size of the attached buffer has changed.
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,7 @@ struct SurfaceState
|
|||
bool contentTypeIsSet = false;
|
||||
bool tearingIsSet = false;
|
||||
qint32 bufferScale = 1;
|
||||
KWin::Output::Transform bufferTransform = KWin::Output::Transform::Normal;
|
||||
KWin::OutputTransform bufferTransform = KWin::OutputTransform::Normal;
|
||||
wl_list frameCallbacks;
|
||||
QPoint offset = QPoint();
|
||||
QPointer<KWin::GraphicsBuffer> buffer;
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
|
||||
QVector<OutputInterface *> outputs;
|
||||
qreal preferredBufferScale = 1.0;
|
||||
KWin::Output::Transform preferredBufferTransform = KWin::Output::Transform::Normal;
|
||||
KWin::OutputTransform preferredBufferTransform = KWin::OutputTransform::Normal;
|
||||
|
||||
LockedPointerV1Interface *lockedPointer = nullptr;
|
||||
ConfinedPointerV1Interface *confinedPointer = nullptr;
|
||||
|
|
|
@ -28,7 +28,7 @@ void FakeOutput::setMode(QSize size, uint32_t refreshRate)
|
|||
setState(state);
|
||||
}
|
||||
|
||||
void FakeOutput::setTransform(Transform transform)
|
||||
void FakeOutput::setTransform(KWin::OutputTransform transform)
|
||||
{
|
||||
State state = m_state;
|
||||
state.transform = transform;
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
void setSubPixel(SubPixel subPixel);
|
||||
void setDpmsSupported(bool supported);
|
||||
void setPhysicalSize(QSize size);
|
||||
void setTransform(Transform transform);
|
||||
void setTransform(KWin::OutputTransform transform);
|
||||
void moveTo(const QPoint &pos);
|
||||
void setScale(qreal scale);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue