[kwin] Drop build option to build without scripting

Scripting has proved it's point of being useful so it's time to turn it
into a mandatory part of KWin.

Also I start to use features provided by Scripting in more and more
parts of KWin core (e.g. sharing QQmlEngine) which makes it in the
long to complicated to have a build option and ifdefs for it.

REVIEW: 116587
This commit is contained in:
Martin Gräßlin 2014-03-04 08:17:44 +01:00
parent d8ca2403a1
commit 4dff7888e3
7 changed files with 14 additions and 61 deletions

View file

@ -6,7 +6,6 @@ option(KWIN_BUILD_OXYGEN "Enable building of default decoration Oxygen" ON)
option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
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_KAPPMENU "Enable building of KWin with application menu support" ON)
option(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
option(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON)
@ -21,7 +20,6 @@ if(KWIN_PLASMA_ACTIVE)
set(KWIN_BUILD_DECORATIONS OFF)
set(KWIN_BUILD_KCMS OFF)
set(KWIN_BUILD_SCREENEDGES OFF)
set(KWIN_BUILD_SCRIPTING ON)
set(KWIN_BUILD_XRENDER_COMPOSITING OFF)
set(KWIN_BUILD_WITH_OPENGLES ON)
set(KWIN_NAME "kwinactive")
@ -92,10 +90,7 @@ add_subdirectory( data )
add_subdirectory( effects )
add_subdirectory( scripts )
add_subdirectory( tabbox )
if(KWIN_BUILD_SCRIPTING)
add_subdirectory(scripting)
endif()
add_subdirectory(scripting)
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1212)
@ -148,23 +143,17 @@ set(kwin_KDEINIT_SRCS
paintredirector.cpp
virtualdesktops.cpp
xcbutils.cpp
scripting/scripting.cpp
scripting/workspace_wrapper.cpp
scripting/meta.cpp
scripting/scriptedeffect.cpp
scripting/scriptingutils.cpp
scripting/timer.cpp
scripting/scripting_model.cpp
scripting/dbuscall.cpp
scripting/screenedgeitem.cpp
)
if(KWIN_BUILD_SCRIPTING)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
scripting/scripting.cpp
scripting/workspace_wrapper.cpp
scripting/meta.cpp
scripting/scriptedeffect.cpp
scripting/scriptingutils.cpp
scripting/timer.cpp
scripting/scripting_model.cpp
scripting/dbuscall.cpp
scripting/screenedgeitem.cpp
)
endif()
if(KWIN_BUILD_TABBOX)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
@ -241,6 +230,7 @@ set(kwin_QT_LIBS
Qt5::Concurrent
Qt5::DBus
Qt5::Quick
Qt5::Script
Qt5::X11Extras
)
@ -296,10 +286,6 @@ else()
add_definitions(-DKWIN_NO_XF86VM)
endif()
if(KWIN_BUILD_SCRIPTING)
set(kwin_QT_LIBS ${kwin_QT_LIBS} Qt5::Script)
endif()
if(KWIN_BUILD_ACTIVITIES)
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
endif()
@ -355,10 +341,8 @@ install( FILES kwin.notifyrc DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME} RENA
install( FILES org.kde.KWin.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
if( KWIN_BUILD_SCRIPTING )
# Install the KWin/WindowSwitcher service type
install( FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
endif()
# Install the KWin/Script service type
install( FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
ecm_install_icons( ${ICON_INSTALL_DIR} )

View file

@ -51,10 +51,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QDebug>
#include <QProcess>
#include <QStandardPaths>
#ifdef KWIN_BUILD_SCRIPTING
#include <QScriptEngine>
#include <QScriptProgram>
#endif
#include <QWhatsThis>
// XLib
#include <X11/extensions/sync.h>
@ -1753,7 +1751,6 @@ void Client::setCaption(const QString& _s, bool force)
if (!s[i].isPrint())
s[i] = QChar(u' ');
cap_normal = s;
#ifdef KWIN_BUILD_SCRIPTING
if (options->condensedTitle()) {
static QScriptEngine engine;
static QScriptProgram stripTitle;
@ -1776,7 +1773,6 @@ void Client::setCaption(const QString& _s, bool force)
args << _s << QString::fromUtf8(resourceName()) << QString::fromUtf8(resourceClass());
s = script.call(QScriptValue(), args).toString();
}
#endif
if (!force && s == cap_deco)
return;
cap_deco = s;

View file

@ -2,7 +2,6 @@
#cmakedefine KWIN_BUILD_TABBOX 1
#cmakedefine KWIN_BUILD_DESKTOPCHANGEOSD 1
#cmakedefine KWIN_BUILD_SCREENEDGES 1
#cmakedefine KWIN_BUILD_SCRIPTING 1
#cmakedefine KWIN_BUILD_KAPPMENU 1
#cmakedefine KWIN_BUILD_ACTIVITIES 1
#cmakedefine KWIN_BUILD_OXYGEN 1

View file

@ -39,9 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef KWIN_BUILD_SCREENEDGES
#include "screenedge.h"
#endif
#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/scriptedeffect.h"
#endif
#include "screens.h"
#include "thumbnailitem.h"
#include "virtualdesktops.h"
@ -1526,7 +1524,6 @@ Effect *EffectsHandlerImpl::loadBuiltInEffect(const QByteArray &name, bool check
bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *service)
{
#ifdef KWIN_BUILD_SCRIPTING
const KDesktopFile df(QStandardPaths::GenericDataLocation, QStringLiteral("kde5/services/") + service->entryPath());
const QString scriptName = df.desktopGroup().readEntry<QString>(QStringLiteral("X-Plasma-MainScript"), QString());
if (scriptName.isEmpty()) {
@ -1546,11 +1543,6 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi
effect_order.insert(service->property(QStringLiteral("X-KDE-Ordering")).toInt(), EffectPair(name, effect));
effectsChanged();
return true;
#else
Q_UNUSED(name)
Q_UNUSED(service)
return false;
#endif
}
void EffectsHandlerImpl::unloadEffect(const QString& name)

View file

@ -6,9 +6,7 @@ add_subdirectory( kwinrules )
if(KWIN_BUILD_SCREENEDGES)
add_subdirectory( kwinscreenedges )
endif()
if(KWIN_BUILD_SCRIPTING)
add_subdirectory( kwinscripts )
endif()
add_subdirectory( kwinscripts )
add_subdirectory( kwindesktop )
if( KWIN_BUILD_TABBOX )

View file

@ -39,10 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "effects.h"
#include "screens.h"
#include "virtualdesktops.h"
#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/scripting.h"
#endif
#ifdef KWIN_BUILD_ACTIVITIES
#include "activities.h"
@ -85,9 +82,7 @@ UserActionsMenu::UserActionsMenu(QObject *parent)
, m_activityMenu(NULL)
, m_addTabsMenu(NULL)
, m_switchToTabMenu(NULL)
#ifdef KWIN_BUILD_SCRIPTING
, m_scriptsMenu(NULL)
#endif
, m_resizeOperation(NULL)
, m_moveOperation(NULL)
, m_maximizeOperation(NULL)
@ -233,9 +228,7 @@ QStringList configModules(bool controlCenter)
#ifdef KWIN_BUILD_SCREENEDGES
<< QStringLiteral("kwinscreenedges")
#endif
#ifdef KWIN_BUILD_SCRIPTING
<< QStringLiteral("kwinscripts")
#endif
;
return args;
}
@ -374,9 +367,7 @@ void UserActionsMenu::discard()
m_activityMenu = NULL;
m_switchToTabMenu = NULL;
m_addTabsMenu = NULL;
#ifdef KWIN_BUILD_SCRIPTING
m_scriptsMenu = NULL;
#endif
}
void UserActionsMenu::menuAboutToShow()
@ -424,7 +415,6 @@ void UserActionsMenu::menuAboutToShow()
m_addTabsMenu = 0;
}
#ifdef KWIN_BUILD_SCRIPTING
// drop the existing scripts menu
delete m_scriptsMenu;
m_scriptsMenu = NULL;
@ -443,7 +433,6 @@ void UserActionsMenu::menuAboutToShow()
delete m_scriptsMenu;
m_scriptsMenu = NULL;
}
#endif
}
void UserActionsMenu::showHideActivityMenu()

View file

@ -49,9 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "screenedge.h"
#endif
#include "screens.h"
#ifdef KWIN_BUILD_SCRIPTING
#include "scripting/scripting.h"
#endif
#ifdef KWIN_BUILD_TABBOX
#include "tabbox.h"
#endif
@ -393,10 +391,7 @@ void Workspace::init()
if (new_active_client != NULL)
activateClient(new_active_client);
#ifdef KWIN_BUILD_SCRIPTING
Scripting::create(this);
#endif
// SELI TODO: This won't work with unreasonable focus policies,
// and maybe in rare cases also if the selected client doesn't