effects: Allow exposing an EffectScreen::transform

This way an effect can know the transformation that is applied on a
display.
This commit is contained in:
Aleix Pol 2021-07-29 04:07:13 +02:00 committed by Aleix Pol Gonzalez
parent 34cfc6680b
commit 24cc93ec5b
5 changed files with 34 additions and 13 deletions

View file

@ -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.

View file

@ -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;

View file

@ -1754,6 +1754,11 @@ QRect EffectScreenImpl::geometry() const
return m_platformOutput->geometry();
}
EffectScreen::Transform EffectScreenImpl::transform() const
{
return EffectScreen::Transform(m_platformOutput->transform());
}
//****************************************
// EffectWindowImpl
//****************************************

View file

@ -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;

View file

@ -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.