Merging from old trunk:

r645397 | lunakl | 2007-03-22 15:27:04 +0100 (Thu, 22 Mar 2007) | 4 lines

Suspend updating of window-specific settings during shutdown,
so that KWin doesn't have to be killed as the first one during shutdown.


svn path=/trunk/KDE/kdebase/workspace/; revision=659567
This commit is contained in:
Luboš Luňák 2007-04-30 12:24:10 +00:00
parent ee040a6681
commit 932444eeef
5 changed files with 33 additions and 2 deletions

View file

@ -69,6 +69,7 @@ class Client
void removeRule( Rules* r );
void setupWindowRules( bool ignore_temporary );
void applyWindowRules();
void updateWindowRules();
// returns true for "special" windows and false for windows which are "normal"
// (normal=window which has a border, can be moved by the user, can be closed, etc.)
@ -326,7 +327,6 @@ class Client
QString readName() const;
void setCaption( const QString& s, bool force = false );
bool hasTransientInternal( const Client* c, bool indirect, ConstClientList& set ) const;
void updateWindowRules();
void finishWindowRules();
void setShortcutInternal( const KShortcut& cut );

View file

@ -850,6 +850,8 @@ void Client::updateWindowRules()
{
if( !isManaged()) // not fully setup yet
return;
if( workspace()->rulesUpdatesDisabled())
return;
client_rules.update( this );
}
@ -1007,6 +1009,14 @@ void Workspace::rulesUpdated()
rulesUpdatedTimer.start( 1000 );
}
void Workspace::disableRulesUpdates( bool disable )
{
rules_updates_disabled = disable;
if( !disable )
foreach( Client* c, clients )
c->updateWindowRules();
}
#endif
} // namespace

13
sm.cpp
View file

@ -293,11 +293,21 @@ NET::WindowType Workspace::txtToWindowType( const char* txt )
// but Qt doesn't have API for saying when session saved finished (either
// successfully, or was canceled). Therefore, create another connection
// to session manager, that will provide this information.
static void save_yourself( SmcConn conn_P, SmPointer ptr, int, Bool, int, Bool )
// Similarly the remember feature of window-specific settings should be disabled
// during KDE shutdown when windows may move e.g. because of Kicker going away
// (struts changing). When session saving starts, it can be cancelled, in which
// case the shutdown_cancelled callback is invoked, or it's a checkpoint that
// is immediatelly followed by save_complete, or finally it's a shutdown that
// is immediatelly followed by die callback. So getting save_yourself with shutdown
// set disables window-specific settings remembering, getting shutdown_cancelled
// re-enables, otherwise KWin will go away after die.
static void save_yourself( SmcConn conn_P, SmPointer ptr, int, Bool shutdown, int, Bool )
{
SessionSaveDoneHelper* session = reinterpret_cast< SessionSaveDoneHelper* >( ptr );
if( conn_P != session->connection())
return;
if( shutdown )
Workspace::self()->disableRulesUpdates( true );
SmcSaveYourselfDone( conn_P, True );
}
@ -323,6 +333,7 @@ static void shutdown_cancelled( SmcConn conn_P, SmPointer ptr )
SessionSaveDoneHelper* session = reinterpret_cast< SessionSaveDoneHelper* >( ptr );
if( conn_P != session->connection())
return;
Workspace::self()->disableRulesUpdates( false ); // re-enable
// no need to differentiate between successful finish and cancel
session->saveDone();
}

View file

@ -80,6 +80,7 @@ Workspace::Workspace( bool restore )
active_popup_client( NULL ),
desktop_widget (0),
temporaryRulesMessages( "_KDE_NET_WM_TEMPORARY_RULES", NULL, false ),
rules_updates_disabled( false ),
active_client (0),
last_active_client (0),
most_recently_raised (0),

View file

@ -237,6 +237,8 @@ class Workspace : public QObject, public KDecorationDefines
WindowRules findWindowRules( const Client*, bool );
void rulesUpdated();
void discardUsedWindowRules( Client* c, bool withdraw );
void disableRulesUpdates( bool disable );
bool rulesUpdatesDisabled() const;
// dcop interface
void cascadeDesktop();
@ -563,6 +565,7 @@ class Workspace : public QObject, public KDecorationDefines
QList<Rules*> rules;
KXMessages temporaryRulesMessages;
QTimer rulesUpdatedTimer;
bool rules_updates_disabled;
static const char* windowTypeToTxt( NET::WindowType type );
static NET::WindowType txtToWindowType( const char* txt );
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
@ -859,6 +862,12 @@ inline Window Workspace::overlayWindow()
return overlay;
}
inline
bool Workspace::rulesUpdatesDisabled() const
{
return rules_updates_disabled;
}
template< typename T >
inline Client* Workspace::findClient( T predicate )
{