From 2fb8fb1c2125bf332633494a5ff2c96681c17ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 26 Feb 2012 11:38:16 +0100 Subject: [PATCH] Introducing a build option for KActivities support REVIEW: 104100 --- CMakeLists.txt | 7 ++++++- activation.cpp | 2 ++ config-kwin.h.cmake | 1 + useractions.cpp | 4 ++++ workspace.cpp | 4 ++++ workspace.h | 11 ++++++++++- 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 463692dffb..192746773d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ OPTION(KWIN_BUILD_TILING "Enable building of KWin Tiling functionality" ON) OPTION(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON) OPTION(KWIN_BUILD_SCRIPTING "Enable building of KWin with scripting support" ON) OPTION(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON) +OPTION(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON) if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop") OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF) else(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop") @@ -173,12 +174,16 @@ qt4_add_dbus_interface( kwin_KDEINIT_SRCS qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc ) -set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${KACTIVITIES_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES} ${X11_Xrandr_LIB} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${X11_Xrender_LIB} ${X11_Xfixes_LIB}) +set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} kdeclarative kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES} ${X11_Xrandr_LIB} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB} ${X11_Xrender_LIB} ${X11_Xfixes_LIB}) if(KWIN_BUILD_SCRIPTING) set(kwinLibs ${kwinLibs} ${QT_QTSCRIPT_LIBRARY}) endif(KWIN_BUILD_SCRIPTING) +if(KWIN_BUILD_ACTIVITIES) + set(kwinLibs ${kwinLibs} ${KACTIVITIES_LIBRARY}) +endif(KWIN_BUILD_ACTIVITIES) + kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS}) target_link_libraries(kdeinit_kwin ${kwinLibs}) diff --git a/activation.cpp b/activation.cpp index 91b1a1b755..5779f76781 100644 --- a/activation.cpp +++ b/activation.cpp @@ -284,12 +284,14 @@ void Workspace::activateClient(Client* c, bool force) setCurrentDesktop(c->desktop()); --block_focus; } +#ifdef KWIN_BUILD_ACTIVITIES if (!c->isOnCurrentActivity()) { ++block_focus; //DBUS! activityController_.setCurrentActivity(c->activities().first()); //first isn't necessarily best, but it's easiest --block_focus; } +#endif if (c->isMinimized()) c->unminimize(); diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake index 8893fa49a5..49b643ac09 100644 --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -4,3 +4,4 @@ #cmakedefine KWIN_BUILD_DESKTOPCHANGEOSD 1 #cmakedefine KWIN_BUILD_SCREENEDGES 1 #cmakedefine KWIN_BUILD_SCRIPTING 1 +#cmakedefine KWIN_BUILD_ACTIVITIES 1 diff --git a/useractions.cpp b/useractions.cpp index 120481bfb1..09e18c3d06 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -40,7 +40,9 @@ along with this program. If not, see . #include "tiling/tiling.h" #endif +#ifdef KWIN_BUILD_ACTIVITIES #include +#endif #include #include @@ -494,6 +496,7 @@ void Workspace::activityPopupAboutToShow() if (!activity_popup) return; +#ifdef KWIN_BUILD_ACTIVITIES activity_popup->clear(); QAction *action = activity_popup->addAction(i18n("&All Activities")); action->setData(QString()); @@ -515,6 +518,7 @@ void Workspace::activityPopupAboutToShow() !active_popup_client->isOnAllActivities() && active_popup_client->isOnActivity(id)) action->setChecked(true); } +#endif } void Workspace::closeActivePopup() diff --git a/workspace.cpp b/workspace.cpp index 5542a3d058..c6819630a2 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -246,9 +246,11 @@ Workspace::Workspace(bool restore) connect(Kephal::Screens::self(), SIGNAL(screenResized(Kephal::Screen*,QSize,QSize)), &screenChangedTimer, SLOT(start())); connect(Kephal::Screens::self(), SIGNAL(screenMoved(Kephal::Screen*,QPoint,QPoint)), &screenChangedTimer, SLOT(start())); +#ifdef KWIN_BUILD_ACTIVITIES connect(&activityController_, SIGNAL(currentActivityChanged(QString)), SLOT(updateCurrentActivity(QString))); connect(&activityController_, SIGNAL(activityRemoved(QString)), SLOT(activityRemoved(QString))); connect(&activityController_, SIGNAL(activityAdded(QString)), SLOT(activityAdded(QString))); +#endif connect(&screenChangedTimer, SIGNAL(timeout()), SLOT(screenChangeTimeout())); screenChangedTimer.setSingleShot(true); @@ -379,8 +381,10 @@ void Workspace::init() } if (!setCurrentDesktop(initial_desktop)) setCurrentDesktop(1); +#ifdef KWIN_BUILD_ACTIVITIES allActivities_ = activityController_.listActivities(); updateCurrentActivity(activityController_.currentActivity()); +#endif // Now we know how many desktops we'll have, thus we initialize the positioning object initPositioning = new Placement(this); diff --git a/workspace.h b/workspace.h index 1c6a8317e5..2e400ea891 100644 --- a/workspace.h +++ b/workspace.h @@ -32,10 +32,13 @@ along with this program. If not, see . #include #include +// need to include utils.h before we use the ifdefs +#include "utils.h" +#ifdef KWIN_BUILD_ACTIVITIES #include +#endif #include "plugins.h" -#include "utils.h" #include "kdecoration.h" #include "kdecorationfactory.h" #ifdef KWIN_BUILD_SCREENEDGES @@ -305,7 +308,9 @@ private: QString activity_; QStringList allActivities_; +#ifdef KWIN_BUILD_ACTIVITIES KActivities::Controller activityController_; +#endif #ifdef KWIN_BUILD_TILING Tiling* m_tiling; @@ -332,7 +337,11 @@ public: return allActivities_; } QStringList openActivityList() const { +#ifdef KWIN_BUILD_ACTIVITIES return activityController_.listActivities(KActivities::Info::Running); +#else + return QStringList(); +#endif } // True when performing Workspace::updateClientArea().