diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3dbf2e1392..b2866b0111 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,6 +45,7 @@ endif(OPENGLES_FOUND AND KWIN_HAVE_OPENGLES_COMPOSITING)
OPTION(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
OPTION(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
OPTION(KWIN_MOBILE_EFFECTS "Only build effects relevant for mobile devices" OFF)
+OPTION(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
# for things that are also used by kwin libraries
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )
@@ -92,15 +93,6 @@ set(kwin_KDEINIT_SRCS
utils.cpp
layers.cpp
main.cpp
- tabbox.cpp
- tabbox/clientitemdelegate.cpp
- tabbox/clientmodel.cpp
- tabbox/desktopitemdelegate.cpp
- tabbox/desktopmodel.cpp
- tabbox/itemlayoutconfig.cpp
- tabbox/tabboxconfig.cpp
- tabbox/tabboxhandler.cpp
- tabbox/tabboxview.cpp
desktopchangeosd.cpp
options.cpp
outline.cpp
@@ -162,6 +154,21 @@ set(kwin_KDEINIT_SRCS
tilinglayouts/floating/floating.cpp
)
+if(KWIN_BUILD_TABBOX)
+ set(
+ kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
+ tabbox.cpp
+ tabbox/clientitemdelegate.cpp
+ tabbox/clientmodel.cpp
+ tabbox/desktopitemdelegate.cpp
+ tabbox/desktopmodel.cpp
+ tabbox/itemlayoutconfig.cpp
+ tabbox/tabboxconfig.cpp
+ tabbox/tabboxhandler.cpp
+ tabbox/tabboxview.cpp
+ )
+endif(KWIN_BUILD_TABBOX)
+
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWin::Workspace )
qt4_add_dbus_interface( kwin_KDEINIT_SRCS
diff --git a/client.cpp b/client.cpp
index d14a727dc7..b429a69b51 100644
--- a/client.cpp
+++ b/client.cpp
@@ -48,7 +48,9 @@ along with this program. If not, see .
#include "shadow.h"
#include "deleted.h"
#include "paintredirector.h"
+#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
+#endif
#include
#include
@@ -187,9 +189,11 @@ Client::Client(Workspace* ws)
//Client to workspace connections require that each
//client constructed be connected to the workspace wrapper
+#ifdef KWIN_BUILD_TABBOX
// TabBoxClient
m_tabBoxClient = new TabBox::TabBoxClientImpl();
m_tabBoxClient->setClient(this);
+#endif
geom = QRect(0, 0, 100, 100); // So that decorations don't start with size being (0,0)
client_size = QSize(100, 100);
@@ -222,7 +226,9 @@ Client::~Client()
assert(block_geometry_updates == 0);
assert(!check_active_modal);
delete bridge;
+#ifdef KWIN_BUILD_TABBOX
delete m_tabBoxClient;
+#endif
delete scriptCache;
}
diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake
index 263982d2dc..5cb59831e1 100644
--- a/config-kwin.h.cmake
+++ b/config-kwin.h.cmake
@@ -1,3 +1,4 @@
/* Define if you have libcaptury */
#cmakedefine HAVE_CAPTURY 1
#cmakedefine KWIN_BUILD_DECORATIONS 1
+#cmakedefine KWIN_BUILD_TABBOX 1
diff --git a/effects.cpp b/effects.cpp
index 467f1d3219..f736a3408a 100644
--- a/effects.cpp
+++ b/effects.cpp
@@ -28,7 +28,9 @@ along with this program. If not, see .
#include "scene_opengl.h"
#include "screenedge.h"
#include "unmanaged.h"
+#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
+#endif
#include "workspace.h"
#include "kwinglutils.h"
@@ -108,10 +110,12 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type)
connect(ws, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
connect(ws, SIGNAL(propertyNotify(long)), this, SLOT(slotPropertyNotify(long)));
+#ifdef KWIN_BUILD_TABBOX
connect(ws->tabBox(), SIGNAL(tabBoxAdded(int)), SIGNAL(tabBoxAdded(int)));
connect(ws->tabBox(), SIGNAL(tabBoxUpdated()), SIGNAL(tabBoxUpdated()));
connect(ws->tabBox(), SIGNAL(tabBoxClosed()), SIGNAL(tabBoxClosed()));
connect(ws->tabBox(), SIGNAL(tabBoxKeyEvent(QKeyEvent*)), SIGNAL(tabBoxKeyEvent(QKeyEvent*)));
+#endif
// connect all clients
foreach (Client *c, ws->clientList()) {
setupClientConnections(c);
@@ -751,22 +755,28 @@ void EffectsHandlerImpl::setElevatedWindow(EffectWindow* w, bool set)
void EffectsHandlerImpl::setTabBoxWindow(EffectWindow* w)
{
- if (Client* c = dynamic_cast< Client* >(static_cast< EffectWindowImpl* >(w)->window()))
+#ifdef KWIN_BUILD_TABBOX
+ if (Client* c = dynamic_cast< Client* >(static_cast< EffectWindowImpl* >(w)->window())) {
+
if (Workspace::self()->hasTabBox()) {
Workspace::self()->tabBox()->setCurrentClient(c);
}
+ }
+#endif
}
void EffectsHandlerImpl::setTabBoxDesktop(int desktop)
{
+#ifdef KWIN_BUILD_TABBOX
if (Workspace::self()->hasTabBox()) {
Workspace::self()->tabBox()->setCurrentDesktop(desktop);
}
-
+#endif
}
EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const
{
+#ifdef KWIN_BUILD_TABBOX
EffectWindowList ret;
ClientList clients;
if (Workspace::self()->hasTabBox()) {
@@ -777,51 +787,66 @@ EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const
foreach (Client * c, clients)
ret.append(c->effectWindow());
return ret;
+#else
+ return EffectWindowList;
+#endif
}
void EffectsHandlerImpl::refTabBox()
{
+#ifdef KWIN_BUILD_TABBOX
if (Workspace::self()->hasTabBox()) {
Workspace::self()->tabBox()->reference();
}
+#endif
}
void EffectsHandlerImpl::unrefTabBox()
{
+#ifdef KWIN_BUILD_TABBOX
if (Workspace::self()->hasTabBox()) {
Workspace::self()->tabBox()->unreference();
}
+#endif
}
void EffectsHandlerImpl::closeTabBox()
{
+#ifdef KWIN_BUILD_TABBOX
if (Workspace::self()->hasTabBox()) {
Workspace::self()->tabBox()->close();
}
+#endif
}
QList< int > EffectsHandlerImpl::currentTabBoxDesktopList() const
{
+#ifdef KWIN_BUILD_TABBOX
if (Workspace::self()->hasTabBox()) {
return Workspace::self()->tabBox()->currentDesktopList();
}
+#endif
return QList< int >();
}
int EffectsHandlerImpl::currentTabBoxDesktop() const
{
+#ifdef KWIN_BUILD_TABBOX
if (Workspace::self()->hasTabBox()) {
return Workspace::self()->tabBox()->currentDesktop();
}
+#endif
return -1;
}
EffectWindow* EffectsHandlerImpl::currentTabBoxWindow() const
{
+#ifdef KWIN_BUILD_TABBOX
if (Workspace::self()->hasTabBox()) {
if (Client* c = Workspace::self()->tabBox()->currentClient())
return c->effectWindow();
}
+#endif
return NULL;
}
diff --git a/events.cpp b/events.cpp
index 71d21f6b78..3353b25fc9 100644
--- a/events.cpp
+++ b/events.cpp
@@ -30,7 +30,9 @@ along with this program. If not, see .
#include "client.h"
#include "workspace.h"
#include "atoms.h"
+#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
+#endif
#include "group.h"
#include "rules.h"
#include "unmanaged.h"
@@ -242,10 +244,12 @@ bool Workspace::workspaceEvent(XEvent * e)
was_user_interaction = true;
// fallthrough
case MotionNotify:
+#ifdef KWIN_BUILD_TABBOX
if (tabBox()->isGrabbed()) {
tab_box->handleMouseEvent(e);
return true;
}
+#endif
if (effects && static_cast(effects)->checkInputWindowEvent(e))
return true;
break;
@@ -258,18 +262,22 @@ bool Workspace::workspaceEvent(XEvent * e)
movingClient->keyPressEvent(keyQt);
return true;
}
+#ifdef KWIN_BUILD_TABBOX
if (tabBox()->isGrabbed()) {
tabBox()->keyPress(keyQt);
return true;
}
+#endif
break;
}
case KeyRelease:
was_user_interaction = true;
+#ifdef KWIN_BUILD_TABBOX
if (tabBox()->isGrabbed()) {
tabBox()->keyRelease(e->xkey);
return true;
}
+#endif
break;
case ConfigureNotify:
if (e->xconfigure.event == rootWindow())
diff --git a/kcmkwin/CMakeLists.txt b/kcmkwin/CMakeLists.txt
index 86c2598ac8..f7e30c0a95 100644
--- a/kcmkwin/CMakeLists.txt
+++ b/kcmkwin/CMakeLists.txt
@@ -6,4 +6,7 @@ add_subdirectory( kwinrules )
add_subdirectory( kwincompositing )
add_subdirectory( kwinscreenedges )
add_subdirectory( kwindesktop )
+
+if( KWIN_BUILD_TABBOX )
add_subdirectory( kwintabbox )
+endif( KWIN_BUILD_TABBOX )
diff --git a/tabbox.cpp b/tabbox.cpp
index 591e427884..c4d5c7cc81 100644
--- a/tabbox.cpp
+++ b/tabbox.cpp
@@ -38,6 +38,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
#include
#include
@@ -46,7 +47,6 @@ along with this program. If not, see .
#include
#include
#include "outline.h"
-#include
// specify externals before namespace
@@ -274,8 +274,8 @@ int TabBoxClientImpl::height() const
/*********************************************************
* TabBox
*********************************************************/
-TabBox::TabBox()
- : QObject()
+TabBox::TabBox(QObject *parent)
+ : QObject(parent)
, m_displayRefcount(0)
, m_forcedGlobalMouseGrab(false)
, m_desktopGrab(false)
diff --git a/tabbox.h b/tabbox.h
index 0461ff5063..f83ae4507d 100644
--- a/tabbox.h
+++ b/tabbox.h
@@ -96,7 +96,7 @@ class TabBox : public QObject
{
Q_OBJECT
public:
- TabBox();
+ TabBox(QObject *parent = NULL);
~TabBox();
Client* currentClient();
diff --git a/useractions.cpp b/useractions.cpp
index 01ed81e806..387e4992b7 100644
--- a/useractions.cpp
+++ b/useractions.cpp
@@ -53,7 +53,9 @@ along with this program. If not, see .
#include
#include "killwindow.h"
+#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
+#endif
namespace KWin
{
@@ -557,9 +559,11 @@ void Workspace::initShortcuts()
//disable_shortcuts_keys->disableBlocking( true );
#define IN_KWIN
#include "kwinbindings.cpp"
+#ifdef KWIN_BUILD_TABBOX
if (tab_box) {
tab_box->initShortcuts(actionCollection);
}
+#endif
discardPopup(); // so that it's recreated next time
}
diff --git a/workspace.cpp b/workspace.cpp
index 444364ffc2..7c53b32390 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -45,7 +45,9 @@ along with this program. If not, see .
#include "client.h"
#include "tile.h"
+#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
+#endif
#include "desktopchangeosd.h"
#include "atoms.h"
#include "placement.h"
@@ -122,7 +124,9 @@ Workspace::Workspace(bool restore)
, was_user_interaction(false)
, session_saving(false)
, block_focus(0)
+#ifdef KWIN_BUILD_TABBOX
, tab_box(0)
+#endif
, desktop_change_osd(0)
, popup(0)
, advanced_popup(0)
@@ -208,8 +212,10 @@ Workspace::Workspace(bool restore)
Extensions::init();
compositingSuspended = !options->useCompositing;
+#ifdef KWIN_BUILD_TABBOX
// need to create the tabbox before compositing scene is setup
- tab_box = new TabBox::TabBox();
+ tab_box = new TabBox::TabBox(this);
+#endif
setupCompositing();
// Compatibility
@@ -476,7 +482,6 @@ Workspace::~Workspace()
it != unmanaged.constEnd();
++it)
(*it)->release();
- delete tab_box;
delete desktop_change_osd;
delete m_outline;
discardPopup();
@@ -587,8 +592,10 @@ void Workspace::addClient(Client* c, allowed_t)
if (c->isUtility() || c->isMenu() || c->isToolbar())
updateToolWindows(true);
checkNonExistentClients();
+#ifdef KWIN_BUILD_TABBOX
if (tabBox()->isGrabbed())
tab_box->reset(true);
+#endif
}
void Workspace::addUnmanaged(Unmanaged* c, allowed_t)
@@ -619,8 +626,10 @@ void Workspace::removeClient(Client* c, allowed_t)
if (c->isNormalWindow())
Notify::raise(Notify::Delete);
+#ifdef KWIN_BUILD_TABBOX
if (tabBox()->isGrabbed() && tabBox()->currentClient() == c)
tab_box->nextPrev(true);
+#endif
Q_ASSERT(clients.contains(c) || desktops.contains(c));
if (tilingEnabled() && tilingLayouts.value(c->desktop())) {
@@ -656,8 +665,10 @@ void Workspace::removeClient(Client* c, allowed_t)
updateCompositeBlocking();
+#ifdef KWIN_BUILD_TABBOX
if (tabBox()->isGrabbed())
tab_box->reset(true);
+#endif
updateClientArea();
}
@@ -910,7 +921,9 @@ void Workspace::slotReconfigure()
KGlobal::config()->reparseConfiguration();
unsigned long changed = options->updateSettings();
+#ifdef KWIN_BUILD_TABBOX
tab_box->reconfigure();
+#endif
desktop_change_osd->reconfigure();
initPositioning->reinitCascading(0);
discardPopup();
@@ -1080,7 +1093,11 @@ QStringList Workspace::configModules(bool controlCenter)
args << "kwinoptions";
else if (KAuthorized::authorizeControlModule("kde-kwinoptions.desktop"))
args << "kwinactions" << "kwinfocus" << "kwinmoving" << "kwinadvanced"
- << "kwinrules" << "kwincompositing" << "kwintabbox" << "kwinscreenedges";
+ << "kwinrules" << "kwincompositing"
+#ifdef KWIN_BUILD_TABBOX
+ << "kwintabbox"
+#endif
+ << "kwinscreenedges";
return args;
}
@@ -2081,6 +2098,21 @@ ScreenEdge* Workspace::screenEdge()
return &m_screenEdge;
}
+bool Workspace::hasTabBox() const
+{
+#ifdef KWIN_BUILD_TABBOX
+ return (tab_box != NULL);
+#else
+ return false;
+#endif
+}
+
+#ifdef KWIN_BUILD_TABBOX
+TabBox::TabBox* Workspace::tabBox() const
+{
+ return tab_box;
+}
+#endif
} // namespace
diff --git a/workspace.h b/workspace.h
index 7bd237b16f..3604b3128b 100644
--- a/workspace.h
+++ b/workspace.h
@@ -42,7 +42,6 @@ along with this program. If not, see .
#include "sm.h"
#include
-#include "tabbox.h"
// TODO: Cleanup the order of things in this .h file
@@ -60,10 +59,12 @@ class QPushButton;
namespace KWin
{
+#ifdef KWIN_BUILD_TABBOX
namespace TabBox
{
class TabBox;
}
+#endif
class Client;
class Tile;
@@ -349,12 +350,11 @@ public:
}
// Tab box
- TabBox::TabBox *tabBox() const {
- return tab_box;
- }
- bool hasTabBox() const {
- return tab_box != NULL;
- }
+#ifdef KWIN_BUILD_TABBOX
+ TabBox::TabBox *tabBox() const;
+#endif
+ bool hasTabBox() const;
+
const QVector &desktopFocusChain() const {
return desktop_focus_chain;
}
@@ -847,7 +847,9 @@ private:
int block_focus;
+#ifdef KWIN_BUILD_TABBOX
TabBox::TabBox* tab_box;
+#endif
DesktopChangeOSD* desktop_change_osd;
QMenu* popup;