Dump support for the KDE systray mechanism. Hurray.
svn path=/trunk/KDE/kdebase/workspace/; revision=677076
This commit is contained in:
parent
88f73821c6
commit
27f67f3428
3 changed files with 0 additions and 137 deletions
27
events.cpp
27
events.cpp
|
@ -323,29 +323,6 @@ bool Workspace::workspaceEvent( XEvent * e )
|
|||
|
||||
case UnmapNotify:
|
||||
{
|
||||
// check for system tray windows
|
||||
if ( removeSystemTrayWin( e->xunmap.window, true ) )
|
||||
{
|
||||
// If the system tray gets destroyed, the system tray
|
||||
// icons automatically get unmapped, reparented and mapped
|
||||
// again to the closest non-client ancestor due to
|
||||
// QXEmbed's SaveSet feature. Unfortunately with kicker
|
||||
// this closest ancestor is not the root window, but our
|
||||
// decoration, so we reparent explicitly back to the root
|
||||
// window.
|
||||
XEvent ev;
|
||||
WId w = e->xunmap.window;
|
||||
if ( XCheckTypedWindowEvent (display(), w,
|
||||
ReparentNotify, &ev) )
|
||||
{
|
||||
if ( ev.xreparent.parent != root )
|
||||
{
|
||||
XReparentWindow( display(), w, root, 0, 0 );
|
||||
addSystemTrayWin( w );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return ( e->xunmap.event != e->xunmap.window ); // hide wm typical event from Qt
|
||||
}
|
||||
case ReparentNotify:
|
||||
|
@ -356,8 +333,6 @@ bool Workspace::workspaceEvent( XEvent * e )
|
|||
}
|
||||
case DestroyNotify:
|
||||
{
|
||||
if ( removeSystemTrayWin( e->xdestroywindow.window, false ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
case MapRequest:
|
||||
|
@ -377,8 +352,6 @@ bool Workspace::workspaceEvent( XEvent * e )
|
|||
// Note: Now the save-set support in Client::mapRequestEvent() actually requires that
|
||||
// this code doesn't check the parent to be root.
|
||||
// if ( e->xmaprequest.parent == root ) { //###TODO store previously destroyed client ids
|
||||
if ( addSystemTrayWin( e->xmaprequest.window ) )
|
||||
return true;
|
||||
c = createClient( e->xmaprequest.window, false );
|
||||
if ( c != NULL && root != rootWindow() )
|
||||
{ // TODO what is this?
|
||||
|
|
|
@ -243,7 +243,6 @@ void Workspace::init()
|
|||
NET::WorkArea |
|
||||
NET::CloseWindow |
|
||||
NET::DesktopNames |
|
||||
NET::KDESystemTrayWindows |
|
||||
NET::WMName |
|
||||
NET::WMVisibleName |
|
||||
NET::WMDesktop |
|
||||
|
@ -254,7 +253,6 @@ void Workspace::init()
|
|||
NET::WMIcon |
|
||||
NET::WMPid |
|
||||
NET::WMMoveResize |
|
||||
NET::WMKDESystemTrayWinFor |
|
||||
NET::WMFrameExtents |
|
||||
NET::WMPing
|
||||
,
|
||||
|
@ -385,8 +383,6 @@ void Workspace::init()
|
|||
continue;
|
||||
if (attr.map_state != IsUnmapped)
|
||||
{
|
||||
if ( addSystemTrayWin( wins[i] ) )
|
||||
continue;
|
||||
Client* c = createClient( wins[i], true );
|
||||
if ( c != NULL && root != rootWindow() )
|
||||
{ // TODO what is this?
|
||||
|
@ -1715,84 +1711,6 @@ void Workspace::calcDesktopLayout(int* xp, int* yp, Qt::Orientation* orientation
|
|||
*orientation = layoutOrientation;
|
||||
}
|
||||
|
||||
/*!
|
||||
Check whether \a w is a system tray window. If so, add it to the respective
|
||||
datastructures and propagate it to the world.
|
||||
*/
|
||||
bool Workspace::addSystemTrayWin( WId w )
|
||||
{
|
||||
if ( systemTrayWins.contains( w ) )
|
||||
return true;
|
||||
|
||||
NETWinInfo ni( display(), w, root, NET::WMKDESystemTrayWinFor );
|
||||
WId trayWinFor = ni.kdeSystemTrayWinFor();
|
||||
if ( !trayWinFor )
|
||||
return false;
|
||||
systemTrayWins.append( SystemTrayWindow( w, trayWinFor ) );
|
||||
XSelectInput( display(), w,
|
||||
StructureNotifyMask
|
||||
);
|
||||
XAddToSaveSet( display(), w );
|
||||
propagateSystemTrayWins();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Check whether \a w is a system tray window. If so, remove it from
|
||||
the respective datastructures and propagate this to the world.
|
||||
*/
|
||||
bool Workspace::removeSystemTrayWin( WId w, bool check )
|
||||
{
|
||||
if ( !systemTrayWins.contains( w ) )
|
||||
return false;
|
||||
if( check )
|
||||
{
|
||||
// When getting UnmapNotify, it's not clear if it's the systray
|
||||
// reparenting the window into itself, or if it's the window
|
||||
// going away. This is obviously a flaw in the design, and we were
|
||||
// just lucky it worked for so long. Kicker's systray temporarily
|
||||
// sets _KDE_SYSTEM_TRAY_EMBEDDING property on the window while
|
||||
// embedding it, allowing KWin to figure out. Kicker just mustn't
|
||||
// crash before removing it again ... *shrug* .
|
||||
int num_props;
|
||||
Atom* props = XListProperties( display(), w, &num_props );
|
||||
if( props != NULL )
|
||||
{
|
||||
for( int i = 0;
|
||||
i < num_props;
|
||||
++i )
|
||||
if( props[ i ] == atoms->kde_system_tray_embedding )
|
||||
{
|
||||
XFree( props );
|
||||
return false;
|
||||
}
|
||||
XFree( props );
|
||||
}
|
||||
}
|
||||
systemTrayWins.removeAll( w );
|
||||
propagateSystemTrayWins();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Propagates the systemTrayWins to the world
|
||||
*/
|
||||
void Workspace::propagateSystemTrayWins()
|
||||
{
|
||||
Window *cl = new Window[ systemTrayWins.count()];
|
||||
|
||||
int i = 0;
|
||||
for ( SystemTrayWindowList::ConstIterator it = systemTrayWins.begin(); it != systemTrayWins.end(); ++it )
|
||||
{
|
||||
cl[i++] = (*it).win;
|
||||
}
|
||||
|
||||
rootInfo->setKDESystemTrayWindows( cl, i );
|
||||
delete [] cl;
|
||||
}
|
||||
|
||||
|
||||
void Workspace::killWindowId( Window window_to_kill )
|
||||
{
|
||||
if( window_to_kill == None )
|
||||
|
|
28
workspace.h
28
workspace.h
|
@ -48,27 +48,6 @@ class Placement;
|
|||
class Rules;
|
||||
class WindowRules;
|
||||
|
||||
class SystemTrayWindow
|
||||
{
|
||||
public:
|
||||
SystemTrayWindow()
|
||||
: win(0),winFor(0)
|
||||
{}
|
||||
SystemTrayWindow( WId w )
|
||||
: win(w),winFor(0)
|
||||
{}
|
||||
SystemTrayWindow( WId w, WId wf )
|
||||
: win(w),winFor(wf)
|
||||
{}
|
||||
|
||||
bool operator==( const SystemTrayWindow& other )
|
||||
{ return win == other.win; }
|
||||
WId win;
|
||||
WId winFor;
|
||||
};
|
||||
|
||||
typedef QList<SystemTrayWindow> SystemTrayWindowList;
|
||||
|
||||
class Workspace : public QObject, public KDecorationDefines
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -542,11 +521,6 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
void smartPlacement(Client* c);
|
||||
void cascadePlacement(Client* c, bool re_init = false);
|
||||
|
||||
bool addSystemTrayWin( WId w );
|
||||
bool removeSystemTrayWin( WId w, bool check );
|
||||
void propagateSystemTrayWins();
|
||||
SystemTrayWindow findSystemTrayWin( WId w );
|
||||
|
||||
// desktop names and number of desktops
|
||||
void loadDesktopSettings();
|
||||
void saveDesktopSettings();
|
||||
|
@ -576,8 +550,6 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
void finishCompositing();
|
||||
bool windowRepaintsPending() const;
|
||||
|
||||
SystemTrayWindowList systemTrayWins;
|
||||
|
||||
int current_desktop;
|
||||
int number_of_desktops;
|
||||
QVector<int> desktop_focus_chain;
|
||||
|
|
Loading…
Reference in a new issue