Don't refuse explicit window activation request just because the window

is not on the current desktop.


svn path=/trunk/KDE/kdebase/workspace/; revision=742984
This commit is contained in:
Luboš Luňák 2007-11-29 15:01:30 +00:00
parent 9cae215d63
commit 60e904fb04
3 changed files with 9 additions and 6 deletions

View file

@ -505,8 +505,9 @@ void Workspace::setShouldGetFocus( Client* c )
} }
// focus_in -> the window got FocusIn event // focus_in -> the window got FocusIn event
// session_active -> the window was active when saving session // ignore_desktop - call comes from _NET_ACTIVE_WINDOW message, don't refuse just because of window
bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in ) // is on a different desktop
bool Workspace::allowClientActivation( const Client* c, Time time, bool focus_in, bool ignore_desktop )
{ {
// options->focusStealingPreventionLevel : // options->focusStealingPreventionLevel :
// 0 - none - old KWin behaviour, new windows always get focus // 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; return true;
if( level == 4 ) // extreme if( level == 4 ) // extreme
return false; return false;
if( !c->isOnCurrentDesktop()) if( !ignore_desktop && !c->isOnCurrentDesktop())
return false; // allow only with level == 0 return false; // allow only with level == 0
if( c->ignoreFocusStealing()) if( c->ignoreFocusStealing())
return true; return true;

View file

@ -140,14 +140,16 @@ void RootInfo::changeActiveWindow( Window w, NET::RequestSource src, Time timest
else // NET::FromApplication else // NET::FromApplication
{ {
Client* c2; Client* c2;
if( workspace->allowClientActivation( c, timestamp )) if( workspace->allowClientActivation( c, timestamp, false, true ))
workspace->activateClient( c ); workspace->activateClient( c );
// if activation of the requestor's window would be allowed, allow activation too // if activation of the requestor's window would be allowed, allow activation too
else if( active_window != None else if( active_window != None
&& ( c2 = workspace->findClient( WindowMatchPredicate( active_window ))) != NULL && ( c2 = workspace->findClient( WindowMatchPredicate( active_window ))) != NULL
&& workspace->allowClientActivation( c2, && workspace->allowClientActivation( c2,
timestampCompare( timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()))) timestampCompare( timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()), false, true ))
{
workspace->activateClient( c ); workspace->activateClient( c );
}
else else
c->demandAttention(); c->demandAttention();
} }

View file

@ -108,7 +108,7 @@ class Workspace : public QObject, public KDecorationDefines
void requestFocus( Client* c, bool force = false ); void requestFocus( Client* c, bool force = false );
void takeActivity( Client* c, int flags, bool handled ); // flags are ActivityFlags void takeActivity( Client* c, int flags, bool handled ); // flags are ActivityFlags
void handleTakeActivity( Client* c, Time timestamp, int flags ); // 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 restoreFocus();
void gotFocusIn( const Client* ); void gotFocusIn( const Client* );
void setShouldGetFocus( Client* ); void setShouldGetFocus( Client* );