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
This commit is contained in:
Martin Gräßlin 2009-07-27 21:30:26 +00:00
parent 46def0304e
commit d32d9c4876
2 changed files with 32 additions and 0 deletions

View file

@ -27,8 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/Plasma/PaintUtils>
#include <KIconEffect>
#include <KIconLoader>
#include <KSelectionWatcher>
#include <QPainter>
#include <QTimer>
#include <QX11Info>
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"

View file

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kcommondecoration.h>
#include <KDE/Plasma/FrameSvg>
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;
};
}