diff --git a/activation.cpp b/activation.cpp index 06c5290f3b..34dda93f32 100644 --- a/activation.cpp +++ b/activation.cpp @@ -505,8 +505,9 @@ 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 ) +// ignore_desktop - call comes from _NET_ACTIVE_WINDOW message, don't refuse just because of window +// is on a different desktop +bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in, bool ignore_desktop ) { // options->focusStealingPreventionLevel : // 0 - none - old KWin behaviour, new windows always get focus @@ -538,7 +539,7 @@ bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in return true; if( level == 4 ) // extreme return false; - if( !c->isOnCurrentDesktop()) + if( !ignore_desktop && !c->isOnCurrentDesktop()) return false; // allow only with level == 0 if( c->ignoreFocusStealing()) return true; diff --git a/events.cpp b/events.cpp index ec40279d75..ad1a181cfd 100644 --- a/events.cpp +++ b/events.cpp @@ -140,14 +140,16 @@ void RootInfo::changeActiveWindow( Window w, NET::RequestSource src, Time timest else // NET::FromApplication { Client* c2; - if( workspace->allowClientActivation( c, timestamp )) + if( workspace->allowClientActivation( c, timestamp, false, true )) workspace->activateClient( c ); // if activation of the requestor's window would be allowed, allow activation too else if( active_window != None && ( c2 = workspace->findClient( WindowMatchPredicate( active_window ))) != NULL && workspace->allowClientActivation( c2, - timestampCompare( timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()))) + timestampCompare( timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()), false, true )) + { workspace->activateClient( c ); + } else c->demandAttention(); } diff --git a/workspace.h b/workspace.h index db4d256760..25ee03296f 100644 --- a/workspace.h +++ b/workspace.h @@ -108,7 +108,7 @@ class Workspace : public QObject, public KDecorationDefines 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 allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false, bool ignore_desktop = false ); void restoreFocus(); void gotFocusIn( const Client* ); void setShouldGetFocus( Client* );