Adding the missing pieces for a nice and fast letterbox resizing as a replacement for the drawbound resizing.
Perhaps we should not display the totally ugly drawbound when we have an active resize effect. CCBUG: 208770 CCBUG: 152638 svn path=/trunk/KDE/kdebase/workspace/; revision=1042711
This commit is contained in:
parent
60a152eca9
commit
77f0f0eaca
7 changed files with 31 additions and 3 deletions
|
@ -208,6 +208,12 @@ void EffectsHandlerImpl::windowUserMovedResized( EffectWindow* c, bool first, bo
|
|||
ep.second->windowUserMovedResized( c, first, last );
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::windowMoveResizeGeometryUpdate( EffectWindow* c, const QRect& geometry )
|
||||
{
|
||||
foreach( const EffectPair &ep, loaded_effects )
|
||||
ep.second->windowMoveResizeGeometryUpdate( c, geometry );
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::windowOpacityChanged( EffectWindow* c, double old_opacity )
|
||||
{
|
||||
if (!c)
|
||||
|
|
|
@ -139,6 +139,7 @@ class EffectsHandlerImpl : public EffectsHandler
|
|||
// internal (used by kwin core or compositing code)
|
||||
void startPaint();
|
||||
void windowUserMovedResized( EffectWindow* c, bool first, bool last );
|
||||
void windowMoveResizeGeometryUpdate( EffectWindow* c, const QRect& geometry );
|
||||
void windowOpacityChanged( EffectWindow* c, double old_opacity );
|
||||
void windowAdded( EffectWindow* c );
|
||||
void windowClosed( EffectWindow* c );
|
||||
|
|
|
@ -60,8 +60,8 @@ void ResizeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Windo
|
|||
effects->paintWindow( w, mask, region, data );
|
||||
if( m_active && w == m_resizeWindow )
|
||||
{
|
||||
QRegion intersection = m_originalWindowRect.intersected( w->geometry() );
|
||||
QRegion paintRegion = m_originalWindowRect.united( w->geometry() ).subtracted( intersection );
|
||||
QRegion intersection = m_originalWindowRect.intersected( m_currentGeometry );
|
||||
QRegion paintRegion = m_originalWindowRect.united( m_currentGeometry ).subtracted( intersection );
|
||||
float alpha = 0.8f;
|
||||
QColor color = KColorScheme( QPalette::Normal, KColorScheme::Selection ).background().color();
|
||||
|
||||
|
@ -113,6 +113,7 @@ void ResizeEffect::windowUserMovedResized( EffectWindow* w, bool first, bool las
|
|||
m_active = true;
|
||||
m_resizeWindow = w;
|
||||
m_originalWindowRect = w->geometry();
|
||||
m_currentGeometry = w->geometry();
|
||||
w->addRepaintFull();
|
||||
}
|
||||
if( m_active && w == m_resizeWindow && last )
|
||||
|
@ -123,4 +124,13 @@ void ResizeEffect::windowUserMovedResized( EffectWindow* w, bool first, bool las
|
|||
}
|
||||
}
|
||||
|
||||
void ResizeEffect::windowMoveResizeGeometryUpdate( EffectWindow* c, const QRect& geometry )
|
||||
{
|
||||
if( m_active && c == m_resizeWindow )
|
||||
{
|
||||
m_currentGeometry = geometry;
|
||||
effects->addRepaintFull();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -35,11 +35,13 @@ class ResizeEffect
|
|||
virtual void prePaintScreen( ScreenPrePaintData& data, int time );
|
||||
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
||||
virtual void windowUserMovedResized( EffectWindow *w, bool first, bool last );
|
||||
virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
|
||||
|
||||
private:
|
||||
bool m_active;
|
||||
EffectWindow* m_resizeWindow;
|
||||
QRegion m_originalWindowRect;
|
||||
QRect m_currentGeometry;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3209,7 +3209,10 @@ void Client::performMoveResize()
|
|||
drawbound( moveResizeGeom ); // they overlap; the paint event will come after this,
|
||||
} // so the geometry tip will be painted above the outline
|
||||
if( effects )
|
||||
{
|
||||
static_cast<EffectsHandlerImpl*>(effects)->windowMoveResizeGeometryUpdate( effectWindow(), moveResizeGeom );
|
||||
static_cast<EffectsHandlerImpl*>(effects)->windowUserMovedResized( effectWindow(), false, false );
|
||||
}
|
||||
}
|
||||
|
||||
void Client::syncTimeout()
|
||||
|
|
|
@ -123,6 +123,10 @@ void Effect::windowUserMovedResized( EffectWindow* , bool, bool )
|
|||
{
|
||||
}
|
||||
|
||||
void Effect::windowMoveResizeGeometryUpdate( EffectWindow* , const QRect& )
|
||||
{
|
||||
}
|
||||
|
||||
void Effect::windowOpacityChanged( EffectWindow*, double )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ X-KDE-Library=kwin4_effect_cooleffect
|
|||
|
||||
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
|
||||
#define KWIN_EFFECT_API_VERSION_MAJOR 0
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 105
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 106
|
||||
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
|
||||
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
|
||||
|
||||
|
@ -384,6 +384,8 @@ class KWIN_EXPORT Effect
|
|||
|
||||
/** called when moved/resized or once after it's finished */
|
||||
virtual void windowUserMovedResized( EffectWindow* c, bool first, bool last );
|
||||
/** called when the geometry changed during moving/resizing. */
|
||||
virtual void windowMoveResizeGeometryUpdate( EffectWindow* c, const QRect& geometry );
|
||||
virtual void windowOpacityChanged( EffectWindow* c, double old_opacity );
|
||||
virtual void windowAdded( EffectWindow* c );
|
||||
virtual void windowClosed( EffectWindow* c );
|
||||
|
|
Loading…
Reference in a new issue