Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kwin / scene_basic.cpp
blob32ba2d6f32e80cd0a4a1e57620b643f982f8fd41
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
22 This is very simple compositing code using only plain X. It doesn't use any effects
23 or anything like that, it merely draws everything as it would be visible without
24 compositing. It was the first compositing code in KWin and is usable only for testing
25 and as the very simple "this is how it works".
28 #include "scene_basic.h"
30 #include "utils.h"
31 #include "client.h"
33 namespace KWin
36 SceneBasic::SceneBasic( Workspace* ws )
37 : Scene( ws )
41 SceneBasic::~SceneBasic()
45 void SceneBasic::paint( QRegion, ToplevelList windows )
47 Pixmap composite_pixmap = XCreatePixmap( display(), rootWindow(), displayWidth(), displayHeight(), DefaultDepth( display(), DefaultScreen( display())));
48 XGCValues val;
49 val.foreground = WhitePixel( display(), DefaultScreen( display()));
50 val.subwindow_mode = IncludeInferiors;
51 GC gc = XCreateGC( display(), composite_pixmap, GCForeground | GCSubwindowMode, &val );
52 XFillRectangle( display(), composite_pixmap, gc, 0, 0, displayWidth(), displayHeight());
53 for( ToplevelList::ConstIterator it = windows.begin();
54 it != windows.end();
55 ++it )
57 QRect r = (*it)->geometry().intersected( QRect( 0, 0, displayWidth(), displayHeight()));
58 if( !r.isEmpty())
60 Pixmap pix = (*it)->windowPixmap();
61 if( pix == None )
62 continue;
63 XCopyArea( display(), pix, composite_pixmap, gc,
64 qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y());
67 XCopyArea( display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0 );
68 XFreeGC( display(), gc );
69 XFreePixmap( display(), composite_pixmap );
70 XFlush( display());
73 bool SceneBasic::initFailed() const
75 return false;
78 // These functions are not used at all, SceneBasic
79 // is not using inherited functionality.
81 void SceneBasic::paintBackground( QRegion )
85 void SceneBasic::windowGeometryShapeChanged( Toplevel* )
89 void SceneBasic::windowOpacityChanged( Toplevel* )
93 void SceneBasic::windowAdded( Toplevel* )
97 void SceneBasic::windowClosed( Toplevel*, Deleted* )
101 void SceneBasic::windowDeleted( Deleted* )
105 } // namespace