2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
This is very simple compositing code using only plain X. It doesn't use any effects
|
|
|
|
or anything like that, it merely draws everything as it would be visible without
|
|
|
|
compositing. It was the first compositing code in KWin and is usable only for testing
|
|
|
|
and as the very simple "this is how it works".
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "scene_basic.h"
|
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
#include "client.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
SceneBasic::SceneBasic(Workspace* ws)
|
|
|
|
: Scene(ws)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
SceneBasic::~SceneBasic()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SceneBasic::paint(QRegion, ToplevelList windows)
|
|
|
|
{
|
2010-12-31 13:14:11 +00:00
|
|
|
QTime t = QTime::currentTime();
|
2011-01-30 14:34:42 +00:00
|
|
|
Pixmap composite_pixmap = XCreatePixmap(display(), rootWindow(), displayWidth(), displayHeight(), DefaultDepth(display(), DefaultScreen(display())));
|
2007-04-29 17:35:43 +00:00
|
|
|
XGCValues val;
|
2011-01-30 14:34:42 +00:00
|
|
|
val.foreground = WhitePixel(display(), DefaultScreen(display()));
|
2007-04-29 17:35:43 +00:00
|
|
|
val.subwindow_mode = IncludeInferiors;
|
2011-01-30 14:34:42 +00:00
|
|
|
GC gc = XCreateGC(display(), composite_pixmap, GCForeground | GCSubwindowMode, &val);
|
|
|
|
XFillRectangle(display(), composite_pixmap, gc, 0, 0, displayWidth(), displayHeight());
|
|
|
|
for (ToplevelList::ConstIterator it = windows.constBegin();
|
|
|
|
it != windows.constEnd();
|
|
|
|
++it) {
|
|
|
|
QRect r = (*it)->geometry().intersected(QRect(0, 0, displayWidth(), displayHeight()));
|
|
|
|
if (!r.isEmpty()) {
|
2007-04-29 17:35:43 +00:00
|
|
|
Pixmap pix = (*it)->windowPixmap();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (pix == None)
|
2007-04-29 17:35:43 +00:00
|
|
|
continue;
|
2011-01-30 14:34:42 +00:00
|
|
|
XCopyArea(display(), pix, composite_pixmap, gc,
|
|
|
|
qMax(0, -(*it)->x()), qMax(0, -(*it)->y()), r.width(), r.height(), r.x(), r.y());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
lastRenderTime = t.elapsed();
|
|
|
|
XCopyArea(display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0);
|
|
|
|
XFreeGC(display(), gc);
|
|
|
|
XFreePixmap(display(), composite_pixmap);
|
|
|
|
XFlush(display());
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-05-30 14:22:09 +00:00
|
|
|
bool SceneBasic::initFailed() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-05-30 14:22:09 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-05-30 14:22:09 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// These functions are not used at all, SceneBasic
|
|
|
|
// is not using inherited functionality.
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SceneBasic::paintBackground(QRegion)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SceneBasic::windowGeometryShapeChanged(Toplevel*)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SceneBasic::windowOpacityChanged(Toplevel*)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SceneBasic::windowAdded(Toplevel*)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SceneBasic::windowClosed(Toplevel*, Deleted*)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SceneBasic::windowDeleted(Deleted*)
|
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|