Fix activation of window that was active at session saving time.

svn path=/trunk/kdebase/kwin/; revision=319667
This commit is contained in:
Luboš Luňák 2004-06-11 15:13:08 +00:00
parent be739ddfb6
commit 5085b40285
3 changed files with 16 additions and 9 deletions

View file

@ -454,7 +454,7 @@ void Workspace::setShouldGetFocus( Client* c )
// focus_in -> the window got FocusIn event
// session_active -> the window was active when saving session
bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in, bool session_active )
bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in )
{
// options->focusStealingPreventionLevel :
// 0 - none - old KWin behaviour, new windows always get focus
@ -502,9 +502,6 @@ bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in
if( level == 3 ) // high
return false;
if( time == -1U ) // no time known
if( session_active )
return !was_user_interaction; // see Client::readUserTimeMapTimestamp()
else
{
kdDebug( 1212 ) << "Activation: No timestamp at all" << endl;
if( level == 1 ) // low
@ -731,7 +728,7 @@ Time Client::readUserTimeMapTimestamp( const KStartupInfoId* asn_id, const KStar
// it's better not to activate the new one.
// Unless it was the active window at the time
// of session saving and there was no user interaction yet,
// this check will be done in Workspace::allowClientActiovationTimestamp().
// this check will be done in manage().
if( session )
return -1U;
if( ignoreFocusStealing() && act != NULL )

View file

@ -416,11 +416,15 @@ bool Client::manage( Window w, bool isMapped )
if( isNormalWindow())
Notify::raise( Notify::New );
bool allow = workspace()->allowClientActivation( this, userTime(), false, session && session->active );
bool allow;
if( session )
allow = session->active && !workspace()->wasUserInteraction();
else
allow = workspace()->allowClientActivation( this, userTime(), false );
// if session saving, force showing new windows (i.e. "save file?" dialogs etc.)
// also force if activation is allowed
if( !isOnCurrentDesktop() && !isMapped && ( allow || workspace()->sessionSaving()))
if( !isOnCurrentDesktop() && !isMapped && !session && ( allow || workspace()->sessionSaving()))
workspace()->setCurrentDesktop( desktop());
if( isOnCurrentDesktop())

View file

@ -111,8 +111,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
void requestFocus( Client* c, bool force = FALSE );
void takeActivity( Client* c, int flags, bool handled ); // flags are ActivityFlags
void handleTakeActivity( Client* c, Time timestamp, int flags ); // flags are ActivityFlags
bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false,
bool session_active = false );
bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false );
void restoreFocus();
void gotFocusIn( const Client* );
void setShouldGetFocus( Client* );
@ -240,6 +239,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
void sessionSaveStarted();
void sessionSaveDone();
void setWasUserInteraction();
bool wasUserInteraction() const;
bool sessionSaving() const;
bool managingTopMenus() const;
@ -649,6 +649,12 @@ void Workspace::setWasUserInteraction()
was_user_interaction = true;
}
inline
bool Workspace::wasUserInteraction() const
{
return was_user_interaction;
}
inline
bool Workspace::managingTopMenus() const
{