Add some missing properties to Deleted

Summary:
### keepAbove

Some effects(e.g. Dim Inactive) can take keep above state of a window
into account when they are making decision whether to operate on it.
Because Deleted doesn't expose keepAbove property, it will be always
`true`, which is wrong.

### keepBelow

This property was added as a counterpart to keepAbove.

### caption

That's mostly for debugging purposes, e.g.

```lang=cpp
void CoolEffect::windowClosed(EffectWindow *w)
{
    qDebug() << w->caption() << "has been closed";
    qDebug() << "keep above:" << w->keepAbove();
}
```

Test Plan: Manually.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13649
icc-effect-5.14.5
Vlad Zagorodniy 2018-06-21 10:42:16 +03:00
parent be5d0f6bac
commit dcc349c1ef
2 changed files with 20 additions and 0 deletions

View File

@ -44,6 +44,8 @@ Deleted::Deleted()
, m_wasCurrentTab(true)
, m_decorationRenderer(nullptr)
, m_fullscreen(false)
, m_keepAbove(false)
, m_keepBelow(false)
{
}
@ -112,6 +114,9 @@ void Deleted::copyToDeleted(Toplevel* c)
}
m_fullscreen = client->isFullScreen();
m_wasCurrentTab = client->isCurrentTab();
m_keepAbove = client->keepAbove();
m_keepBelow = client->keepBelow();
m_caption = client->caption();
}
}

View File

@ -41,6 +41,9 @@ class KWIN_EXPORT Deleted
Q_PROPERTY(bool modal READ isModal)
Q_PROPERTY(bool fullScreen READ isFullScreen CONSTANT)
Q_PROPERTY(bool isCurrentTab READ isCurrentTab)
Q_PROPERTY(bool keepAbove READ keepAbove CONSTANT)
Q_PROPERTY(bool keepBelow READ keepBelow CONSTANT)
Q_PROPERTY(QString caption READ caption CONSTANT)
public:
static Deleted* create(Toplevel* c);
// used by effects to keep the window around for e.g. fadeout effects when it's destroyed
@ -92,6 +95,15 @@ public:
bool isCurrentTab() const {
return m_wasCurrentTab;
}
bool keepAbove() const {
return m_keepAbove;
}
bool keepBelow() const {
return m_keepBelow;
}
QString caption() const {
return m_caption;
}
protected:
virtual void debug(QDebug& stream) const;
private Q_SLOTS:
@ -125,6 +137,9 @@ private:
NET::WindowType m_type = NET::Unknown;
QByteArray m_windowRole;
bool m_fullscreen;
bool m_keepAbove;
bool m_keepBelow;
QString m_caption;
};
inline void Deleted::refWindow()