• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KWin

deleted.cpp

Go to the documentation of this file.
00001 /********************************************************************
00002  KWin - the KDE window manager
00003  This file is part of the KDE project.
00004 
00005 Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
00006 
00007 This program is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 *********************************************************************/
00020 
00021 #include "deleted.h"
00022 
00023 #include "workspace.h"
00024 #include "client.h"
00025 #include "effects.h"
00026 
00027 namespace KWin
00028 {
00029 
00030 Deleted::Deleted( Workspace* ws )
00031     : Toplevel( ws )
00032     , delete_refcount( 1 )
00033     {
00034     }
00035 
00036 Deleted::~Deleted()
00037     {
00038     assert( delete_refcount == 0 );
00039     workspace()->removeDeleted( this, Allowed );
00040     deleteEffectWindow();
00041     }
00042 
00043 Deleted* Deleted::create( Toplevel* c )
00044     {
00045     Deleted* d = new Deleted( c->workspace());
00046     d->copyToDeleted( c );
00047     d->workspace()->addDeleted( d, Allowed );
00048     return d;
00049     }
00050 
00051 // to be used only from Workspace::finishCompositing()
00052 void Deleted::discard( allowed_t )
00053     {
00054     delete_refcount = 0;
00055     delete this;
00056     }
00057 
00058 void Deleted::copyToDeleted( Toplevel* c )
00059     {
00060     assert( dynamic_cast< Deleted* >( c ) == NULL );
00061     Toplevel::copyToDeleted( c );
00062     desk = c->desktop();
00063     contentsRect = QRect( c->clientPos(), c->clientSize());
00064     if( WinInfo* cinfo = dynamic_cast< WinInfo* >( info ))
00065         cinfo->disable();
00066     }
00067 
00068 void Deleted::unrefWindow( bool delay )
00069     {
00070     if( --delete_refcount > 0 )
00071         return;
00072     // needs to be delayed when calling from effects, otherwise it'd be rather
00073     // complicated to handle the case of the window going away during a painting pass
00074     if( delay )
00075         deleteLater();
00076     else
00077         delete this;
00078     }
00079 
00080 int Deleted::desktop() const
00081     {
00082     return desk;
00083     }
00084 
00085 QPoint Deleted::clientPos() const
00086     {
00087     return contentsRect.topLeft();
00088     }
00089 
00090 QSize Deleted::clientSize() const
00091     {
00092     return contentsRect.size();
00093     }
00094 
00095 void Deleted::debug( kdbgstream& stream ) const
00096     {
00097     stream << "\'ID:" << window() << "\' (deleted)";
00098     }
00099 
00100 } // namespace
00101 
00102 #include "deleted.moc"

KWin

Skip menu "KWin"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal