diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88927c9f94..7d6ea520b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@ 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)
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_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
@@ -13,6 +14,7 @@ if(KWIN_PLASMA_ACTIVE)
set(KWIN_BUILD_KCMS OFF)
set(KWIN_BUILD_TABBOX OFF)
set(KWIN_BUILD_SCREENEDGES OFF)
+ set(KWIN_BUILD_SCRIPTING OFF)
set(KWIN_BUILD_XRENDER_COMPOSITING OFF)
set(KWIN_MOBILE_EFFECTS ON)
set(KWIN_BUILD_WITH_OPENGLES ON)
@@ -142,18 +144,6 @@ set(kwin_KDEINIT_SRCS
tilinglayout.cpp
tilinglayoutfactory.cpp
- #load the scripting related functions
- scripting/scripting.cpp
- scripting/workspace.cpp
- scripting/client.cpp
- scripting/meta.cpp
- scripting/toplevel.cpp
- scripting/windowinfo.cpp
- scripting/s_clientgroup.cpp
- scripting/workspaceproxy.cpp
- scripting/chelate.cpp
- scripting/timer.cpp
-
# tiling layouts
# spiral
#tilinglayouts/spiral/spiralfactory.cpp
@@ -167,6 +157,22 @@ set(kwin_KDEINIT_SRCS
tilinglayouts/floating/floating.cpp
)
+if(KWIN_BUILD_SCRIPTING)
+ set(
+ kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
+ scripting/scripting.cpp
+ scripting/workspace.cpp
+ scripting/client.cpp
+ scripting/meta.cpp
+ scripting/toplevel.cpp
+ scripting/windowinfo.cpp
+ scripting/s_clientgroup.cpp
+ scripting/workspaceproxy.cpp
+ scripting/chelate.cpp
+ scripting/timer.cpp
+ )
+endif(KWIN_BUILD_SCRIPTING)
+
if(KWIN_BUILD_TABBOX)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
@@ -198,7 +204,11 @@ qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
-target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTSCRIPT_LIBRARY} kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES})
+target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES})
+
+if(KWIN_BUILD_SCRIPTING)
+ target_link_libraries(kdeinit_kwin ${QT_QTSCRIPT_LIBRARY})
+endif(KWIN_BUILD_SCRIPTING)
if(KWIN_BUILD_TABBOX)
target_link_libraries(kdeinit_kwin ${QT_QTXML_LIBRARY})
diff --git a/client.cpp b/client.cpp
index 03b9280a4d..25c738ae6b 100644
--- a/client.cpp
+++ b/client.cpp
@@ -34,9 +34,11 @@ along with this program. If not, see .
#include
#include
+#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/client.h"
#include "scripting/scripting.h"
#include "scripting/workspaceproxy.h"
+#endif
#include "bridge.h"
#include "group.h"
@@ -136,7 +138,9 @@ Client::Client(Workspace* ws)
{
// TODO: Do all as initialization
+#ifdef KWIN_BUILD_SCRIPTING
scriptCache = new QHash();
+#endif
// Set the initial mapping state
mapping_state = Withdrawn;
@@ -228,7 +232,9 @@ Client::~Client()
#ifdef KWIN_BUILD_TABBOX
delete m_tabBoxClient;
#endif
+#ifdef KWIN_BUILD_SCRIPTING
delete scriptCache;
+#endif
}
// Use destroyClient() or releaseWindow(), Client instances cannot be deleted directly
@@ -915,6 +921,7 @@ void Client::minimize(bool avoid_animation)
if (!isMinimizable() || isMinimized())
return;
+#ifdef KWIN_BUILD_SCRIPTING
//Scripting call. Does not use a signal/slot mechanism
//as ensuring connections was a bit difficult between
//so many clients and the workspace
@@ -922,6 +929,7 @@ void Client::minimize(bool avoid_animation)
if (ws_wrap != 0) {
ws_wrap->sl_clientMinimized(this);
}
+#endif
emit s_minimized();
@@ -950,10 +958,12 @@ void Client::unminimize(bool avoid_animation)
if (!isMinimized())
return;
+#ifdef KWIN_BUILD_SCRIPTING
SWrapper::WorkspaceProxy* ws_wrap = SWrapper::WorkspaceProxy::instance();
if (ws_wrap != 0) {
ws_wrap->sl_clientUnminimized(this);
}
+#endif
emit s_unminimized();
diff --git a/client.h b/client.h
index 320744441f..6181ef3777 100644
--- a/client.h
+++ b/client.h
@@ -35,8 +35,11 @@ along with this program. If not, see .
#include
#include
+// TODO: QScriptValue should be in the ifdef, but it breaks the build
#include
+#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/client.h"
+#endif
#include "utils.h"
#include "options.h"
@@ -56,12 +59,14 @@ class QProcess;
class QTimer;
class KStartupInfoData;
+#ifdef KWIN_BUILD_SCRIPTING
namespace SWrapper
{
class Client;
}
typedef QPair ClientResolution;
+#endif
namespace KWin
{
@@ -117,12 +122,14 @@ public:
bool isSpecialWindow() const;
bool hasNETSupport() const;
+#ifdef KWIN_BUILD_SCRIPTING
/**
* This is a public object with no wrappers or anything to keep it fast,
* so in essence, direct access is allowed. Please be very careful while
* using this object
*/
QHash* scriptCache;
+#endif
QSize minSize() const;
QSize maxSize() const;
@@ -711,7 +718,9 @@ private:
QuickTileMode electricMode;
friend bool performTransiencyCheck();
+#ifdef KWIN_BUILD_SCRIPTING
friend class SWrapper::Client;
+#endif
void checkActivities();
bool activitiesDefined; //whether the x property was actually set
diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake
index b279ad8bc7..a291859500 100644
--- a/config-kwin.h.cmake
+++ b/config-kwin.h.cmake
@@ -3,3 +3,4 @@
#cmakedefine KWIN_BUILD_DECORATIONS 1
#cmakedefine KWIN_BUILD_TABBOX 1
#cmakedefine KWIN_BUILD_SCREENEDGES 1
+#cmakedefine KWIN_BUILD_SCRIPTING 1
diff --git a/geometry.cpp b/geometry.cpp
index 40fd429dc8..04c7b9d567 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -30,7 +30,9 @@ along with this program. If not, see .
#include "client.h"
#include "workspace.h"
+#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/workspaceproxy.h"
+#endif
#include
#include
@@ -2063,6 +2065,7 @@ void Client::maximize(MaximizeMode m)
*/
void Client::setMaximize(bool vertically, bool horizontally)
{
+#ifdef KWIN_BUILD_SCRIPTING
//Scripting call. Does not use a signal/slot mechanism
//as ensuring connections was a bit difficult between
//so many clients and the workspace
@@ -2070,6 +2073,7 @@ void Client::setMaximize(bool vertically, bool horizontally)
if (ws_wrap != 0) {
ws_wrap->sl_clientMaximizeSet(this, QPair(vertically, horizontally));
}
+#endif
emit maximizeSet(QPair(vertically, horizontally));
@@ -2357,10 +2361,12 @@ void Client::setFullScreen(bool set, bool user)
updateWindowRules();
workspace()->checkUnredirect();
+#ifdef KWIN_BUILD_SCRIPTING
SWrapper::WorkspaceProxy* ws_object = SWrapper::WorkspaceProxy::instance();
if (ws_object != 0) {
ws_object->sl_clientFullScreenSet(this, set, user);
}
+#endif
emit s_fullScreenSet(set, user);
}
diff --git a/main.cpp b/main.cpp
index b92bee6f51..9b87b61750 100644
--- a/main.cpp
+++ b/main.cpp
@@ -42,7 +42,10 @@ along with this program. If not, see .
#include
#include
#include
+
+#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/scripting.h"
+#endif
#include
#include
@@ -469,7 +472,9 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
args.add("lock", ki18n("Disable configuration options"));
args.add("replace", ki18n("Replace already-running ICCCM2.0-compliant window manager"));
args.add("crashes ", ki18n("Indicate that KWin has recently crashed n times"));
+#ifdef KWIN_BUILD_SCRIPTING
args.add("noscript", ki18n("Load the script testing dialog"));
+#endif
KCmdLineArgs::addCmdLineOptions(args);
if (KDE_signal(SIGTERM, KWin::sighandler) == SIG_IGN)
@@ -489,7 +494,9 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
org::kde::KSMServerInterface ksmserver("org.kde.ksmserver", "/KSMServer", QDBusConnection::sessionBus());
ksmserver.suspendStartup("kwin");
KWin::Application a;
+#ifdef KWIN_BUILD_SCRIPTING
KWin::Scripting scripting;
+#endif
ksmserver.resumeStartup("kwin");
KWin::SessionManager weAreIndeed;
@@ -512,7 +519,9 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
appname, QDBusConnectionInterface::DontQueueService);
KCmdLineArgs* sargs = KCmdLineArgs::parsedArgs();
+#ifdef KWIN_BUILD_SCRIPTING
scripting.start();
+#endif
return a.exec();
}
diff --git a/manage.cpp b/manage.cpp
index dc631617ce..47c8814510 100644
--- a/manage.cpp
+++ b/manage.cpp
@@ -32,7 +32,9 @@ along with this program. If not, see .
#include "rules.h"
#include "group.h"
+#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/workspaceproxy.h"
+#endif
namespace KWin
{
@@ -46,6 +48,7 @@ bool Client::manage(Window w, bool isMapped)
{
StackingUpdatesBlocker stacking_blocker(workspace());
+#ifdef KWIN_BUILD_SCRIPTING
//Scripting call. Does not use a signal/slot mechanism
//as ensuring connections was a bit difficult between
//so many clients and the workspace
@@ -53,6 +56,7 @@ bool Client::manage(Window w, bool isMapped)
if (ws_wrap != 0) {
ws_wrap->sl_clientManaging(this);
}
+#endif
grabXServer();
diff --git a/scripting/s_clientgroup.h b/scripting/s_clientgroup.h
index 7b310ead6e..808113378f 100644
--- a/scripting/s_clientgroup.h
+++ b/scripting/s_clientgroup.h
@@ -23,8 +23,8 @@ along with this program. If not, see .
#include
#include
-#include "./../client.h"
-#include "./../clientgroup.h"
+#include "client.h"
+#include "clientgroup.h"
namespace SWrapper
{
diff --git a/workspace.cpp b/workspace.cpp
index 38651414f5..8cf5299e5a 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -62,7 +62,9 @@ along with this program. If not, see .
#include "overlaywindow.h"
#include "tilinglayout.h"
+#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/scripting.h"
+#endif
#include
#include