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

KWin

unmanaged.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 "unmanaged.h"
00022 
00023 #include "workspace.h"
00024 #include "effects.h"
00025 #include "deleted.h"
00026 
00027 #include <X11/extensions/shape.h>
00028 
00029 namespace KWin
00030 {
00031 
00032 Unmanaged::Unmanaged( Workspace* ws )
00033     : Toplevel( ws )
00034     {
00035     }
00036     
00037 Unmanaged::~Unmanaged()
00038     {
00039     }
00040 
00041 bool Unmanaged::track( Window w )
00042     {
00043     XWindowAttributes attr;
00044     grabXServer();
00045     if( !XGetWindowAttributes(display(), w, &attr) || attr.map_state != IsViewable )
00046         {
00047         ungrabXServer();
00048         return false;
00049         }
00050     if( attr.c_class == InputOnly )
00051         {
00052         ungrabXServer();
00053         return false;
00054         }
00055     setWindowHandles( w, w ); // the window is also the frame
00056     XSelectInput( display(), w, attr.your_event_mask | StructureNotifyMask | PropertyChangeMask);
00057     geom = QRect( attr.x, attr.y, attr.width, attr.height );
00058     vis = attr.visual;
00059     bit_depth = attr.depth;
00060     unsigned long properties[ 2 ];
00061     properties[ NETWinInfo::PROTOCOLS ] =
00062         NET::WMWindowType |
00063         NET::WMPid |
00064         0;
00065     properties[ NETWinInfo::PROTOCOLS2 ] =
00066         NET::WM2Opacity |
00067         0;
00068     info = new NETWinInfo( display(), w, rootWindow(), properties, 2 );
00069     getResourceClass();
00070     getWindowRole();
00071     getWmClientLeader();
00072     getWmClientMachine();
00073     if( Extensions::shapeAvailable())
00074         XShapeSelectInput( display(), w, ShapeNotifyMask );
00075     detectShape( w );
00076     setupCompositing();
00077     ungrabXServer();
00078     if( effects )
00079         static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowStacking();
00080     return true;
00081     }
00082 
00083 void Unmanaged::release()
00084     {
00085     Deleted* del = Deleted::create( this );
00086     if( effects )
00087         {
00088         static_cast<EffectsHandlerImpl*>(effects)->windowClosed( effectWindow());
00089         scene->windowClosed( this, del );
00090         }
00091     finishCompositing();
00092     workspace()->removeUnmanaged( this, Allowed );
00093     if( !QWidget::find( window())) // don't affect our own windows
00094         {
00095         if( Extensions::shapeAvailable())
00096             XShapeSelectInput( display(), window(), NoEventMask );
00097         XSelectInput( display(), window(), NoEventMask );
00098         }
00099     addWorkspaceRepaint( geometry());
00100     disownDataPassedToDeleted();
00101     del->unrefWindow();
00102     deleteUnmanaged( this, Allowed );
00103     }
00104 
00105 void Unmanaged::deleteUnmanaged( Unmanaged* c, allowed_t )
00106     {
00107     delete c;
00108     }
00109 
00110 int Unmanaged::desktop() const
00111     {
00112     return NET::OnAllDesktops; // TODO for some window types should be the current desktop?
00113     }
00114 
00115 QPoint Unmanaged::clientPos() const
00116     {
00117     return QPoint( 0, 0 ); // unmanaged windows don't have decorations
00118     }
00119 
00120 QSize Unmanaged::clientSize() const
00121     {
00122     return size();
00123     }
00124 
00125 void Unmanaged::debug( kdbgstream& stream ) const
00126     {
00127     stream << "\'ID:" << window() << "\'";
00128     }
00129 
00130 } // namespace
00131 
00132 #include "unmanaged.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