[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/kwin
From:       Thomas Lübking <thomas.luebking () gmail ! com>
Date:       2010-12-20 18:21:47
Message-ID: 20101220182147.09E02AC8AC () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208125 by luebking:

adjust activateNextClient() policy
(on a client close, don't activate any random client in the 
group but only the leader -and raise it- or the last active client)
http://svn.reviewboard.kde.org/r/5830/
BUG: 183911


 M  +24 -20    activation.cpp  


--- trunk/KDE/kdebase/workspace/kwin/activation.cpp #1208124:1208125
@@ -419,6 +419,13 @@
     activateNextClient( c );
     }
 
+static inline bool isUsableFocusCandidate( Client *c, Client *prev, bool \
respectScreen ) +    {
+    return c != prev &&
+           c->isShown( false ) && c->isOnCurrentDesktop() && \
c->isOnCurrentActivity() && +           ( !respectScreen || c->isOnScreen( prev ? \
prev->screen() : Workspace::self()->activeScreen() ) ); +    }
+
 // deactivates 'c' and activates next client
 bool Workspace::activateNextClient( Client* c )
     {
@@ -437,34 +444,31 @@
         {
         if ( options->focusPolicyIsReasonable())
             { // search the focus_chain for a client to transfer focus to,
-              // first try to transfer focus to the first suitable window in the \
group  Client* get_focus = NULL;
-            const ClientList windows = ( c != NULL ? c->group()->members() : \
                ClientList());
-	    for ( int i = focus_chain[ currentDesktop() ].size() - 1;
-                  i >= 0;
-                  --i )
+
+            // first try to pass the focus to the (former) active clients leader
+            if ( c  && ( get_focus = c->transientFor() ) &&
+                 isUsableFocusCandidate( get_focus, c, options->separateScreenFocus \
))  {
+                raiseClient( get_focus ); // also raise - we don't know where it \
came from +                }
+            else // nope, ask the focus chain for the next candidate
+                {
+                get_focus = NULL; // reset
+                for ( int i = focus_chain[ currentDesktop() ].size() - 1; i >= 0; \
--i ) +                    {
                 Client* ci = focus_chain[ currentDesktop() ].at( i );
-                if( c == ci || !ci->isShown( false )
-                    || !ci->isOnCurrentDesktop() || !ci->isOnCurrentActivity())
-                    continue;
-                if( options->separateScreenFocus )
+                    if ( isUsableFocusCandidate( ci, c, options->separateScreenFocus \
))  {
-                    if( c != NULL && !ci->isOnScreen( c->screen()))
-                        continue;
-                    if( c == NULL && !ci->isOnScreen( activeScreen()))
-                        continue;
-                    }
-                if( windows.contains( ci ))
-                    {
                     get_focus = ci;
-                    break;
+                        break; // we're done
                     }
-                if( get_focus == NULL )
-                    get_focus = ci;
                 }
-            if( get_focus == NULL )
+                }
+
+            if( get_focus == NULL ) // last chance: focus the desktop
                 get_focus = findDesktop( true, currentDesktop());
+
             if( get_focus != NULL )
                 requestFocus( get_focus );
             else


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic