Add a silly snowing-like effect to windows so that it's visible

there's something going on.


svn path=/branches/work/kwin_composite/; revision=558171
This commit is contained in:
Luboš Luňák 2006-07-04 20:05:52 +00:00
parent 571ba9cf9e
commit c2e60957d5

View file

@ -52,13 +52,34 @@ void Workspace::setDamaged()
void Workspace::compositeTimeout()
{
#define EFF
#ifdef EFF
const int SPD = 10;
static int cnt = 0;
int olds = cnt / SPD;
++cnt;
if( cnt == 8 * SPD )
cnt = 0;
int s = cnt / SPD;
if( !damaged && s == olds )
return;
#else
if( !damaged )
return;
#endif
XGCValues val;
val.foreground = WhitePixel( display(), DefaultScreen( display()));
val.subwindow_mode = IncludeInferiors;
GC gc = XCreateGC( display(), composite_pixmap, GCForeground | GCSubwindowMode, &val );
XFillRectangle( display(), composite_pixmap, gc, 0, 0, displayWidth(), displayHeight());
#ifdef EFF
val.fill_style = FillStippled;
char data[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x00 };
data[ s ] = 1 << s;
val.stipple = XCreateBitmapFromData( display(), rootWindow(), data, 8, 8 );
val.foreground = BlackPixel( display(), DefaultScreen( display()));
GC gc2 = XCreateGC( display(), composite_pixmap, GCForeground | GCSubwindowMode | GCFillStyle | GCStipple, &val );
#endif
for( ClientList::ConstIterator it = stackingOrder().begin();
it != stackingOrder().end();
++it )
@ -68,6 +89,9 @@ void Workspace::compositeTimeout()
{
XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc,
qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y());
#ifdef EFF
XFillRectangle( display(), composite_pixmap, gc2, r.x(), r.y(), r.width(), r.height());
#endif
}
}
for( UnmanagedList::ConstIterator it = unmanaged.begin();
@ -80,6 +104,10 @@ void Workspace::compositeTimeout()
qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y());
}
XCopyArea( display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0 );
#ifdef EFF
XFreePixmap( display(), val.stipple );
XFreeGC( display(), gc2 );
#endif
XFreeGC( display(), gc );
XFlush( display());
damaged = false;