diff --git a/src/backends/drm/drm_connector.cpp b/src/backends/drm/drm_connector.cpp index caf5bd0871..79db47f196 100644 --- a/src/backends/drm/drm_connector.cpp +++ b/src/backends/drm/drm_connector.cpp @@ -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(); } diff --git a/src/backends/drm/drm_connector.h b/src/backends/drm/drm_connector.h index 1e66aca6b7..cbbf27c705 100644 --- a/src/backends/drm/drm_connector.h +++ b/src/backends/drm/drm_connector.h @@ -130,7 +130,7 @@ public: DrmEnumProperty 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); diff --git a/src/backends/drm/drm_output.cpp b/src/backends/drm/drm_output.cpp index ea13619a34..6e0590fb16 100644 --- a/src/backends/drm/drm_output.cpp +++ b/src/backends/drm/drm_output.cpp @@ -81,7 +81,7 @@ DrmOutput::DrmOutput(const std::shared_ptr &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(); diff --git a/src/backends/libinput/connection.cpp b/src/backends/libinput/connection.cpp index c7b3d5f524..4c59f46b45 100644 --- a/src/backends/libinput/connection.cpp +++ b/src/backends/libinput/connection.cpp @@ -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: diff --git a/src/core/output.cpp b/src/core/output.cpp index 88bc085ce2..f63cfae80c 100644 --- a/src/core/output.cpp +++ b/src/core/output.cpp @@ -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; } diff --git a/src/core/output.h b/src/core/output.h index 8a2fc87eea..0432c75729 100644 --- a/src/core/output.h +++ b/src/core/output.h @@ -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> modes; std::shared_ptr 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 { diff --git a/src/core/outputconfiguration.h b/src/core/outputconfiguration.h index ab3214a60f..1996a6cc66 100644 --- a/src/core/outputconfiguration.h +++ b/src/core/outputconfiguration.h @@ -25,7 +25,7 @@ public: std::optional enabled; std::optional pos; std::optional scale; - std::optional transform; + std::optional transform; std::optional overscan; std::optional rgbRange; std::optional vrrPolicy; diff --git a/src/kscreenintegration.cpp b/src/kscreenintegration.cpp index a279eee029..9c8a3ae026 100644 --- a/src/kscreenintegration.cpp +++ b/src/kscreenintegration.cpp @@ -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(); } diff --git a/src/scene/surfaceitem.cpp b/src/scene/surfaceitem.cpp index a43fabf314..0befccd866 100644 --- a/src/scene/surfaceitem.cpp +++ b/src/scene/surfaceitem.cpp @@ -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; } diff --git a/src/scene/surfaceitem.h b/src/scene/surfaceitem.h index 227579fd67..b91a4f6cc9 100644 --- a/src/scene/surfaceitem.h +++ b/src/scene/surfaceitem.h @@ -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 m_pixmap; diff --git a/src/wayland/autotests/client/test_wayland_output.cpp b/src/wayland/autotests/client/test_wayland_output.cpp index 046c42e9b9..f4bb5a8ab6 100644 --- a/src/wayland/autotests/client/test_wayland_output.cpp +++ b/src/wayland/autotests/client/test_wayland_output.cpp @@ -277,20 +277,20 @@ void TestWaylandOutput::testSubPixel() void TestWaylandOutput::testTransform_data() { QTest::addColumn("expected"); - QTest::addColumn("actual"); + QTest::addColumn("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(); 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()); } diff --git a/src/wayland/output_interface.cpp b/src/wayland/output_interface.cpp index ce27e724b8..b54a0b2e8f 100644 --- a/src/wayland/output_interface.cpp +++ b/src/wayland/output_interface.cpp @@ -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(); diff --git a/src/wayland/outputdevice_v2_interface.cpp b/src/wayland/outputdevice_v2_interface.cpp index cbe65d05b5..0fb4713b86 100644 --- a/src/wayland/outputdevice_v2_interface.cpp +++ b/src/wayland/outputdevice_v2_interface.cpp @@ -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(transform); } diff --git a/src/wayland/outputmanagement_v2_interface.cpp b/src/wayland/outputmanagement_v2_interface.cpp index c22e9fa8eb..1744bbc36a 100644 --- a/src/wayland/outputmanagement_v2_interface.cpp +++ b/src/wayland/outputmanagement_v2_interface.cpp @@ -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(); diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index 2f3390be79..0167b3100e 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -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; diff --git a/src/wayland/surface_interface.h b/src/wayland/surface_interface.h index 62c7049628..8fc8a25964 100644 --- a/src/wayland/surface_interface.h +++ b/src/wayland/surface_interface.h @@ -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. */ diff --git a/src/wayland/surface_interface_p.h b/src/wayland/surface_interface_p.h index 962af13a21..c4ce0bcdfc 100644 --- a/src/wayland/surface_interface_p.h +++ b/src/wayland/surface_interface_p.h @@ -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 buffer; @@ -134,7 +134,7 @@ public: QVector 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; diff --git a/src/wayland/tests/fakeoutput.cpp b/src/wayland/tests/fakeoutput.cpp index a529a0116b..0f47ccc4ff 100644 --- a/src/wayland/tests/fakeoutput.cpp +++ b/src/wayland/tests/fakeoutput.cpp @@ -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; diff --git a/src/wayland/tests/fakeoutput.h b/src/wayland/tests/fakeoutput.h index 2e0dac27d6..71012bb170 100644 --- a/src/wayland/tests/fakeoutput.h +++ b/src/wayland/tests/fakeoutput.h @@ -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); };