diff --git a/applethandle.cpp b/applethandle.cpp index 5698ca347..85137f5e8 100644 --- a/applethandle.cpp +++ b/applethandle.cpp @@ -20,6 +20,7 @@ #include "applethandle_p.h" #include +#include #include #include #include @@ -465,6 +466,24 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event) kDebug() << "scaling topview with: " << scale; m_topview->scale(scale, scale); + //Paint a mask based on the applets shape. + //TODO: might be useful to have this in applet? + QBitmap bitmap(m_applet->screenRect().size()); + QPainter * shapePainter = new QPainter(); + shapePainter->begin(&bitmap); + shapePainter->fillRect(0, 0, m_applet->screenRect().width(), + m_applet->screenRect().height(), + Qt::white); + shapePainter->setBrush(Qt::black); + + shapePainter->drawPath(m_applet->shape()); + + shapePainter->end(); + + delete shapePainter; + + m_topview->setMask(bitmap); + m_topview->show(); m_applet->setGhostView(m_applet->containment()->view());