support for docking windows
svn path=/trunk/kdebase/kwin/; revision=33482
This commit is contained in:
parent
fc3407aa16
commit
35c7b77082
4 changed files with 62 additions and 4 deletions
|
@ -12,11 +12,12 @@ Atoms::Atoms()
|
||||||
// compatibility
|
// compatibility
|
||||||
kwm_win_icon = XInternAtom(qt_xdisplay(), "KWM_WIN_ICON", FALSE);
|
kwm_win_icon = XInternAtom(qt_xdisplay(), "KWM_WIN_ICON", FALSE);
|
||||||
|
|
||||||
|
|
||||||
net_number_of_desktops = XInternAtom(qt_xdisplay(), "_NET_NUMBER_OF_DESKTOPS", False);
|
net_number_of_desktops = XInternAtom(qt_xdisplay(), "_NET_NUMBER_OF_DESKTOPS", False);
|
||||||
net_current_desktop = XInternAtom(qt_xdisplay(), "_NET_CURRENT_DESKTOP", False);
|
net_current_desktop = XInternAtom(qt_xdisplay(), "_NET_CURRENT_DESKTOP", False);
|
||||||
net_active_window = XInternAtom(qt_xdisplay(), "_NET_ACTIVE_WINDOW", False);
|
net_active_window = XInternAtom(qt_xdisplay(), "_NET_ACTIVE_WINDOW", False);
|
||||||
|
|
||||||
net_client_list = XInternAtom(qt_xdisplay(), "_NET_CLIENT_LIST", False);
|
net_client_list = XInternAtom(qt_xdisplay(), "_NET_CLIENT_LIST", False);
|
||||||
net_client_list_stacking = XInternAtom(qt_xdisplay(), "_NET_CLIENT_LIST_STACKIN", 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);
|
||||||
}
|
}
|
||||||
|
|
5
atoms.h
5
atoms.h
|
@ -10,13 +10,14 @@ public:
|
||||||
Atom wm_delete_window;
|
Atom wm_delete_window;
|
||||||
Atom wm_take_focus;
|
Atom wm_take_focus;
|
||||||
Atom kwm_win_icon; // compatibility
|
Atom kwm_win_icon; // compatibility
|
||||||
|
|
||||||
Atom net_number_of_desktops;
|
Atom net_number_of_desktops;
|
||||||
Atom net_current_desktop;
|
Atom net_current_desktop;
|
||||||
Atom net_active_window;
|
Atom net_active_window;
|
||||||
Atom net_client_list;
|
Atom net_client_list;
|
||||||
Atom net_client_list_stacking;
|
Atom net_client_list_stacking;
|
||||||
|
|
||||||
|
Atom net_kde_docking_windows;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,8 @@ void Workspace::init()
|
||||||
if (attr.override_redirect )
|
if (attr.override_redirect )
|
||||||
continue;
|
continue;
|
||||||
if (attr.map_state != IsUnmapped) {
|
if (attr.map_state != IsUnmapped) {
|
||||||
|
if ( addDockwin( wins[i] ) )
|
||||||
|
continue;
|
||||||
Client* c = clientFactory( this, wins[i] );
|
Client* c = clientFactory( this, wins[i] );
|
||||||
if ( c != desktop_client ) {
|
if ( c != desktop_client ) {
|
||||||
clients.append( c );
|
clients.append( c );
|
||||||
|
@ -172,6 +174,10 @@ bool Workspace::workspaceEvent( XEvent * e )
|
||||||
|
|
||||||
if ( c )
|
if ( c )
|
||||||
return c->windowEvent( e );
|
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
|
if ( e->xunmap.event != e->xunmap.window ) // hide wm typical event from Qt
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -183,11 +189,15 @@ bool Workspace::workspaceEvent( XEvent * e )
|
||||||
//window manager who does the reparenting.
|
//window manager who does the reparenting.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
|
if ( removeDockwin( e->xdestroywindow.window ) )
|
||||||
|
return TRUE;
|
||||||
return destroyClient( findClient( e->xdestroywindow.window ) );
|
return destroyClient( findClient( e->xdestroywindow.window ) );
|
||||||
case MapRequest:
|
case MapRequest:
|
||||||
if ( e->xmaprequest.parent == root ) {
|
if ( e->xmaprequest.parent == root ) {
|
||||||
c = findClient( e->xmaprequest.window );
|
c = findClient( e->xmaprequest.window );
|
||||||
if ( !c ) {
|
if ( !c ) {
|
||||||
|
if ( addDockwin( e->xmaprequest.window ) )
|
||||||
|
return TRUE;
|
||||||
c = clientFactory( this, e->xmaprequest.window );
|
c = clientFactory( this, e->xmaprequest.window );
|
||||||
if ( root != qt_xrootwin() ) {
|
if ( root != qt_xrootwin() ) {
|
||||||
// TODO may use QWidget:.create
|
// TODO may use QWidget:.create
|
||||||
|
@ -974,7 +984,7 @@ void Workspace::propagateClients( bool onlyStacking )
|
||||||
WId* cl;
|
WId* cl;
|
||||||
int i;
|
int i;
|
||||||
if ( !onlyStacking ) {
|
if ( !onlyStacking ) {
|
||||||
WId* cl = new WId[ clients.count()];
|
cl = new WId[ clients.count()];
|
||||||
i = 0;
|
i = 0;
|
||||||
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it ) {
|
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it ) {
|
||||||
cl[i++] = (*it)->window();
|
cl[i++] = (*it)->window();
|
||||||
|
@ -995,3 +1005,43 @@ void Workspace::propagateClients( bool onlyStacking )
|
||||||
PropModeReplace, (unsigned char *)cl, stacking_order.count());
|
PropModeReplace, (unsigned char *)cl, stacking_order.count());
|
||||||
delete [] cl;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ class TabBox;
|
||||||
class KGlobalAccel;
|
class KGlobalAccel;
|
||||||
|
|
||||||
typedef QValueList<Client*> ClientList;
|
typedef QValueList<Client*> ClientList;
|
||||||
|
typedef QValueList<WId> WIdList;
|
||||||
|
|
||||||
class Workspace : public QObject
|
class Workspace : public QObject
|
||||||
{
|
{
|
||||||
|
@ -104,6 +105,11 @@ private:
|
||||||
void setDecoration( int deco );
|
void setDecoration( int deco );
|
||||||
|
|
||||||
void propagateClients( bool onlyStacking = FALSE);
|
void propagateClients( bool onlyStacking = FALSE);
|
||||||
|
|
||||||
|
WIdList dockwins;
|
||||||
|
bool addDockwin( WId w );
|
||||||
|
bool removeDockwin( WId w );
|
||||||
|
void propagateDockwins();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline WId Workspace::rootWin() const
|
inline WId Workspace::rootWin() const
|
||||||
|
|
Loading…
Reference in a new issue