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:
parent
ee040a6681
commit
932444eeef
5 changed files with 33 additions and 2 deletions
2
client.h
2
client.h
|
@ -69,6 +69,7 @@ class Client
|
||||||
void removeRule( Rules* r );
|
void removeRule( Rules* r );
|
||||||
void setupWindowRules( bool ignore_temporary );
|
void setupWindowRules( bool ignore_temporary );
|
||||||
void applyWindowRules();
|
void applyWindowRules();
|
||||||
|
void updateWindowRules();
|
||||||
|
|
||||||
// returns true for "special" windows and false for windows which are "normal"
|
// 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.)
|
// (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;
|
QString readName() const;
|
||||||
void setCaption( const QString& s, bool force = false );
|
void setCaption( const QString& s, bool force = false );
|
||||||
bool hasTransientInternal( const Client* c, bool indirect, ConstClientList& set ) const;
|
bool hasTransientInternal( const Client* c, bool indirect, ConstClientList& set ) const;
|
||||||
void updateWindowRules();
|
|
||||||
void finishWindowRules();
|
void finishWindowRules();
|
||||||
void setShortcutInternal( const KShortcut& cut );
|
void setShortcutInternal( const KShortcut& cut );
|
||||||
|
|
||||||
|
|
10
rules.cpp
10
rules.cpp
|
@ -850,6 +850,8 @@ void Client::updateWindowRules()
|
||||||
{
|
{
|
||||||
if( !isManaged()) // not fully setup yet
|
if( !isManaged()) // not fully setup yet
|
||||||
return;
|
return;
|
||||||
|
if( workspace()->rulesUpdatesDisabled())
|
||||||
|
return;
|
||||||
client_rules.update( this );
|
client_rules.update( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,6 +1009,14 @@ void Workspace::rulesUpdated()
|
||||||
rulesUpdatedTimer.start( 1000 );
|
rulesUpdatedTimer.start( 1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Workspace::disableRulesUpdates( bool disable )
|
||||||
|
{
|
||||||
|
rules_updates_disabled = disable;
|
||||||
|
if( !disable )
|
||||||
|
foreach( Client* c, clients )
|
||||||
|
c->updateWindowRules();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
13
sm.cpp
13
sm.cpp
|
@ -293,11 +293,21 @@ NET::WindowType Workspace::txtToWindowType( const char* txt )
|
||||||
// but Qt doesn't have API for saying when session saved finished (either
|
// but Qt doesn't have API for saying when session saved finished (either
|
||||||
// successfully, or was canceled). Therefore, create another connection
|
// successfully, or was canceled). Therefore, create another connection
|
||||||
// to session manager, that will provide this information.
|
// 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 );
|
SessionSaveDoneHelper* session = reinterpret_cast< SessionSaveDoneHelper* >( ptr );
|
||||||
if( conn_P != session->connection())
|
if( conn_P != session->connection())
|
||||||
return;
|
return;
|
||||||
|
if( shutdown )
|
||||||
|
Workspace::self()->disableRulesUpdates( true );
|
||||||
SmcSaveYourselfDone( conn_P, True );
|
SmcSaveYourselfDone( conn_P, True );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +333,7 @@ static void shutdown_cancelled( SmcConn conn_P, SmPointer ptr )
|
||||||
SessionSaveDoneHelper* session = reinterpret_cast< SessionSaveDoneHelper* >( ptr );
|
SessionSaveDoneHelper* session = reinterpret_cast< SessionSaveDoneHelper* >( ptr );
|
||||||
if( conn_P != session->connection())
|
if( conn_P != session->connection())
|
||||||
return;
|
return;
|
||||||
|
Workspace::self()->disableRulesUpdates( false ); // re-enable
|
||||||
// no need to differentiate between successful finish and cancel
|
// no need to differentiate between successful finish and cancel
|
||||||
session->saveDone();
|
session->saveDone();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ Workspace::Workspace( bool restore )
|
||||||
active_popup_client( NULL ),
|
active_popup_client( NULL ),
|
||||||
desktop_widget (0),
|
desktop_widget (0),
|
||||||
temporaryRulesMessages( "_KDE_NET_WM_TEMPORARY_RULES", NULL, false ),
|
temporaryRulesMessages( "_KDE_NET_WM_TEMPORARY_RULES", NULL, false ),
|
||||||
|
rules_updates_disabled( false ),
|
||||||
active_client (0),
|
active_client (0),
|
||||||
last_active_client (0),
|
last_active_client (0),
|
||||||
most_recently_raised (0),
|
most_recently_raised (0),
|
||||||
|
|
|
@ -237,6 +237,8 @@ class Workspace : public QObject, public KDecorationDefines
|
||||||
WindowRules findWindowRules( const Client*, bool );
|
WindowRules findWindowRules( const Client*, bool );
|
||||||
void rulesUpdated();
|
void rulesUpdated();
|
||||||
void discardUsedWindowRules( Client* c, bool withdraw );
|
void discardUsedWindowRules( Client* c, bool withdraw );
|
||||||
|
void disableRulesUpdates( bool disable );
|
||||||
|
bool rulesUpdatesDisabled() const;
|
||||||
|
|
||||||
// dcop interface
|
// dcop interface
|
||||||
void cascadeDesktop();
|
void cascadeDesktop();
|
||||||
|
@ -563,6 +565,7 @@ class Workspace : public QObject, public KDecorationDefines
|
||||||
QList<Rules*> rules;
|
QList<Rules*> rules;
|
||||||
KXMessages temporaryRulesMessages;
|
KXMessages temporaryRulesMessages;
|
||||||
QTimer rulesUpdatedTimer;
|
QTimer rulesUpdatedTimer;
|
||||||
|
bool rules_updates_disabled;
|
||||||
static const char* windowTypeToTxt( NET::WindowType type );
|
static const char* windowTypeToTxt( NET::WindowType type );
|
||||||
static NET::WindowType txtToWindowType( const char* txt );
|
static NET::WindowType txtToWindowType( const char* txt );
|
||||||
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
|
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
|
||||||
|
@ -859,6 +862,12 @@ inline Window Workspace::overlayWindow()
|
||||||
return overlay;
|
return overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool Workspace::rulesUpdatesDisabled() const
|
||||||
|
{
|
||||||
|
return rules_updates_disabled;
|
||||||
|
}
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
inline Client* Workspace::findClient( T predicate )
|
inline Client* Workspace::findClient( T predicate )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue