Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kwin / deleted.cpp
blobd92917b05d687fe6fbf4d22af27b3056de949e18
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 *********************************************************************/
21 #include "deleted.h"
23 #include "workspace.h"
24 #include "client.h"
25 #include "effects.h"
27 namespace KWin
30 Deleted::Deleted( Workspace* ws )
31 : Toplevel( ws )
32 , delete_refcount( 1 )
36 Deleted::~Deleted()
38 assert( delete_refcount == 0 );
39 workspace()->removeDeleted( this, Allowed );
40 delete effectWindow();
43 Deleted* Deleted::create( Toplevel* c )
45 Deleted* d = new Deleted( c->workspace());
46 d->copyToDeleted( c );
47 d->workspace()->addDeleted( d, Allowed );
48 return d;
51 void Deleted::copyToDeleted( Toplevel* c )
53 assert( dynamic_cast< Deleted* >( c ) == NULL );
54 Toplevel::copyToDeleted( c );
55 desk = c->desktop();
56 contentsRect = QRect( c->clientPos(), c->clientSize());
57 if( WinInfo* cinfo = dynamic_cast< WinInfo* >( info ))
58 cinfo->disable();
61 void Deleted::unrefWindow( bool delay )
63 if( --delete_refcount > 0 )
64 return;
65 // needs to be delayed when calling from effects, otherwise it'd be rather
66 // complicated to handle the case of the window going away during a painting pass
67 if( delay )
68 deleteLater();
69 else
70 delete this;
73 int Deleted::desktop() const
75 return desk;
78 QPoint Deleted::clientPos() const
80 return contentsRect.topLeft();
83 QSize Deleted::clientSize() const
85 return contentsRect.size();
88 void Deleted::debug( kdbgstream& stream ) const
90 stream << "\'ID:" << window() << "\' (deleted)";
93 } // namespace
95 #include "deleted.moc"