Add setTransformed() helper method

svn path=/trunk/KDE/kdebase/workspace/; revision=689913
This commit is contained in:
Rivo Laks 2007-07-19 14:05:59 +00:00
parent 96aba51960
commit 7273d0ddb5
12 changed files with 22 additions and 12 deletions

View file

@ -33,7 +33,7 @@ void ShakyMoveEffect::prePaintScreen( ScreenPrePaintData& data, int time )
void ShakyMoveEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) void ShakyMoveEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{ {
if( windows.contains( w )) if( windows.contains( w ))
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
effects->prePaintWindow( w, data, time ); effects->prePaintWindow( w, data, time );
} }

View file

@ -39,7 +39,7 @@ void WavyWindowsEffect::prePaintScreen( ScreenPrePaintData& data, int time )
void WavyWindowsEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) void WavyWindowsEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{ {
// This window will be transformed by the effect // This window will be transformed by the effect
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
// Check if OpenGL compositing is used // Check if OpenGL compositing is used
// Request the window to be divided into cells which are at most 30x30 // Request the window to be divided into cells which are at most 30x30
// pixels big // pixels big

View file

@ -87,7 +87,7 @@ void DesktopGridEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& dat
if( w->isOnAllDesktops()) if( w->isOnAllDesktops())
{ {
if( slide_painting_sticky ) if( slide_painting_sticky )
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
else else
w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
} }
@ -104,7 +104,7 @@ void DesktopGridEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& dat
w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
if( w == window_move ) if( w == window_move )
{ {
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
if( w->isOnAllDesktops() && painting_desktop != posToDesktop( window_move_pos - window_move_diff )) if( w->isOnAllDesktops() && painting_desktop != posToDesktop( window_move_pos - window_move_diff ))
w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
} }

View file

@ -30,7 +30,7 @@ void DrunkenEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, i
{ {
windows[ w ] += time / 1000.; windows[ w ] += time / 1000.;
if( windows[ w ] < 1 ) if( windows[ w ] < 1 )
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
else else
windows.remove( w ); windows.remove( w );
} }

View file

@ -122,7 +122,7 @@ void ExplosionEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data,
if( mWindows[ w ] < 1 ) if( mWindows[ w ] < 1 )
{ {
data.setTranslucent(); data.setTranslucent();
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE ); w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE );
} }
else else

View file

@ -32,7 +32,7 @@ void FallApartEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data,
if( windows[ w ] < 1 ) if( windows[ w ] < 1 )
{ {
windows[ w ] += time / 1000.; windows[ w ] += time / 1000.;
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE ); w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE );
// Request the window to be divided into cells // Request the window to be divided into cells
data.quads = data.quads.makeGrid( 40 ); data.quads = data.quads.makeGrid( 40 );

View file

@ -32,7 +32,7 @@ void FlameEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int
if( windows[ w ] < 1 ) if( windows[ w ] < 1 )
{ {
windows[ w ] += time / 500.; windows[ w ] += time / 500.;
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE ); w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE );
data.quads = data.quads.splitAtY( windows[ w ] * w->height()); data.quads = data.quads.splitAtY( windows[ w ] * w->height());
} }

View file

@ -55,7 +55,7 @@ void MinimizeAnimationEffect::prePaintWindow( EffectWindow* w, WindowPrePaintDat
if( mAnimationProgress.contains( w )) if( mAnimationProgress.contains( w ))
{ {
// We'll transform this window // We'll transform this window
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE ); w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE );
} }
else else

View file

@ -101,7 +101,7 @@ void PresentWindowsEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData&
if( mWindowData.contains(w) ) if( mWindowData.contains(w) )
{ {
// This window will be transformed by the effect // This window will be transformed by the effect
data.mask |= Effect::PAINT_WINDOW_TRANSFORMED; data.setTransformed();
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE ); w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE );
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
// If it's minimized window or on another desktop and effect is not // If it's minimized window or on another desktop and effect is not

View file

@ -28,7 +28,7 @@ void ScaleInEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, i
{ {
windows[ w ] += time / 500.; // complete change in 500ms windows[ w ] += time / 500.; // complete change in 500ms
if( windows[ w ] < 1 ) if( windows[ w ] < 1 )
data.mask |= PAINT_WINDOW_TRANSFORMED; data.setTransformed();
else else
windows.remove( w ); windows.remove( w );
} }

View file

@ -29,6 +29,12 @@ void WindowPrePaintData::setTranslucent()
clip = QRegion(); // cannot clip, will be transparent clip = QRegion(); // cannot clip, will be transparent
} }
void WindowPrePaintData::setTransformed()
{
mask |= Effect::PAINT_WINDOW_TRANSFORMED;
}
WindowPaintData::WindowPaintData() WindowPaintData::WindowPaintData()
: opacity( 1.0 ) : opacity( 1.0 )
, contents_opacity( 1.0 ) , contents_opacity( 1.0 )

View file

@ -434,10 +434,14 @@ class KWIN_EXPORT WindowPrePaintData
QRegion clip; QRegion clip;
WindowQuadList quads; WindowQuadList quads;
/** /**
* Simple helper than sets data to say the window will be painted as non-opaque. * Simple helper that sets data to say the window will be painted as non-opaque.
* Takes also care of changing the regions. * Takes also care of changing the regions.
*/ */
void setTranslucent(); void setTranslucent();
/**
* Helper to mark that this window will be transformed
**/
void setTransformed();
}; };
class KWIN_EXPORT WindowPaintData class KWIN_EXPORT WindowPaintData