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