diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index ba94274d03..19e1f81a28 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -27,8 +27,11 @@ along with this program. If not, see . #include #include #include +#include #include +#include +#include namespace Aurorae { @@ -459,6 +462,20 @@ void AuroraeButton::paintButton(QPainter &painter, Plasma::FrameSvg *frame, Butt AuroraeClient::AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *factory) : KCommonDecorationUnstable(bridge, factory) { + Display *dpy = QX11Info::display(); + int screen = DefaultScreen(dpy); + char net_wm_cm_name[100]; + sprintf(net_wm_cm_name, "_NET_WM_CM_S%d", screen); + m_compositingWatch = new KSelectionWatcher(net_wm_cm_name, -1, this); + // HACK: we have to delay the update to the mask and repaint of window a little bit + // otherwise we would be faster than KWin core resulting in not painted shadows + // the selection watcher and the timer should be removed when KWin provides the info + m_compositingTimer = new QTimer(this); + m_compositingTimer->setSingleShot(true); + m_compositingTimer->setInterval(100); + connect(m_compositingWatch, SIGNAL(newOwner(Window)), m_compositingTimer, SLOT(start())); + connect(m_compositingWatch, SIGNAL(lostOwner()), m_compositingTimer, SLOT(start())); + connect(m_compositingTimer, SIGNAL(timeout()), this, SLOT(compositingChanged())); } AuroraeClient::~AuroraeClient() @@ -765,6 +782,12 @@ void AuroraeClient::updateWindowShape() setMask(mask); } +void AuroraeClient::compositingChanged() +{ + updateWindowShape(); + widget()->update(); +} + } // namespace Aurorae extern "C" diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index 038e187507..3004985e99 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -24,6 +24,7 @@ along with this program. If not, see . #include #include +class KSelectionWatcher; namespace Aurorae { @@ -106,6 +107,7 @@ private: class AuroraeClient : public KCommonDecorationUnstable { + Q_OBJECT public: AuroraeClient(KDecorationBridge *bridge, KDecorationFactory *factory); ~AuroraeClient(); @@ -124,6 +126,13 @@ public: protected: void reset(unsigned long changed); void paintEvent(QPaintEvent *event); + +private Q_SLOTS: + void compositingChanged(); + +private: + KSelectionWatcher *m_compositingWatch; + QTimer *m_compositingTimer; }; }