Move AbstractClient::isShade() to Toplevel

This simplifies rendering code and allows to cache properly the shaded
state for Deleted windows.
This commit is contained in:
Vlad Zahorodnii 2021-05-26 12:34:35 +03:00
parent 43106b7e5d
commit a106a5aab8
5 changed files with 14 additions and 5 deletions

View file

@ -521,7 +521,7 @@ public:
/**
* @c true only for @c ShadeNormal
*/
bool isShade() const {
bool isShade() const override {
return shadeMode() == ShadeNormal;
}
ShadeMode shadeMode() const; // Prefer isShade()
@ -918,7 +918,6 @@ Q_SIGNALS:
void desktopChanged();
void activitiesChanged(KWin::AbstractClient* client);
void x11DesktopIdsChanged();
void shadeChanged();
void minimizedChanged();
void clientMinimized(KWin::AbstractClient* client, bool animate);
void clientUnminimized(KWin::AbstractClient* client, bool animate);

View file

@ -25,6 +25,7 @@ Deleted::Deleted()
, delete_refcount(1)
, m_frame(XCB_WINDOW_NONE)
, m_layer(UnknownLayer)
, m_shade(false)
, m_minimized(false)
, m_modal(false)
, m_wasClient(false)
@ -78,6 +79,7 @@ void Deleted::copyToDeleted(Toplevel* c)
m_frame = c->frameId();
m_type = c->windowType();
m_windowRole = c->windowRole();
m_shade = c->isShade();
if (WinInfo* cinfo = dynamic_cast< WinInfo* >(info))
cinfo->disable();
if (AbstractClient *client = dynamic_cast<AbstractClient*>(c)) {

View file

@ -40,6 +40,9 @@ public:
Layer layer() const override {
return m_layer;
}
bool isShade() const override {
return m_shade;
}
bool isMinimized() const {
return m_minimized;
}
@ -113,6 +116,7 @@ private:
QRect decoration_top;
QRect decoration_bottom;
Layer m_layer;
bool m_shade;
bool m_minimized;
bool m_modal;
QList<AbstractClient*> m_mainClients;

View file

@ -836,9 +836,7 @@ bool Scene::Window::isOpaque() const
bool Scene::Window::isShaded() const
{
if (AbstractClient *client = qobject_cast<AbstractClient *>(toplevel))
return client->isShade();
return false;
return toplevel->isShade();
}
bool Scene::Window::isPaintingEnabled() const

View file

@ -562,7 +562,13 @@ public:
return m_internalId;
}
/**
* Returns @c true if the window is shaded; otherwise returns @c false.
*/
virtual bool isShade() const { return false; }
Q_SIGNALS:
void shadeChanged();
void markedAsZombie();
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
void damaged(KWin::Toplevel* toplevel, const QRegion& damage);