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"
30 Deleted::Deleted( Workspace
* ws
)
32 , delete_refcount( 1 )
38 assert( delete_refcount
== 0 );
39 workspace()->removeDeleted( this, Allowed
);
43 Deleted
* Deleted::create( Toplevel
* c
)
45 Deleted
* d
= new Deleted( c
->workspace());
46 d
->copyToDeleted( c
);
47 d
->workspace()->addDeleted( d
, Allowed
);
51 // to be used only from Workspace::finishCompositing()
52 void Deleted::discard( allowed_t
)
58 void Deleted::copyToDeleted( Toplevel
* c
)
60 assert( dynamic_cast< Deleted
* >( c
) == NULL
);
61 Toplevel::copyToDeleted( c
);
63 contentsRect
= QRect( c
->clientPos(), c
->clientSize());
64 if( WinInfo
* cinfo
= dynamic_cast< WinInfo
* >( info
))
68 void Deleted::unrefWindow( bool delay
)
70 if( --delete_refcount
> 0 )
72 // needs to be delayed when calling from effects, otherwise it'd be rather
73 // complicated to handle the case of the window going away during a painting pass
80 int Deleted::desktop() const
85 QPoint
Deleted::clientPos() const
87 return contentsRect
.topLeft();
90 QSize
Deleted::clientSize() const
92 return contentsRect
.size();
95 void Deleted::debug( kdbgstream
& stream
) const
97 stream
<< "\'ID:" << window() << "\' (deleted)";
102 #include "deleted.moc"