Provide build option for TabBox functionality

Since the TabBox functionality is not feasible for any platform KWin is
used on (e.g. tablet PCs), a build option is added to decide, if the
TabBox functionality should be build or not.

REVIEW: 101511

@Sebastian: Martin wanted me to let you know that it is now possible
to disable building Tabbox
CCMAIL: sebas@kde.org
This commit is contained in:
Arthur Arlt 2011-06-30 13:02:30 +02:00
parent d1b5d00129
commit 903bcb42fb
11 changed files with 113 additions and 25 deletions

View file

@ -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

View file

@ -48,7 +48,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "shadow.h"
#include "deleted.h"
#include "paintredirector.h"
#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
#endif
#include <X11/extensions/shape.h>
#include <QX11Info>
@ -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;
}

View file

@ -1,3 +1,4 @@
/* Define if you have libcaptury */
#cmakedefine HAVE_CAPTURY 1
#cmakedefine KWIN_BUILD_DECORATIONS 1
#cmakedefine KWIN_BUILD_TABBOX 1

View file

@ -28,7 +28,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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;
}

View file

@ -30,7 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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<EffectsHandlerImpl*>(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())

View file

@ -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 )

View file

@ -38,6 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KActionCollection>
#include <KConfig>
#include <KConfigGroup>
#include <KDE/KAction>
#include <KDebug>
#include <KLocale>
#include <kkeyserver.h>
@ -46,7 +47,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <X11/keysym.h>
#include <X11/keysymdef.h>
#include "outline.h"
#include <kaction.h>
// 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)

View file

@ -96,7 +96,7 @@ class TabBox : public QObject
{
Q_OBJECT
public:
TabBox();
TabBox(QObject *parent = NULL);
~TabBox();
Client* currentClient();

View file

@ -53,7 +53,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kaction.h>
#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
}

View file

@ -45,7 +45,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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

View file

@ -42,7 +42,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "sm.h"
#include <X11/Xlib.h>
#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<int> &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;