From dcab3d44f37d0e3de7d3371cc4d3ff327e9b0573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 29 Dec 2012 16:27:08 +0100 Subject: [PATCH] snaphelper: repaint center rect on resizing client BUG: 311551 FIXED-IN: 4.10 REVIEW: 108005 --- effects/snaphelper/snaphelper.cpp | 16 ++++++++++++++-- effects/snaphelper/snaphelper.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/effects/snaphelper/snaphelper.cpp b/effects/snaphelper/snaphelper.cpp index cdb00bc65d..f2a286aa5a 100644 --- a/effects/snaphelper/snaphelper.cpp +++ b/effects/snaphelper/snaphelper.cpp @@ -39,6 +39,7 @@ SnapHelperEffect::SnapHelperEffect() connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*))); connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*))); + connect(effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*, const QRect&)), this, SLOT(slotWindowResized(KWin::EffectWindow*, const QRect&))); /*if ( effects->compositingType() == XRenderCompositing ) { @@ -94,7 +95,7 @@ void SnapHelperEffect::postPaintScreen() glLineWidth(4.0); QVector verts; verts.reserve(effects->numScreens() * 24); - for (int i = 0; i < effects->numScreens(); i++) { + for (int i = 0; i < effects->numScreens(); ++i) { const QRect& rect = effects->clientArea(ScreenArea, i, 0); int midX = rect.x() + rect.width() / 2; int midY = rect.y() + rect.height() / 2 ; @@ -126,7 +127,7 @@ void SnapHelperEffect::postPaintScreen() } if ( effects->compositingType() == XRenderCompositing ) { #ifdef KWIN_HAVE_XRENDER_COMPOSITING - for ( int i = 0; i < effects->numScreens(); i++ ) { + for (int i = 0; i < effects->numScreens(); ++i) { const QRect& rect = effects->clientArea( ScreenArea, i, 0 ); int midX = rect.x() + rect.width() / 2; int midY = rect.y() + rect.height() / 2 ; @@ -201,6 +202,17 @@ void SnapHelperEffect::slotWindowFinishUserMovedResized(EffectWindow *w) } } +void SnapHelperEffect::slotWindowResized(KWin::EffectWindow *w, const QRect &oldRect) +{ + if (w == m_window) { + QRect r(oldRect); + for (int i = 0; i < effects->numScreens(); ++i) { + r.moveCenter(effects->clientArea( ScreenArea, i, 0 ).center()); + effects->addRepaint(r); + } + } +} + bool SnapHelperEffect::isActive() const { return m_active || m_timeline.currentValue() != 0.0; diff --git a/effects/snaphelper/snaphelper.h b/effects/snaphelper/snaphelper.h index 464ae3f080..3dd67314bc 100644 --- a/effects/snaphelper/snaphelper.h +++ b/effects/snaphelper/snaphelper.h @@ -45,6 +45,7 @@ public Q_SLOTS: void slotWindowClosed(KWin::EffectWindow *w); void slotWindowStartUserMovedResized(KWin::EffectWindow *w); void slotWindowFinishUserMovedResized(KWin::EffectWindow *w); + void slotWindowResized(KWin::EffectWindow *w, const QRect &r); private: bool m_active;