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 "unmanaged.h"
23 #include "workspace.h"
27 #include <X11/extensions/shape.h>
32 Unmanaged::Unmanaged( Workspace
* ws
)
37 Unmanaged::~Unmanaged()
41 bool Unmanaged::track( Window w
)
43 XWindowAttributes attr
;
45 if( !XGetWindowAttributes(display(), w
, &attr
) || attr
.map_state
!= IsViewable
)
50 if( attr
.c_class
== InputOnly
)
55 setWindowHandles( w
, w
); // the window is also the frame
56 XSelectInput( display(), w
, attr
.your_event_mask
| StructureNotifyMask
| PropertyChangeMask
);
57 geom
= QRect( attr
.x
, attr
.y
, attr
.width
, attr
.height
);
59 bit_depth
= attr
.depth
;
60 unsigned long properties
[ 2 ];
61 properties
[ NETWinInfo::PROTOCOLS
] =
65 properties
[ NETWinInfo::PROTOCOLS2
] =
68 info
= new NETWinInfo2( display(), w
, rootWindow(), properties
, 2 );
73 if( Extensions::shapeAvailable())
74 XShapeSelectInput( display(), w
, ShapeNotifyMask
);
79 static_cast<EffectsHandlerImpl
*>(effects
)->checkInputWindowStacking();
83 void Unmanaged::release()
85 Deleted
* del
= Deleted::create( this );
88 static_cast<EffectsHandlerImpl
*>(effects
)->windowClosed( effectWindow());
89 scene
->windowClosed( this, del
);
92 workspace()->removeUnmanaged( this, Allowed
);
93 if( !QWidget::find( window())) // don't affect our own windows
95 if( Extensions::shapeAvailable())
96 XShapeSelectInput( display(), window(), NoEventMask
);
97 XSelectInput( display(), window(), NoEventMask
);
99 addWorkspaceRepaint( geometry());
100 disownDataPassedToDeleted();
102 deleteUnmanaged( this, Allowed
);
105 void Unmanaged::deleteUnmanaged( Unmanaged
* c
, allowed_t
)
110 int Unmanaged::desktop() const
112 return NET::OnAllDesktops
; // TODO for some window types should be the current desktop?
115 QPoint
Unmanaged::clientPos() const
117 return QPoint( 0, 0 ); // unmanaged windows don't have decorations
120 QSize
Unmanaged::clientSize() const
125 void Unmanaged::debug( kdbgstream
& stream
) const
127 stream
<< "\'ID:" << window() << "\'";
132 #include "unmanaged.moc"