From d32d9c4876329a5fb42274079c97b817ddab536f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 27 Jul 2009 21:30:26 +0000 Subject: [PATCH] As KSelectionWatcher is finally working we can add a selection watcher on compositing change to update the mask and to repaint the deco. So finally we have the shadow back when resuming. Of course it would be nice if kwin would just inform the decos and they don't have to watch for themselves ;-) svn path=/trunk/KDE/kdebase/workspace/; revision=1003235 --- clients/aurorae/src/aurorae.cpp | 23 +++++++++++++++++++++++ clients/aurorae/src/aurorae.h | 9 +++++++++ 2 files changed, 32 insertions(+) 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; }; }