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
icc-effect-5.14.5
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
// 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;

View File

@ -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();
}

View File

@ -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* );