Cache the result of XQueryTree().
svn path=/trunk/KDE/kdebase/workspace/; revision=851667
This commit is contained in:
parent
c67256e037
commit
09d81b7e87
5 changed files with 25 additions and 10 deletions
|
@ -322,7 +322,7 @@ void Workspace::performCompositing()
|
|||
return;
|
||||
}
|
||||
// create a list of all windows in the stacking order
|
||||
ToplevelList windows = compositingStackingOrder();
|
||||
ToplevelList windows = xStackingOrder();
|
||||
foreach( EffectWindow* c, static_cast< EffectsHandlerImpl* >( effects )->elevatedWindows())
|
||||
{
|
||||
Toplevel* t = static_cast< EffectWindowImpl* >( c )->window();
|
||||
|
|
|
@ -279,6 +279,10 @@ bool Workspace::workspaceEvent( XEvent * e )
|
|||
return true;
|
||||
}
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
if( e->xconfigure.event == rootWindow())
|
||||
x_stacking_dirty = true;
|
||||
break;
|
||||
};
|
||||
|
||||
if( Client* c = findClient( WindowMatchPredicate( e->xany.window )))
|
||||
|
|
18
layers.cpp
18
layers.cpp
|
@ -723,30 +723,32 @@ bool Workspace::keepTransientAbove( const Client* mainwindow, const Client* tran
|
|||
return true;
|
||||
}
|
||||
|
||||
// Returns all windows in their stacking order on the root window, used only by compositing.
|
||||
// TODO This possibly should be optimized to avoid the X roundtrip and building it every pass.
|
||||
ToplevelList Workspace::compositingStackingOrder() const
|
||||
// Returns all windows in their stacking order on the root window.
|
||||
ToplevelList Workspace::xStackingOrder() const
|
||||
{
|
||||
if( !x_stacking_dirty )
|
||||
return x_stacking;
|
||||
x_stacking_dirty = false;
|
||||
x_stacking.clear();
|
||||
Window dummy;
|
||||
Window* windows = NULL;
|
||||
unsigned int count = 0;
|
||||
XQueryTree( display(), rootWindow(), &dummy, &dummy, &windows, &count );
|
||||
ToplevelList ret;
|
||||
// use our own stacking order, not the X one, as they may differ
|
||||
foreach( Client* c, stacking_order )
|
||||
ret.append( c );
|
||||
x_stacking.append( c );
|
||||
for( unsigned int i = 0;
|
||||
i < count;
|
||||
++i )
|
||||
{
|
||||
if( Unmanaged* c = findUnmanaged( WindowMatchPredicate( windows[ i ] )))
|
||||
ret.append( c );
|
||||
x_stacking.append( c );
|
||||
}
|
||||
foreach( Deleted* c, deleted )
|
||||
ret.append( c );
|
||||
x_stacking.append( c );
|
||||
if( windows != NULL )
|
||||
XFree( windows );
|
||||
return ret;
|
||||
return x_stacking;
|
||||
}
|
||||
|
||||
//*******************************
|
||||
|
|
|
@ -99,6 +99,7 @@ Workspace::Workspace( bool restore )
|
|||
active_screen (0),
|
||||
delayfocus_client (0),
|
||||
force_restacking( false ),
|
||||
x_stacking_dirty( true ),
|
||||
showing_desktop( false ),
|
||||
block_showing_desktop( 0 ),
|
||||
was_user_interaction (false),
|
||||
|
@ -544,6 +545,7 @@ void Workspace::addClient( Client* c, allowed_t )
|
|||
stacking_order.append( c ); // c to be in stacking_order
|
||||
if( c->isTopMenu())
|
||||
addTopMenu( c );
|
||||
x_stacking_dirty = true;
|
||||
updateClientArea(); // this cannot be in manage(), because the client got added only now
|
||||
updateClientLayer( c );
|
||||
if( c->isDesktop())
|
||||
|
@ -566,6 +568,7 @@ void Workspace::addClient( Client* c, allowed_t )
|
|||
void Workspace::addUnmanaged( Unmanaged* c, allowed_t )
|
||||
{
|
||||
unmanaged.append( c );
|
||||
x_stacking_dirty = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -597,6 +600,7 @@ void Workspace::removeClient( Client* c, allowed_t )
|
|||
desktops.removeAll( c );
|
||||
unconstrained_stacking_order.removeAll( c );
|
||||
stacking_order.removeAll( c );
|
||||
x_stacking_dirty = true;
|
||||
for( int i = 1;
|
||||
i <= numberOfDesktops();
|
||||
++i )
|
||||
|
@ -633,12 +637,14 @@ void Workspace::removeUnmanaged( Unmanaged* c, allowed_t )
|
|||
{
|
||||
assert( unmanaged.contains( c ));
|
||||
unmanaged.removeAll( c );
|
||||
x_stacking_dirty = true;
|
||||
}
|
||||
|
||||
void Workspace::addDeleted( Deleted* c, allowed_t )
|
||||
{
|
||||
assert( !deleted.contains( c ));
|
||||
deleted.append( c );
|
||||
x_stacking_dirty = true;
|
||||
}
|
||||
|
||||
void Workspace::removeDeleted( Deleted* c, allowed_t )
|
||||
|
@ -649,6 +655,7 @@ void Workspace::removeDeleted( Deleted* c, allowed_t )
|
|||
if( effects )
|
||||
static_cast<EffectsHandlerImpl*>(effects)->windowDeleted( c->effectWindow());
|
||||
deleted.removeAll( c );
|
||||
x_stacking_dirty = true;
|
||||
}
|
||||
|
||||
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
|
||||
|
|
|
@ -518,7 +518,7 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
bool establishTabBoxGrab();
|
||||
void removeTabBoxGrab();
|
||||
|
||||
ToplevelList compositingStackingOrder() const;
|
||||
ToplevelList xStackingOrder() const;
|
||||
void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder
|
||||
ClientList constrainedStackingOrder();
|
||||
void raiseClientWithinApplication( Client* c );
|
||||
|
@ -613,6 +613,8 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
ClientList unconstrained_stacking_order; // topmost last
|
||||
ClientList stacking_order; // topmost last
|
||||
bool force_restacking;
|
||||
mutable ToplevelList x_stacking; // from XQueryTree()
|
||||
mutable bool x_stacking_dirty;
|
||||
QVector< ClientList > focus_chain; // currently ative last
|
||||
ClientList global_focus_chain; // this one is only for things like tabbox's MRU
|
||||
ClientList should_get_focus; // last is most recent
|
||||
|
|
Loading…
Reference in a new issue