From 60a152eca9bdcfd43b5d3178a2a52f7ed9b44eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 30 Oct 2009 11:22:39 +0000 Subject: [PATCH] Add application switching to TabBox (that is only one element per window class). FEATURE: 206950 svn path=/trunk/KDE/kdebase/workspace/; revision=1042640 --- kcmkwin/kwintabbox/main.ui | 10 ++++++++++ tabbox.cpp | 17 +++++++++++++++++ tabbox/tabboxconfig.h | 4 +++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/kcmkwin/kwintabbox/main.ui b/kcmkwin/kwintabbox/main.ui index d3f4e519db..2b12839a07 100644 --- a/kcmkwin/kwintabbox/main.ui +++ b/kcmkwin/kwintabbox/main.ui @@ -90,6 +90,16 @@ All Desktops + + + Current Desktop Grouped by Applications + + + + + All Desktops Grouped by Applications + + diff --git a/tabbox.cpp b/tabbox.cpp index dbf827560d..bd6b25046c 100644 --- a/tabbox.cpp +++ b/tabbox.cpp @@ -124,6 +124,8 @@ TabBoxClient* TabBoxHandlerImpl::clientToAddToList( TabBoxClient* client, int de Client* ret = NULL; Client* current = (static_cast< TabBoxClientImpl* >( client ))->client(); bool addClient = false; + bool applications = (config().clientListMode() == TabBoxConfig::AllDesktopsApplicationList || + config().clientListMode() == TabBoxConfig::CurrentDesktopApplicationList); if( allDesktops ) addClient = true; else @@ -140,6 +142,21 @@ TabBoxClient* TabBoxHandlerImpl::clientToAddToList( TabBoxClient* client, int de { // nothing } + if( ret && applications ) + { + // check if the list already contains an entry of this application + foreach( TabBoxClient* tabBoxClient, clientList() ) + { + if( TabBoxClientImpl* c = dynamic_cast< TabBoxClientImpl* >(tabBoxClient) ) + { + if( c->client()->resourceClass() == ret->resourceClass() ) + { + ret = NULL; + break; + } + } + } + } } if( options->separateScreenFocus && options->xineramaEnabled ) { diff --git a/tabbox/tabboxconfig.h b/tabbox/tabboxconfig.h index d94896fb3b..91d0c87114 100644 --- a/tabbox/tabboxconfig.h +++ b/tabbox/tabboxconfig.h @@ -68,7 +68,9 @@ class TabBoxConfig enum ClientListMode { CurrentDesktopClientList, ///< Only TabBoxClients on current desktop are included - AllDesktopsClientList ///< TabBoxClients from all desktops are included. + AllDesktopsClientList, ///< TabBoxClients from all desktops are included. + CurrentDesktopApplicationList, ///< Only one TabBoxClient for each application on current desktop is included + AllDesktopsApplicationList ///< Only one TabBoxClient for each application is included }; /** * ClientSwitchingMode defines the sorting of the TabBoxClients in the