Build the list of windows to present when activating the effect

and don't change this list later (I suppose newly turned up
windows would just disturb anyway). This will later also allow
filtering of the presented windows.


svn path=/branches/work/kwin_composite/; revision=654201
This commit is contained in:
Luboš Luňák 2007-04-15 12:38:09 +00:00
parent 6baede1a4f
commit b65e6affd9
2 changed files with 41 additions and 34 deletions

View file

@ -80,25 +80,29 @@ void PresentWindowsEffect::prePaintScreen( int* mask, QRegion* region, int time
void PresentWindowsEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* paint, QRegion* clip, int time )
{
if( mActiveness > 0.0f && mWindowData.contains(w) )
if( mActiveness > 0.0f )
{
// This window will be transformed by the effect
*mask |= Effect::PAINT_WINDOW_TRANSFORMED;
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE );
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
// If it's minimized window or on another desktop and effect is not
// fully active, then apply some transparency
if( mActiveness < 1.0f && (w->isMinimized() || !w->isOnCurrentDesktop() ))
*mask |= Effect::PAINT_WINDOW_TRANSLUCENT;
// Change window's hover according to cursor pos
WindowData& windata = mWindowData[w];
const float hoverchangetime = 200;
if( windata.area.contains(cursorPos()) )
windata.hover = qMin(1.0f, windata.hover + time / hoverchangetime);
if( mWindowData.contains(w) )
{
// This window will be transformed by the effect
*mask |= Effect::PAINT_WINDOW_TRANSFORMED;
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_MINIMIZE );
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
// If it's minimized window or on another desktop and effect is not
// fully active, then apply some transparency
if( mActiveness < 1.0f && (w->isMinimized() || !w->isOnCurrentDesktop() ))
*mask |= Effect::PAINT_WINDOW_TRANSLUCENT;
// Change window's hover according to cursor pos
WindowData& windata = mWindowData[w];
const float hoverchangetime = 200;
if( windata.area.contains(cursorPos()) )
windata.hover = qMin(1.0f, windata.hover + time / hoverchangetime);
else
windata.hover = qMax(0.0f, windata.hover - time / hoverchangetime);
}
else
windata.hover = qMax(0.0f, windata.hover - time / hoverchangetime);
w->disablePainting( EffectWindow::PAINT_DISABLED );
}
effects->prePaintWindow( w, mask, paint, clip, time );
}
@ -187,15 +191,11 @@ void PresentWindowsEffect::windowInputMouseEvent( Window w, QEvent* e )
setActive(false);
}
void PresentWindowsEffect::windowActivated( EffectWindow* )
{
rearrangeWindows();
}
void PresentWindowsEffect::windowClosed( EffectWindow* w )
{
if( mHoverWindow == w )
mHoverWindow = NULL;
mWindowsToPresent.remove( w );
rearrangeWindows();
}
@ -205,6 +205,24 @@ void PresentWindowsEffect::setActive(bool active)
return;
mActivated = active;
mHoverWindow = NULL;
if( mActivated )
{
mWindowsToPresent.clear();
const EffectWindowList& originalwindowlist = effects->stackingOrder();
// Filter out special windows such as panels and taskbars
foreach( EffectWindow* window, originalwindowlist )
{
if( window->isSpecialWindow() )
continue;
if( window->isDeleted())
continue;
if( !mShowWindowsFromAllDesktops && !window->isOnCurrentDesktop() )
continue;
mWindowsToPresent.append(window);
}
}
else
mWindowsToPresent.clear();
rearrangeWindows();
if( mActivated && mActiveness == 0.0f )
effectActivated();
@ -231,18 +249,7 @@ void PresentWindowsEffect::rearrangeWindows()
mWindowData.clear();
const EffectWindowList& originalwindowlist = effects->stackingOrder();
// Filter out special windows such as panels and taskbars
EffectWindowList windowlist;
foreach( EffectWindow* window, originalwindowlist )
{
if( window->isSpecialWindow() )
continue;
if( !mShowWindowsFromAllDesktops && !window->isOnCurrentDesktop() )
continue;
windowlist.append(window);
}
EffectWindowList windowlist = mWindowsToPresent;
// Calculate new positions and scales for windows
// calculateWindowTransformationsDumb( windowlist );
// calculateWindowTransformationsKompose( windowlist );

View file

@ -36,7 +36,6 @@ class PresentWindowsEffect
virtual void postPaintScreen();
virtual void windowClosed( EffectWindow* c );
virtual void windowActivated( EffectWindow* c );
virtual void windowInputMouseEvent( Window w, QEvent* e );
virtual bool borderActivated( ElectricBorder border );
@ -75,6 +74,7 @@ class PresentWindowsEffect
Window mInput;
EffectWindowList mWindowsToPresent;
struct WindowData
{
QRect area;