diff --git a/shell_client.cpp b/shell_client.cpp index 9c75487f7e..c9b3c94645 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -165,6 +165,7 @@ void ShellClient::addDamage(const QRegion &damage) } setGeometry(QRect(position, m_clientSize)); } + setDepth(m_shellSurface->surface()->buffer()->hasAlphaChannel() ? 32 : 24); setReadyForPainting(); Toplevel::addDamage(damage); } diff --git a/toplevel.cpp b/toplevel.cpp index 48724cbee4..8f80323e82 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -42,6 +42,7 @@ namespace KWin Toplevel::Toplevel() : m_visual(XCB_NONE) + , bit_depth(24) , info(NULL) , ready_for_painting(true) , m_isDamaged(false) @@ -475,6 +476,18 @@ QByteArray Toplevel::windowRole() const return QByteArray(info->windowRole()); } +void Toplevel::setDepth(int depth) +{ + if (bit_depth == depth) { + return; + } + const bool oldAlpha = hasAlpha(); + bit_depth = depth; + if (oldAlpha != hasAlpha()) { + emit hasAlphaChanged(); + } +} + } // namespace #include "toplevel.moc" diff --git a/toplevel.h b/toplevel.h index ea21734546..3aea1bc0c3 100644 --- a/toplevel.h +++ b/toplevel.h @@ -71,7 +71,7 @@ class Toplevel : public QObject { Q_OBJECT - Q_PROPERTY(bool alpha READ hasAlpha CONSTANT) + Q_PROPERTY(bool alpha READ hasAlpha NOTIFY hasAlphaChanged) Q_PROPERTY(qulonglong frameId READ frameId) Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged) Q_PROPERTY(QRect visibleRect READ visibleRect) @@ -414,6 +414,10 @@ Q_SIGNALS: * @since 5.3 **/ void surfaceIdChanged(quint32); + /** + * @since 5.4 + **/ + void hasAlphaChanged(); protected Q_SLOTS: /** @@ -460,6 +464,7 @@ protected: friend QDebug& operator<<(QDebug& stream, const Toplevel*); void deleteEffectWindow(); virtual bool shouldUnredirect() const = 0; + void setDepth(int depth); QRect geom; xcb_visualid_t m_visual; int bit_depth;