From 678f92f146229ab7a0ed62c02a2b9e09d91d8e0d Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Tue, 11 Jul 2000 12:15:58 +0000 Subject: [PATCH] yet another focus-follows-mind attempt svn path=/trunk/kdebase/kwin/; revision=56079 --- workspace.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index d5dfa981a4..b82b9daa86 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -912,7 +912,7 @@ void Workspace::setActiveClient( Client* c ) if ( c->wantsTabFocus() ) focus_chain.append( c ); } - + // toplevel menubar handling Client* main = 0; if ( active_client ) @@ -934,12 +934,12 @@ void Workspace::setActiveClient( Client* c ) } } } - + if ( menubar ) { menubar->show(); menubar->raise(); } - + // ... then hide the other ones. Avoids flickers. for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it) { if ( (*it)->isMenu() && (*it) != menubar ) @@ -1556,7 +1556,7 @@ void Workspace::raiseClient( Client* c ) if ( tab_box->isVisible() ) return; - + ClientList saveset; if ( c == desktop_client ) { @@ -1708,9 +1708,9 @@ void Workspace::setCurrentDesktop( int new_desktop ){ if (new_desktop != current_desktop) { /* - optimized Desktop switching: unmapping done from back to front - mapping done from front to back => less exposure events - */ + optimized Desktop switching: unmapping done from back to front + mapping done from front to back => less exposure events + */ for ( ClientList::ConstIterator it = stacking_order.begin(); it != stacking_order.end(); ++it) { if ( (*it)->isVisible() && !(*it)->isOnDesktop( new_desktop ) ) { @@ -1735,8 +1735,15 @@ void Workspace::setCurrentDesktop( int new_desktop ){ Client* c = 0; if ( options->focusPolicyIsReasonable()) { - if (options->focusPolicy == Options::FocusFollowsMouse) { - // Search in focus chain + // Search in focus chain + for( ClientList::ConstIterator it = focus_chain.fromLast(); it != focus_chain.end(); --it) { + if ( (*it)->isVisible() && !(*it)->wantsTabFocus() ) { + c = *it; + break; + } + } + + if ( !c ) { for( ClientList::ConstIterator it = focus_chain.fromLast(); it != focus_chain.end(); --it) { if ( (*it)->isVisible() ) { c = *it; @@ -1745,7 +1752,6 @@ void Workspace::setCurrentDesktop( int new_desktop ){ } } - if (!c) { // Search top-most visible window for ( ClientList::ConstIterator it = stacking_order.fromLast(); it != stacking_order.end(); --it) {