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
*********************************************************************/
23
#include "workspace.h"
29
Deleted::Deleted(Workspace* ws)
42
if (delete_refcount != 0)
43
kError(1212) << "Deleted client has non-zero reference count (" << delete_refcount << ")";
44
assert(delete_refcount == 0);
45
workspace()->removeDeleted(this, Allowed);
49
Deleted* Deleted::create(Toplevel* c)
51
Deleted* d = new Deleted(c->workspace());
53
d->workspace()->addDeleted(d, Allowed);
57
// to be used only from Workspace::finishCompositing()
58
void Deleted::discard(allowed_t)
64
void Deleted::copyToDeleted(Toplevel* c)
66
assert(dynamic_cast< Deleted* >(c) == NULL);
67
Toplevel::copyToDeleted(c);
69
activityList = c->activities();
70
contentsRect = QRect(c->clientPos(), c->clientSize());
71
transparent_rect = c->transparentRect();
72
if (WinInfo* cinfo = dynamic_cast< WinInfo* >(info))
74
Client* client = dynamic_cast<Client*>(c);
76
no_border = client->noBorder();
77
padding_left = client->paddingLeft();
78
padding_right = client->paddingRight();
79
padding_bottom = client->paddingBottom();
80
padding_top = client->paddingTop();
82
client->layoutDecorationRects(decoration_left,
86
Client::WindowRelative);
87
decorationPixmapLeft = *client->leftDecoPixmap();
88
decorationPixmapRight = *client->rightDecoPixmap();
89
decorationPixmapTop = *client->topDecoPixmap();
90
decorationPixmapBottom = *client->bottomDecoPixmap();
95
void Deleted::unrefWindow(bool delay)
97
if (--delete_refcount > 0)
99
// needs to be delayed when calling from effects, otherwise it'd be rather
100
// complicated to handle the case of the window going away during a painting pass
107
int Deleted::desktop() const
112
QStringList Deleted::activities() const
117
QPoint Deleted::clientPos() const
119
return contentsRect.topLeft();
122
QSize Deleted::clientSize() const
124
return contentsRect.size();
127
void Deleted::debug(QDebug& stream) const
129
stream << "\'ID:" << window() << "\' (deleted)";
132
void Deleted::layoutDecorationRects(QRect& left, QRect& top, QRect& right, QRect& bottom) const
134
left = decoration_left;
135
top = decoration_top;
136
right = decoration_right;
137
bottom = decoration_bottom;
140
QRect Deleted::decorationRect() const
142
return rect().adjusted(-padding_left, -padding_top, padding_top, padding_bottom);
145
QRect Deleted::transparentRect() const
147
return transparent_rect;
152
#include "deleted.moc"