From 81ef314bdd2a763c9523f299af750e08d7b6a322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 24 Jun 2013 08:29:32 +0200 Subject: [PATCH] SnapHelper effect supports QPainter compositing --- effects/snaphelper/snaphelper.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/effects/snaphelper/snaphelper.cpp b/effects/snaphelper/snaphelper.cpp index 86dd4b6d53..a8cd1a96e8 100644 --- a/effects/snaphelper/snaphelper.cpp +++ b/effects/snaphelper/snaphelper.cpp @@ -25,6 +25,7 @@ along with this program. If not, see . #include #include #endif +#include namespace KWin { @@ -160,6 +161,31 @@ void SnapHelperEffect::postPaintScreen() } #endif } + if (effects->compositingType() == QPainterCompositing) { + QPainter *painter = effects->scenePainter(); + painter->save(); + QColor color; + color.setRedF(0.5); + color.setGreenF(0.5); + color.setBlueF(0.5); + color.setAlphaF(m_timeline.currentValue() * 0.5); + QPen pen(color); + pen.setWidth(4); + painter->setPen(pen); + painter->setBrush(Qt::NoBrush); + + for (int i = 0; i < effects->numScreens(); ++i) { + const QRect &rect = effects->clientArea(ScreenArea, i, 0); + // Center lines + painter->drawLine(rect.center().x(), rect.y(), rect.center().x(), rect.y() + rect.height()); + painter->drawLine(rect.x(), rect.center().y(), rect.x() + rect.width(), rect.center().y()); + + // window outline + QRect windowRect(rect.center(), m_window->geometry().size()); + painter->drawRect(windowRect.translated(-windowRect.width()/2, -windowRect.height()/2)); + } + painter->restore(); + } } else if (m_window && !m_active) { if (m_window->isDeleted()) m_window->unrefWindow();