Adding a build option for KWin Scripting
It is possible that adding this build option broke the Scripting component. This is something that should not happen. Unfortunately by just ifdefing everything scripting related with scripting enabled we have build errors. These are caused by the fact that the scripting code includes e.g. client.h through "./../client.h". At one offending place I changed that to "client.h", but there is also a client.h in the scripting directory. The includes and naming of the scripting files clearly have to be fixed!
This commit is contained in:
parent
062b117919
commit
32a82141f0
9 changed files with 66 additions and 15 deletions
|
@ -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_MOBILE_EFFECTS "Only build effects relevant for mobile devices" OFF)
|
||||||
OPTION(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" 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_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_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
|
||||||
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
|
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_KCMS OFF)
|
||||||
set(KWIN_BUILD_TABBOX OFF)
|
set(KWIN_BUILD_TABBOX OFF)
|
||||||
set(KWIN_BUILD_SCREENEDGES OFF)
|
set(KWIN_BUILD_SCREENEDGES OFF)
|
||||||
|
set(KWIN_BUILD_SCRIPTING OFF)
|
||||||
set(KWIN_BUILD_XRENDER_COMPOSITING OFF)
|
set(KWIN_BUILD_XRENDER_COMPOSITING OFF)
|
||||||
set(KWIN_MOBILE_EFFECTS ON)
|
set(KWIN_MOBILE_EFFECTS ON)
|
||||||
set(KWIN_BUILD_WITH_OPENGLES ON)
|
set(KWIN_BUILD_WITH_OPENGLES ON)
|
||||||
|
@ -142,18 +144,6 @@ set(kwin_KDEINIT_SRCS
|
||||||
tilinglayout.cpp
|
tilinglayout.cpp
|
||||||
tilinglayoutfactory.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
|
# tiling layouts
|
||||||
# spiral
|
# spiral
|
||||||
#tilinglayouts/spiral/spiralfactory.cpp
|
#tilinglayouts/spiral/spiralfactory.cpp
|
||||||
|
@ -167,6 +157,22 @@ set(kwin_KDEINIT_SRCS
|
||||||
tilinglayouts/floating/floating.cpp
|
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)
|
if(KWIN_BUILD_TABBOX)
|
||||||
set(
|
set(
|
||||||
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
|
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})
|
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)
|
if(KWIN_BUILD_TABBOX)
|
||||||
target_link_libraries(kdeinit_kwin ${QT_QTXML_LIBRARY})
|
target_link_libraries(kdeinit_kwin ${QT_QTXML_LIBRARY})
|
||||||
|
|
10
client.cpp
10
client.cpp
|
@ -34,9 +34,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
#include "scripting/client.h"
|
#include "scripting/client.h"
|
||||||
#include "scripting/scripting.h"
|
#include "scripting/scripting.h"
|
||||||
#include "scripting/workspaceproxy.h"
|
#include "scripting/workspaceproxy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bridge.h"
|
#include "bridge.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
@ -136,7 +138,9 @@ Client::Client(Workspace* ws)
|
||||||
{
|
{
|
||||||
// TODO: Do all as initialization
|
// TODO: Do all as initialization
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
scriptCache = new QHash<QScriptEngine*, ClientResolution>();
|
scriptCache = new QHash<QScriptEngine*, ClientResolution>();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set the initial mapping state
|
// Set the initial mapping state
|
||||||
mapping_state = Withdrawn;
|
mapping_state = Withdrawn;
|
||||||
|
@ -228,7 +232,9 @@ Client::~Client()
|
||||||
#ifdef KWIN_BUILD_TABBOX
|
#ifdef KWIN_BUILD_TABBOX
|
||||||
delete m_tabBoxClient;
|
delete m_tabBoxClient;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
delete scriptCache;
|
delete scriptCache;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use destroyClient() or releaseWindow(), Client instances cannot be deleted directly
|
// Use destroyClient() or releaseWindow(), Client instances cannot be deleted directly
|
||||||
|
@ -915,6 +921,7 @@ void Client::minimize(bool avoid_animation)
|
||||||
if (!isMinimizable() || isMinimized())
|
if (!isMinimizable() || isMinimized())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
//Scripting call. Does not use a signal/slot mechanism
|
//Scripting call. Does not use a signal/slot mechanism
|
||||||
//as ensuring connections was a bit difficult between
|
//as ensuring connections was a bit difficult between
|
||||||
//so many clients and the workspace
|
//so many clients and the workspace
|
||||||
|
@ -922,6 +929,7 @@ void Client::minimize(bool avoid_animation)
|
||||||
if (ws_wrap != 0) {
|
if (ws_wrap != 0) {
|
||||||
ws_wrap->sl_clientMinimized(this);
|
ws_wrap->sl_clientMinimized(this);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
emit s_minimized();
|
emit s_minimized();
|
||||||
|
|
||||||
|
@ -950,10 +958,12 @@ void Client::unminimize(bool avoid_animation)
|
||||||
if (!isMinimized())
|
if (!isMinimized())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
SWrapper::WorkspaceProxy* ws_wrap = SWrapper::WorkspaceProxy::instance();
|
SWrapper::WorkspaceProxy* ws_wrap = SWrapper::WorkspaceProxy::instance();
|
||||||
if (ws_wrap != 0) {
|
if (ws_wrap != 0) {
|
||||||
ws_wrap->sl_clientUnminimized(this);
|
ws_wrap->sl_clientUnminimized(this);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
emit s_unminimized();
|
emit s_unminimized();
|
||||||
|
|
||||||
|
|
9
client.h
9
client.h
|
@ -35,8 +35,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <fixx11h.h>
|
#include <fixx11h.h>
|
||||||
|
|
||||||
|
// TODO: QScriptValue should be in the ifdef, but it breaks the build
|
||||||
#include <QScriptValue>
|
#include <QScriptValue>
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
#include "scripting/client.h"
|
#include "scripting/client.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -56,12 +59,14 @@ class QProcess;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class KStartupInfoData;
|
class KStartupInfoData;
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
namespace SWrapper
|
namespace SWrapper
|
||||||
{
|
{
|
||||||
class Client;
|
class Client;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef QPair<SWrapper::Client*, QScriptValue> ClientResolution;
|
typedef QPair<SWrapper::Client*, QScriptValue> ClientResolution;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -117,12 +122,14 @@ public:
|
||||||
bool isSpecialWindow() const;
|
bool isSpecialWindow() const;
|
||||||
bool hasNETSupport() const;
|
bool hasNETSupport() const;
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
/**
|
/**
|
||||||
* This is a public object with no wrappers or anything to keep it fast,
|
* 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
|
* so in essence, direct access is allowed. Please be very careful while
|
||||||
* using this object
|
* using this object
|
||||||
*/
|
*/
|
||||||
QHash<QScriptEngine*, ClientResolution>* scriptCache;
|
QHash<QScriptEngine*, ClientResolution>* scriptCache;
|
||||||
|
#endif
|
||||||
|
|
||||||
QSize minSize() const;
|
QSize minSize() const;
|
||||||
QSize maxSize() const;
|
QSize maxSize() const;
|
||||||
|
@ -711,7 +718,9 @@ private:
|
||||||
QuickTileMode electricMode;
|
QuickTileMode electricMode;
|
||||||
|
|
||||||
friend bool performTransiencyCheck();
|
friend bool performTransiencyCheck();
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
friend class SWrapper::Client;
|
friend class SWrapper::Client;
|
||||||
|
#endif
|
||||||
|
|
||||||
void checkActivities();
|
void checkActivities();
|
||||||
bool activitiesDefined; //whether the x property was actually set
|
bool activitiesDefined; //whether the x property was actually set
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
#cmakedefine KWIN_BUILD_DECORATIONS 1
|
#cmakedefine KWIN_BUILD_DECORATIONS 1
|
||||||
#cmakedefine KWIN_BUILD_TABBOX 1
|
#cmakedefine KWIN_BUILD_TABBOX 1
|
||||||
#cmakedefine KWIN_BUILD_SCREENEDGES 1
|
#cmakedefine KWIN_BUILD_SCREENEDGES 1
|
||||||
|
#cmakedefine KWIN_BUILD_SCRIPTING 1
|
||||||
|
|
|
@ -30,7 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
#include "scripting/workspaceproxy.h"
|
#include "scripting/workspaceproxy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <kapplication.h>
|
#include <kapplication.h>
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
|
@ -2063,6 +2065,7 @@ void Client::maximize(MaximizeMode m)
|
||||||
*/
|
*/
|
||||||
void Client::setMaximize(bool vertically, bool horizontally)
|
void Client::setMaximize(bool vertically, bool horizontally)
|
||||||
{
|
{
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
//Scripting call. Does not use a signal/slot mechanism
|
//Scripting call. Does not use a signal/slot mechanism
|
||||||
//as ensuring connections was a bit difficult between
|
//as ensuring connections was a bit difficult between
|
||||||
//so many clients and the workspace
|
//so many clients and the workspace
|
||||||
|
@ -2070,6 +2073,7 @@ void Client::setMaximize(bool vertically, bool horizontally)
|
||||||
if (ws_wrap != 0) {
|
if (ws_wrap != 0) {
|
||||||
ws_wrap->sl_clientMaximizeSet(this, QPair<bool, bool>(vertically, horizontally));
|
ws_wrap->sl_clientMaximizeSet(this, QPair<bool, bool>(vertically, horizontally));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
emit maximizeSet(QPair<bool, bool>(vertically, horizontally));
|
emit maximizeSet(QPair<bool, bool>(vertically, horizontally));
|
||||||
|
|
||||||
|
@ -2357,10 +2361,12 @@ void Client::setFullScreen(bool set, bool user)
|
||||||
updateWindowRules();
|
updateWindowRules();
|
||||||
workspace()->checkUnredirect();
|
workspace()->checkUnredirect();
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
SWrapper::WorkspaceProxy* ws_object = SWrapper::WorkspaceProxy::instance();
|
SWrapper::WorkspaceProxy* ws_object = SWrapper::WorkspaceProxy::instance();
|
||||||
if (ws_object != 0) {
|
if (ws_object != 0) {
|
||||||
ws_object->sl_clientFullScreenSet(this, set, user);
|
ws_object->sl_clientFullScreenSet(this, set, user);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
emit s_fullScreenSet(set, user);
|
emit s_fullScreenSet(set, user);
|
||||||
}
|
}
|
||||||
|
|
9
main.cpp
9
main.cpp
|
@ -42,7 +42,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
#include "scripting/scripting.h"
|
#include "scripting/scripting.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <kdialog.h>
|
#include <kdialog.h>
|
||||||
#include <kstandarddirs.h>
|
#include <kstandarddirs.h>
|
||||||
|
@ -469,7 +472,9 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
|
||||||
args.add("lock", ki18n("Disable configuration options"));
|
args.add("lock", ki18n("Disable configuration options"));
|
||||||
args.add("replace", ki18n("Replace already-running ICCCM2.0-compliant window manager"));
|
args.add("replace", ki18n("Replace already-running ICCCM2.0-compliant window manager"));
|
||||||
args.add("crashes <n>", ki18n("Indicate that KWin has recently crashed n times"));
|
args.add("crashes <n>", ki18n("Indicate that KWin has recently crashed n times"));
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
args.add("noscript", ki18n("Load the script testing dialog"));
|
args.add("noscript", ki18n("Load the script testing dialog"));
|
||||||
|
#endif
|
||||||
KCmdLineArgs::addCmdLineOptions(args);
|
KCmdLineArgs::addCmdLineOptions(args);
|
||||||
|
|
||||||
if (KDE_signal(SIGTERM, KWin::sighandler) == SIG_IGN)
|
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());
|
org::kde::KSMServerInterface ksmserver("org.kde.ksmserver", "/KSMServer", QDBusConnection::sessionBus());
|
||||||
ksmserver.suspendStartup("kwin");
|
ksmserver.suspendStartup("kwin");
|
||||||
KWin::Application a;
|
KWin::Application a;
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
KWin::Scripting scripting;
|
KWin::Scripting scripting;
|
||||||
|
#endif
|
||||||
|
|
||||||
ksmserver.resumeStartup("kwin");
|
ksmserver.resumeStartup("kwin");
|
||||||
KWin::SessionManager weAreIndeed;
|
KWin::SessionManager weAreIndeed;
|
||||||
|
@ -512,7 +519,9 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
|
||||||
appname, QDBusConnectionInterface::DontQueueService);
|
appname, QDBusConnectionInterface::DontQueueService);
|
||||||
|
|
||||||
KCmdLineArgs* sargs = KCmdLineArgs::parsedArgs();
|
KCmdLineArgs* sargs = KCmdLineArgs::parsedArgs();
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
scripting.start();
|
scripting.start();
|
||||||
|
#endif
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
#include "scripting/workspaceproxy.h"
|
#include "scripting/workspaceproxy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -46,6 +48,7 @@ bool Client::manage(Window w, bool isMapped)
|
||||||
{
|
{
|
||||||
StackingUpdatesBlocker stacking_blocker(workspace());
|
StackingUpdatesBlocker stacking_blocker(workspace());
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
//Scripting call. Does not use a signal/slot mechanism
|
//Scripting call. Does not use a signal/slot mechanism
|
||||||
//as ensuring connections was a bit difficult between
|
//as ensuring connections was a bit difficult between
|
||||||
//so many clients and the workspace
|
//so many clients and the workspace
|
||||||
|
@ -53,6 +56,7 @@ bool Client::manage(Window w, bool isMapped)
|
||||||
if (ws_wrap != 0) {
|
if (ws_wrap != 0) {
|
||||||
ws_wrap->sl_clientManaging(this);
|
ws_wrap->sl_clientManaging(this);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
grabXServer();
|
grabXServer();
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScriptEngine>
|
#include <QScriptEngine>
|
||||||
#include "./../client.h"
|
#include "client.h"
|
||||||
#include "./../clientgroup.h"
|
#include "clientgroup.h"
|
||||||
|
|
||||||
namespace SWrapper
|
namespace SWrapper
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "overlaywindow.h"
|
#include "overlaywindow.h"
|
||||||
#include "tilinglayout.h"
|
#include "tilinglayout.h"
|
||||||
|
|
||||||
|
#ifdef KWIN_BUILD_SCRIPTING
|
||||||
#include "scripting/scripting.h"
|
#include "scripting/scripting.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
Loading…
Reference in a new issue