From 24cc93ec5b9a640e9a6ffd2c22b723da20ef001e Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 29 Jul 2021 04:07:13 +0200 Subject: [PATCH] effects: Allow exposing an EffectScreen::transform This way an effect can know the transformation that is applied on a display. --- src/abstract_output.h | 13 +++++++++++++ src/abstract_wayland_output.h | 14 +------------- src/effects.cpp | 5 +++++ src/effects.h | 1 + src/libkwineffects/kwineffects.h | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/abstract_output.h b/src/abstract_output.h index a93af2a360..cc47116830 100644 --- a/src/abstract_output.h +++ b/src/abstract_output.h @@ -207,6 +207,19 @@ public: */ static std::chrono::milliseconds dimAnimationTime(); + enum class Transform { + Normal, + Rotated90, + Rotated180, + Rotated270, + Flipped, + Flipped90, + Flipped180, + Flipped270 + }; + Q_ENUM(Transform) + virtual Transform transform() const { return Transform::Normal; } + Q_SIGNALS: /** * This signal is emitted when the geometry of this output has changed. diff --git a/src/abstract_wayland_output.h b/src/abstract_wayland_output.h index ea6f6d801c..2b07e37c84 100644 --- a/src/abstract_wayland_output.h +++ b/src/abstract_wayland_output.h @@ -32,18 +32,6 @@ class KWIN_EXPORT AbstractWaylandOutput : public AbstractOutput { Q_OBJECT public: - enum class Transform { - Normal, - Rotated90, - Rotated180, - Rotated270, - Flipped, - Flipped90, - Flipped180, - Flipped270 - }; - Q_ENUM(Transform) - enum class ModeFlag : uint { Current = 0x1, Preferred = 0x2, @@ -106,7 +94,7 @@ public: * - Rotated 270° and flipped along the horizontal axis is inv. portrait + inv. landscape + * portrait */ - Transform transform() const; + Transform transform() const override; int refreshRate() const override; diff --git a/src/effects.cpp b/src/effects.cpp index e80bc18e5b..d79347beb7 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -1754,6 +1754,11 @@ QRect EffectScreenImpl::geometry() const return m_platformOutput->geometry(); } +EffectScreen::Transform EffectScreenImpl::transform() const +{ + return EffectScreen::Transform(m_platformOutput->transform()); +} + //**************************************** // EffectWindowImpl //**************************************** diff --git a/src/effects.h b/src/effects.h index c61b8b4c53..2c17452de2 100644 --- a/src/effects.h +++ b/src/effects.h @@ -369,6 +369,7 @@ public: QString name() const override; qreal devicePixelRatio() const override; QRect geometry() const override; + Transform transform() const override; private: AbstractOutput *m_platformOutput; diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index 53e3d2f5a5..de93144896 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -1853,6 +1853,20 @@ public: */ virtual QRect geometry() const = 0; + + enum class Transform { + Normal, + Rotated90, + Rotated180, + Rotated270, + Flipped, + Flipped90, + Flipped180, + Flipped270 + }; + Q_ENUM(Transform) + virtual Transform transform() const = 0; + Q_SIGNALS: /** * Notifies that the display will be dimmed in @p time ms.