Save also stacking order when doing session save.
svn path=/trunk/KDE/kdebase/workspace/; revision=531882icc-effect-5.14.5
parent
82dff6627f
commit
daf4e723ea
|
@ -89,6 +89,7 @@ Client::Client( Workspace *ws )
|
||||||
border_right( 0 ),
|
border_right( 0 ),
|
||||||
border_top( 0 ),
|
border_top( 0 ),
|
||||||
border_bottom( 0 ),
|
border_bottom( 0 ),
|
||||||
|
sm_stacking_order( -1 ),
|
||||||
demandAttentionKNotifyTimer( NULL )
|
demandAttentionKNotifyTimer( NULL )
|
||||||
// SELI do all as initialization
|
// SELI do all as initialization
|
||||||
{
|
{
|
||||||
|
|
7
client.h
7
client.h
|
@ -157,6 +157,7 @@ class Client : public QObject, public KDecorationDefines
|
||||||
Layer layer() const;
|
Layer layer() const;
|
||||||
Layer belongsToLayer() const;
|
Layer belongsToLayer() const;
|
||||||
void invalidateLayer();
|
void invalidateLayer();
|
||||||
|
int sessionStackingOrder() const;
|
||||||
|
|
||||||
void setModal( bool modal );
|
void setModal( bool modal );
|
||||||
bool isModal() const;
|
bool isModal() const;
|
||||||
|
@ -531,6 +532,7 @@ class Client : public QObject, public KDecorationDefines
|
||||||
QRegion _mask;
|
QRegion _mask;
|
||||||
static bool check_active_modal; // see Client::checkActiveModal()
|
static bool check_active_modal; // see Client::checkActiveModal()
|
||||||
KShortcut _shortcut;
|
KShortcut _shortcut;
|
||||||
|
int sm_stacking_order;
|
||||||
friend struct FetchNameInternalPredicate;
|
friend struct FetchNameInternalPredicate;
|
||||||
friend struct CheckIgnoreFocusStealingProcedure;
|
friend struct CheckIgnoreFocusStealingProcedure;
|
||||||
friend struct ResetupRulesProcedure;
|
friend struct ResetupRulesProcedure;
|
||||||
|
@ -790,6 +792,11 @@ inline void Client::invalidateLayer()
|
||||||
in_layer = UnknownLayer;
|
in_layer = UnknownLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int Client::sessionStackingOrder() const
|
||||||
|
{
|
||||||
|
return sm_stacking_order;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool Client::isIconicState() const
|
inline bool Client::isIconicState() const
|
||||||
{
|
{
|
||||||
return mapping_state == IconicState;
|
return mapping_state == IconicState;
|
||||||
|
|
20
layers.cpp
20
layers.cpp
|
@ -449,6 +449,26 @@ void Workspace::restackClientUnderActive( Client* c )
|
||||||
updateStackingOrder();
|
updateStackingOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Workspace::restoreSessionStackingOrder( Client* c )
|
||||||
|
{
|
||||||
|
if( c->sessionStackingOrder() < 0 )
|
||||||
|
return;
|
||||||
|
StackingUpdatesBlocker blocker( this );
|
||||||
|
unconstrained_stacking_order.remove( c );
|
||||||
|
ClientList::Iterator best_pos = unconstrained_stacking_order.end();
|
||||||
|
for( ClientList::Iterator it = unconstrained_stacking_order.begin(); // from bottom
|
||||||
|
it != unconstrained_stacking_order.end();
|
||||||
|
++it )
|
||||||
|
{
|
||||||
|
if( (*it)->sessionStackingOrder() > c->sessionStackingOrder() )
|
||||||
|
{
|
||||||
|
unconstrained_stacking_order.insert( it, c );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unconstrained_stacking_order.append( c );
|
||||||
|
}
|
||||||
|
|
||||||
void Workspace::circulateDesktopApplications()
|
void Workspace::circulateDesktopApplications()
|
||||||
{
|
{
|
||||||
if ( desktops.count() > 1 )
|
if ( desktops.count() > 1 )
|
||||||
|
|
20
manage.cpp
20
manage.cpp
|
@ -36,6 +36,8 @@ namespace KWinInternal
|
||||||
*/
|
*/
|
||||||
bool Client::manage( Window w, bool isMapped )
|
bool Client::manage( Window w, bool isMapped )
|
||||||
{
|
{
|
||||||
|
StackingUpdatesBlocker stacking_blocker( workspace());
|
||||||
|
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
if( !XGetWindowAttributes(QX11Info::display(), w, &attr))
|
if( !XGetWindowAttributes(QX11Info::display(), w, &attr))
|
||||||
return false;
|
return false;
|
||||||
|
@ -424,11 +426,6 @@ bool Client::manage( Window w, bool isMapped )
|
||||||
|
|
||||||
updateAllowedActions( true );
|
updateAllowedActions( true );
|
||||||
|
|
||||||
// TODO this should avoid flicker, because real restacking is done
|
|
||||||
// only after manage() finishes, but the window is shown sooner
|
|
||||||
// - keep it?
|
|
||||||
XLowerWindow( QX11Info::display(), frameId());
|
|
||||||
|
|
||||||
// set initial user time directly
|
// set initial user time directly
|
||||||
user_time = readUserTimeMapTimestamp( asn_valid ? &asn_id : NULL, asn_valid ? &asn_data : NULL, session );
|
user_time = readUserTimeMapTimestamp( asn_valid ? &asn_id : NULL, asn_valid ? &asn_data : NULL, session );
|
||||||
group()->updateUserTime( user_time ); // and do what Client::updateUserTime() does
|
group()->updateUserTime( user_time ); // and do what Client::updateUserTime() does
|
||||||
|
@ -436,6 +433,15 @@ bool Client::manage( Window w, bool isMapped )
|
||||||
if( isTopMenu()) // they're shown in Workspace::addClient() if their mainwindow
|
if( isTopMenu()) // they're shown in Workspace::addClient() if their mainwindow
|
||||||
hideClient( true ); // is the active one
|
hideClient( true ); // is the active one
|
||||||
|
|
||||||
|
// this should avoid flicker, because real restacking is done
|
||||||
|
// only after manage() finishes because of blocking, but the window is shown sooner
|
||||||
|
XLowerWindow( QX11Info::display(), frameId());
|
||||||
|
if( session && session->stackingOrder != -1 )
|
||||||
|
{
|
||||||
|
sm_stacking_order = session->stackingOrder;
|
||||||
|
workspace()->restoreSessionStackingOrder( this );
|
||||||
|
}
|
||||||
|
|
||||||
if( isShown( true ) && !doNotShow )
|
if( isShown( true ) && !doNotShow )
|
||||||
{
|
{
|
||||||
if( isDialog())
|
if( isDialog())
|
||||||
|
@ -466,10 +472,8 @@ bool Client::manage( Window w, bool isMapped )
|
||||||
if( !belongs_to_desktop && workspace()->showingDesktop())
|
if( !belongs_to_desktop && workspace()->showingDesktop())
|
||||||
workspace()->resetShowingDesktop( false );
|
workspace()->resetShowingDesktop( false );
|
||||||
|
|
||||||
if( isOnCurrentDesktop() && !isMapped && !allow )
|
if( isOnCurrentDesktop() && !isMapped && !allow && (!session || session->stackingOrder < 0 ))
|
||||||
workspace()->restackClientUnderActive( this );
|
workspace()->restackClientUnderActive( this );
|
||||||
else
|
|
||||||
workspace()->raiseClient( this );
|
|
||||||
|
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
|
|
||||||
|
|
3
sm.cpp
3
sm.cpp
|
@ -114,9 +114,9 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase )
|
||||||
config->writeEntry( QString("userNoBorder")+n, c->isUserNoBorder() );
|
config->writeEntry( QString("userNoBorder")+n, c->isUserNoBorder() );
|
||||||
config->writeEntry( QString("windowType")+n, windowTypeToTxt( c->windowType()));
|
config->writeEntry( QString("windowType")+n, windowTypeToTxt( c->windowType()));
|
||||||
config->writeEntry( QString("shortcut")+n, c->shortcut().toStringInternal());
|
config->writeEntry( QString("shortcut")+n, c->shortcut().toStringInternal());
|
||||||
|
config->writeEntry( QString("stackingOrder")+n, unconstrained_stacking_order.findIndex( c ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO store also stacking order
|
|
||||||
if( phase == SMSavePhase0 )
|
if( phase == SMSavePhase0 )
|
||||||
{
|
{
|
||||||
// it would be much simpler to save these values to the config file,
|
// it would be much simpler to save these values to the config file,
|
||||||
|
@ -180,6 +180,7 @@ void Workspace::loadSessionInfo()
|
||||||
info->windowType = txtToWindowType( config->readEntry( QString("windowType")+n, QString() ).toLatin1());
|
info->windowType = txtToWindowType( config->readEntry( QString("windowType")+n, QString() ).toLatin1());
|
||||||
info->shortcut = config->readEntry( QString("shortcut")+n, QString() );
|
info->shortcut = config->readEntry( QString("shortcut")+n, QString() );
|
||||||
info->active = ( active_client == i );
|
info->active = ( active_client == i );
|
||||||
|
info->stackingOrder = config->readNumEntry( QString("stackingOrder")+n, -1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
sm.h
1
sm.h
|
@ -48,6 +48,7 @@ struct SessionInfo
|
||||||
NET::WindowType windowType;
|
NET::WindowType windowType;
|
||||||
QString shortcut;
|
QString shortcut;
|
||||||
bool active; // means 'was active in the saved session'
|
bool active; // means 'was active in the saved session'
|
||||||
|
int stackingOrder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -521,7 +521,7 @@ void Workspace::addClient( Client* c, allowed_t )
|
||||||
clients.append( c );
|
clients.append( c );
|
||||||
}
|
}
|
||||||
if( !unconstrained_stacking_order.contains( c ))
|
if( !unconstrained_stacking_order.contains( c ))
|
||||||
unconstrained_stacking_order.append( c );
|
unconstrained_stacking_order.append( c ); // raise if it hasn't got any stacking position yet
|
||||||
if( !stacking_order.contains( c )) // it'll be updated later, and updateToolWindows() requires
|
if( !stacking_order.contains( c )) // it'll be updated later, and updateToolWindows() requires
|
||||||
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())
|
||||||
|
|
|
@ -145,6 +145,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
|
||||||
void restackClientUnderActive( Client* );
|
void restackClientUnderActive( Client* );
|
||||||
void updateClientLayer( Client* c );
|
void updateClientLayer( Client* c );
|
||||||
void raiseOrLowerClient( Client * );
|
void raiseOrLowerClient( Client * );
|
||||||
|
void restoreSessionStackingOrder( Client* c );
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
|
|
||||||
void clientHidden( Client* );
|
void clientHidden( Client* );
|
||||||
|
|
Loading…
Reference in New Issue