1/********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*********************************************************************/
20
21#ifndef KWIN_DELETED_H
22#define KWIN_DELETED_H
23
24#include "toplevel.h"
25
26namespace KWin
27{
28class PaintRedirector;
29
30class Deleted
31 : public Toplevel
32{
33 Q_OBJECT
34 Q_PROPERTY(bool minimized READ isMinimized)
35 Q_PROPERTY(bool modal READ isModal)
36public:
37 static Deleted* create(Toplevel* c);
38 // used by effects to keep the window around for e.g. fadeout effects when it's destroyed
39 void refWindow();
40 void unrefWindow();
41 void discard();
42 virtual int desktop() const;
43 virtual QStringList activities() const;
44 virtual QPoint clientPos() const;
45 virtual QSize clientSize() const;
46 virtual QRect transparentRect() const;
47 virtual bool isDeleted() const;
48 bool noBorder() const {
49 return no_border;
50 }
51 void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom, int unused = 0) const;
52 QRect decorationRect() const;
53 virtual Layer layer() const {
54 return m_layer;
55 }
56 bool isMinimized() const {
57 return m_minimized;
58 }
59 bool isModal() const {
60 return m_modal;
61 }
62 ClientList mainClients() const {
63 return m_mainClients;
64 }
65 NET::WindowType windowType(bool direct = false, int supported_types = 0) const;
66 PaintRedirector *decorationPaintRedirector() {
67 return m_paintRedirector;
68 }
69 bool wasClient() const {
70 return m_wasClient;
71 }
72protected:
73 virtual void debug(QDebug& stream) const;
74 virtual bool shouldUnredirect() const;
75private Q_SLOTS:
76 void mainClientClosed(KWin::Toplevel *client);
77private:
78 Deleted(); // use create()
79 void copyToDeleted(Toplevel* c);
80 virtual ~Deleted(); // deleted only using unrefWindow()
81 int delete_refcount;
82 double window_opacity;
83 int desk;
84 QStringList activityList;
85 QRect contentsRect; // for clientPos()/clientSize()
86 QRect transparent_rect;
87
88 bool no_border;
89 QRect decoration_left;
90 QRect decoration_right;
91 QRect decoration_top;
92 QRect decoration_bottom;
93 int padding_left, padding_top, padding_right, padding_bottom;
94 Layer m_layer;
95 bool m_minimized;
96 bool m_modal;
97 ClientList m_mainClients;
98 PaintRedirector *m_paintRedirector;
99 bool m_wasClient;
100};
101
102inline void Deleted::refWindow()
103{
104 ++delete_refcount;
105}
106
107} // namespace
108
109#endif
110