system tray support

svn path=/trunk/kdebase/kwin/; revision=54677
This commit is contained in:
Matthias Ettrich 2000-06-28 07:51:45 +00:00
parent 7ae8ea2bf9
commit 10658d11e0
2 changed files with 47 additions and 47 deletions

View file

@ -286,7 +286,7 @@ void Workspace::init()
NET::WMIconGeometry | NET::WMIconGeometry |
NET::WMIcon | NET::WMIcon |
NET::WMPid | NET::WMPid |
NET::WMKDEDockWinFor NET::WMKDESystemTrayWinFor
; ;
rootInfo = new RootInfo( this, qt_xdisplay(), supportWindow->winId(), "KWin", protocols, qt_xscreen() ); rootInfo = new RootInfo( this, qt_xdisplay(), supportWindow->winId(), "KWin", protocols, qt_xscreen() );
@ -315,7 +315,7 @@ 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] ) ) if ( addSystemTrayWin( wins[i] ) )
continue; continue;
Client* c = clientFactory( wins[i] ); Client* c = clientFactory( wins[i] );
if ( c != desktop_client ) { if ( c != desktop_client ) {
@ -403,8 +403,8 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( c ) if ( c )
return c->windowEvent( e ); return c->windowEvent( e );
// check for dock windows // check for system tray windows
if ( removeDockwin( e->xunmap.window ) ) if ( removeSystemTrayWin( e->xunmap.window ) )
return TRUE; return TRUE;
if ( e->xunmap.event == root ) { if ( e->xunmap.event == root ) {
@ -434,7 +434,7 @@ 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 ) ) if ( removeSystemTrayWin( e->xdestroywindow.window ) )
return TRUE; return TRUE;
return destroyClient( findClient( e->xdestroywindow.window ) ); return destroyClient( findClient( e->xdestroywindow.window ) );
case MapRequest: case MapRequest:
@ -442,7 +442,7 @@ bool Workspace::workspaceEvent( XEvent * e )
c = findClient( e->xmaprequest.window ); c = findClient( e->xmaprequest.window );
if ( !c ) { if ( !c ) {
if ( e->xmaprequest.parent == root ) { if ( e->xmaprequest.parent == root ) {
if ( addDockwin( e->xmaprequest.window ) ) if ( addSystemTrayWin( e->xmaprequest.window ) )
return TRUE; return TRUE;
c = clientFactory( e->xmaprequest.window ); c = clientFactory( e->xmaprequest.window );
if ( root != qt_xrootwin() ) { if ( root != qt_xrootwin() ) {
@ -1764,37 +1764,37 @@ void Workspace::propagateClients( bool onlyStacking )
/*! /*!
Check whether \a w is a dock window. If so, add it to the respective Check whether \a w is a system tray window. If so, add it to the respective
datastructures and propagate it to the world. datastructures and propagate it to the world.
*/ */
bool Workspace::addDockwin( WId w ) bool Workspace::addSystemTrayWin( WId w )
{ {
if ( dockwins.contains( w ) ) if ( systemTrayWins.contains( w ) )
return TRUE; return TRUE;
NETWinInfo ni( qt_xdisplay(), w, root, NET::WMKDEDockWinFor ); NETWinInfo ni( qt_xdisplay(), w, root, NET::WMKDESystemTrayWinFor );
WId dockFor = ni.kdeDockWinFor(); WId trayWinFor = ni.kdeSystemTrayWinFor();
if ( !dockFor ) if ( !trayWinFor )
return FALSE; return FALSE;
dockwins.append( DockWindow( w, dockFor ) ); systemTrayWins.append( SystemTrayWindow( w, trayWinFor ) );
XSelectInput( qt_xdisplay(), w, XSelectInput( qt_xdisplay(), w,
StructureNotifyMask StructureNotifyMask
); );
XAddToSaveSet( qt_xdisplay(), w ); XAddToSaveSet( qt_xdisplay(), w );
propagateDockwins(); propagateSystemTrayWins();
return TRUE; return TRUE;
} }
/*! /*!
Check whether \a w is a dock window. If so, remove it from the Check whether \a w is a system tray window. If so, remove it from
respective datastructures and propagate this to the world. the respective datastructures and propagate this to the world.
*/ */
bool Workspace::removeDockwin( WId w ) bool Workspace::removeSystemTrayWin( WId w )
{ {
if ( !dockwins.contains( w ) ) if ( !systemTrayWins.contains( w ) )
return FALSE; return FALSE;
dockwins.remove( w ); systemTrayWins.remove( w );
propagateDockwins(); propagateSystemTrayWins();
return TRUE; return TRUE;
} }
@ -1806,25 +1806,25 @@ bool Workspace::removeDockwin( WId w )
*/ */
bool Workspace::iconifyMeansWithdraw( Client* c) bool Workspace::iconifyMeansWithdraw( Client* c)
{ {
for ( DockWindowList::ConstIterator it = dockwins.begin(); it != dockwins.end(); ++it ) { for ( SystemTrayWindowList::ConstIterator it = systemTrayWins.begin(); it != systemTrayWins.end(); ++it ) {
if ( (*it).dockFor == c->window() ) if ( (*it).winFor == c->window() )
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
/*! /*!
Propagates the dockwins to the world Propagates the systemTrayWins to the world
*/ */
void Workspace::propagateDockwins() void Workspace::propagateSystemTrayWins()
{ {
WId* cl = new WId[ dockwins.count()]; WId* cl = new WId[ systemTrayWins.count()];
int i = 0; int i = 0;
for ( DockWindowList::ConstIterator it = dockwins.begin(); it != dockwins.end(); ++it ) { for ( SystemTrayWindowList::ConstIterator it = systemTrayWins.begin(); it != systemTrayWins.end(); ++it ) {
cl[i++] = (*it).dockWin; cl[i++] = (*it).win;
} }
rootInfo->setKDEDockingWindows( (Window*) cl, i ); rootInfo->setKDESystemTrayWindows( (Window*) cl, i );
delete [] cl; delete [] cl;
} }

View file

@ -28,26 +28,26 @@ class RootInfo;
typedef QValueList<Client*> ClientList; typedef QValueList<Client*> ClientList;
class DockWindow class SystemTrayWindow
{ {
public: public:
DockWindow() SystemTrayWindow()
: dockWin(0),dockFor(0) : win(0),winFor(0)
{} {}
DockWindow( WId w ) SystemTrayWindow( WId w )
: dockWin(w),dockFor(0) : win(w),winFor(0)
{} {}
DockWindow( WId w, WId wf ) SystemTrayWindow( WId w, WId wf )
: dockWin(w),dockFor(wf) : win(w),winFor(wf)
{} {}
bool operator==( const DockWindow& other ) bool operator==( const SystemTrayWindow& other )
{ return dockWin == other.dockWin; } { return win == other.win; }
WId dockWin; WId win;
WId dockFor; WId winFor;
}; };
typedef QValueList<DockWindow> DockWindowList; typedef QValueList<SystemTrayWindow> SystemTrayWindowList;
struct SessionInfo struct SessionInfo
@ -174,7 +174,7 @@ public:
void cascadeDesktop(); void cascadeDesktop();
void unclutterDesktop(); void unclutterDesktop();
void reconfigure(); void reconfigure();
public slots: public slots:
void setCurrentDesktop( int new_desktop ); void setCurrentDesktop( int new_desktop );
@ -238,10 +238,10 @@ private:
void propagateClients( bool onlyStacking = FALSE); void propagateClients( bool onlyStacking = FALSE);
bool addDockwin( WId w ); bool addSystemTrayWin( WId w );
bool removeDockwin( WId w ); bool removeSystemTrayWin( WId w );
void propagateDockwins(); void propagateSystemTrayWins();
DockWindow findDockwin( WId w ); SystemTrayWindow findSystemTrayWin( WId w );
//CT needed for cascading+ //CT needed for cascading+
struct CascadingInfo { struct CascadingInfo {
@ -257,7 +257,7 @@ private:
// ------------------ // ------------------
DockWindowList dockwins; SystemTrayWindowList systemTrayWins;
int current_desktop; int current_desktop;
int number_of_desktops; int number_of_desktops;