support for docking windows

svn path=/trunk/kdebase/kwin/; revision=33482
This commit is contained in:
Matthias Ettrich 1999-11-11 01:22:41 +00:00
parent fc3407aa16
commit 35c7b77082
4 changed files with 62 additions and 4 deletions

View file

@ -19,4 +19,5 @@ Atoms::Atoms()
net_client_list = XInternAtom(qt_xdisplay(), "_NET_CLIENT_LIST", False);
net_client_list_stacking = XInternAtom(qt_xdisplay(), "_NET_CLIENT_LIST_STACKIN", False);
net_kde_docking_windows = XInternAtom(qt_xdisplay(), "_NET_KDE_DOCKING_WINDOWS", False);
}

View file

@ -17,6 +17,7 @@ public:
Atom net_client_list;
Atom net_client_list_stacking;
Atom net_kde_docking_windows;
};

View file

@ -111,6 +111,8 @@ void Workspace::init()
if (attr.override_redirect )
continue;
if (attr.map_state != IsUnmapped) {
if ( addDockwin( wins[i] ) )
continue;
Client* c = clientFactory( this, wins[i] );
if ( c != desktop_client ) {
clients.append( c );
@ -173,6 +175,10 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( c )
return c->windowEvent( e );
// check for dock windows
if ( removeDockwin( e->xunmap.window ) )
return TRUE;
if ( e->xunmap.event != e->xunmap.window ) // hide wm typical event from Qt
return TRUE;
case ReparentNotify:
@ -183,11 +189,15 @@ bool Workspace::workspaceEvent( XEvent * e )
//window manager who does the reparenting.
return TRUE;
case DestroyNotify:
if ( removeDockwin( e->xdestroywindow.window ) )
return TRUE;
return destroyClient( findClient( e->xdestroywindow.window ) );
case MapRequest:
if ( e->xmaprequest.parent == root ) {
c = findClient( e->xmaprequest.window );
if ( !c ) {
if ( addDockwin( e->xmaprequest.window ) )
return TRUE;
c = clientFactory( this, e->xmaprequest.window );
if ( root != qt_xrootwin() ) {
// TODO may use QWidget:.create
@ -974,7 +984,7 @@ void Workspace::propagateClients( bool onlyStacking )
WId* cl;
int i;
if ( !onlyStacking ) {
WId* cl = new WId[ clients.count()];
cl = new WId[ clients.count()];
i = 0;
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it ) {
cl[i++] = (*it)->window();
@ -995,3 +1005,43 @@ void Workspace::propagateClients( bool onlyStacking )
PropModeReplace, (unsigned char *)cl, stacking_order.count());
delete [] cl;
}
bool Workspace::addDockwin( WId w )
{
if ( !KWM::isDockWindow( w ) )
return FALSE;
dockwins.append( w );
XSelectInput( qt_xdisplay(), w,
// FocusChangeMask |
// PropertyChangeMask |
StructureNotifyMask
);
propagateDockwins();
return TRUE;
}
bool Workspace::removeDockwin( WId w )
{
if ( !dockwins.contains( w ) )
return FALSE;
dockwins.remove( w );
propagateDockwins();
return TRUE;
}
/*!
Propagates the dockwins to the world
*/
void Workspace::propagateDockwins()
{
WId* cl = new WId[ dockwins.count()];
int i = 0;
for ( WIdList::ConstIterator it = dockwins.begin(); it != dockwins.end(); ++it ) {
cl[i++] = (*it);
}
XChangeProperty(qt_xdisplay(), qt_xrootwin(),
atoms->net_kde_docking_windows, XA_WINDOW, 32,
PropModeReplace, (unsigned char *)cl, dockwins.count());
delete [] cl;
}

View file

@ -13,6 +13,7 @@ class TabBox;
class KGlobalAccel;
typedef QValueList<Client*> ClientList;
typedef QValueList<WId> WIdList;
class Workspace : public QObject
{
@ -104,6 +105,11 @@ private:
void setDecoration( int deco );
void propagateClients( bool onlyStacking = FALSE);
WIdList dockwins;
bool addDockwin( WId w );
bool removeDockwin( WId w );
void propagateDockwins();
};
inline WId Workspace::rootWin() const