snaphelper: repaint center rect on resizing client

BUG: 311551
FIXED-IN: 4.10
REVIEW: 108005
This commit is contained in:
Thomas Lübking 2012-12-29 16:27:08 +01:00
parent 8239c686f6
commit d83d4a7977
2 changed files with 15 additions and 2 deletions

View file

@ -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<float> 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;

View file

@ -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;