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"
36
SceneBasic::SceneBasic(Workspace* ws)
41
SceneBasic::~SceneBasic()
45
void SceneBasic::paint(QRegion, ToplevelList windows)
47
QTime t = QTime::currentTime();
48
Pixmap composite_pixmap = XCreatePixmap(display(), rootWindow(), displayWidth(), displayHeight(), DefaultDepth(display(), DefaultScreen(display())));
50
val.foreground = WhitePixel(display(), DefaultScreen(display()));
51
val.subwindow_mode = IncludeInferiors;
52
GC gc = XCreateGC(display(), composite_pixmap, GCForeground | GCSubwindowMode, &val);
53
XFillRectangle(display(), composite_pixmap, gc, 0, 0, displayWidth(), displayHeight());
54
for (ToplevelList::ConstIterator it = windows.constBegin();
55
it != windows.constEnd();
57
QRect r = (*it)->geometry().intersected(QRect(0, 0, displayWidth(), displayHeight()));
59
Pixmap pix = (*it)->windowPixmap();
62
XCopyArea(display(), pix, composite_pixmap, gc,
63
qMax(0, -(*it)->x()), qMax(0, -(*it)->y()), r.width(), r.height(), r.x(), r.y());
66
lastRenderTime = t.elapsed();
67
XCopyArea(display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0);
68
XFreeGC(display(), gc);
69
XFreePixmap(display(), composite_pixmap);
73
bool SceneBasic::initFailed() const
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*)