diff options
author | Darrell Anderson <[email protected]> | 2012-06-09 21:42:15 -0500 |
---|---|---|
committer | Darrell Anderson <[email protected]> | 2012-06-09 21:42:15 -0500 |
commit | 1e959a2aeca4499a1b8a79d1793953348638b69f (patch) | |
tree | 9a65f975ce8917d33eab9152a48ab6befadb43b2 /twin/tabbox.cpp | |
parent | 8d7bb2841842aca2eb69bfd847b8674abfa06425 (diff) | |
download | tdebase-1e959a2aeca4499a1b8a79d1793953348638b69f.tar.gz tdebase-1e959a2aeca4499a1b8a79d1793953348638b69f.zip |
Added Mac-like window switching for one app with keyboard shortcut Alt-~.
This resolves bug report 869.
Thanks to Calvin Morrison.
Diffstat (limited to 'twin/tabbox.cpp')
-rw-r--r-- | twin/tabbox.cpp | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/twin/tabbox.cpp b/twin/tabbox.cpp index 284a920bc..4f5a19364 100644 --- a/twin/tabbox.cpp +++ b/twin/tabbox.cpp @@ -47,6 +47,7 @@ TabBox::TabBox( Workspace *ws, const char *name ) setLineWidth(2); setMargin(2); + appsOnly = false; showMiniIcon = false; no_tasks = i18n("*** No Windows ***"); @@ -86,6 +87,14 @@ void TabBox::setMode( Mode mode ) m = mode; } +/*! + Sets AppsOnly, which when true, createClientList will return only applications within the same class + + */ +void TabBox::setAppsOnly( bool a ) + { + appsOnly = a; + } /*! Create list of clients on specified desktop, starting with client c @@ -93,11 +102,14 @@ void TabBox::setMode( Mode mode ) void TabBox::createClientList(ClientList &list, int desktop /*-1 = all*/, Client *c, bool chain) { ClientList::size_type idx = 0; - + TQString startClass; list.clear(); Client* start = c; + if( start ) + startClass = start->resourceClass(); + if ( chain ) c = workspace()->nextFocusChainClient(c); else @@ -121,6 +133,10 @@ void TabBox::createClientList(ClientList &list, int desktop /*-1 = all*/, Client // nothing } } + if(appsOnly && (TQString::compare( startClass, c->resourceClass()) != 0)) + { + add = NULL; + } if( options->separateScreenFocus && options->xineramaEnabled ) { @@ -645,6 +661,7 @@ void TabBox::hide() XEvent otherEvent; while (XCheckTypedEvent (tqt_xdisplay(), EnterNotify, &otherEvent ) ) ; + appsOnly = false; } @@ -893,6 +910,18 @@ void Workspace::slotWalkBackThroughWindows() } } +void Workspace::slotWalkThroughApps() + { + tab_box->setAppsOnly(true); + slotWalkThroughWindows(); + } + +void Workspace::slotWalkBackThroughApps() + { + tab_box->setAppsOnly(true); + slotWalkBackThroughWindows(); + } + void Workspace::slotWalkThroughDesktops() { if ( root != tqt_xrootwin() ) @@ -1112,18 +1141,33 @@ void Workspace::tabBoxKeyPress( const KKeyNative& keyX ) { bool forward = false; bool backward = false; + bool forwardapps = false; + bool backwardapps = false; if (tab_grab) { forward = cutWalkThroughWindows.contains( keyX ); backward = cutWalkThroughWindowsReverse.contains( keyX ); - if (forward || backward) + + forwardapps = cutWalkThroughApps.contains( keyX ); + backwardapps = cutWalkThroughAppsReverse.contains( keyX ); + + if ( (forward || backward) && (!tab_box->isAppsOnly()) ) { kdDebug(125) << "== " << cutWalkThroughWindows.toStringInternal() << " or " << cutWalkThroughWindowsReverse.toStringInternal() << endl; + KDEWalkThroughWindows( forward ); } - } + + if ( (forwardapps || backwardapps) && (tab_box->isAppsOnly()) ) + { + kdDebug(125) << "== " << cutWalkThroughWindows.toStringInternal() + << " or " << cutWalkThroughWindowsReverse.toStringInternal() << endl; + KDEWalkThroughWindows( forwardapps ); + } + } + else if (control_grab) { forward = cutWalkThroughDesktops.contains( keyX ) || |