From d8daff5162182fa54ffbbc2fc4a1ea7b180698ff Mon Sep 17 00:00:00 2001 From: Rohan Ramdas Prabhu Date: Mon, 31 May 2010 21:24:40 +0000 Subject: [PATCH] In this commit, the following files are updated: main.cpp : Added a command argument. If 'stest' is set, then a testing environment is setup which is used to test scripting for kwin. Currently, the test setup only consists of loading a default script, but in the feature it is expected to run a small text editor kind of thing for testing. Usage: kwin --stest CMakeLists.txt : Add the files corresponding to kwin_scripting the main intention of which is to provide scripting support for kwin. kwintabbox.desktop : An unintentional edit. Mostly harmless. svn path=/trunk/KDE/kdebase/workspace/; revision=1133002 --- CMakeLists.txt | 7 ++++++- main.cpp | 24 ++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04d057755c..d5d30a031a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,11 @@ set(kwin_KDEINIT_SRCS tiling.cpp tilinglayout.cpp tilinglayoutfactory.cpp + + #load the scripting related functions + scripttesting.cpp + scripting/scripting.cpp + scripting/workspace.cpp # tiling layouts # spiral @@ -130,7 +135,7 @@ qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWin::Works kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS}) -target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTXML_LIBRARY} kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES}) +target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTXML_LIBRARY} ${QT_QTSCRIPT_LIBRARY} kephal kworkspace kdecorations kwineffects ${X11_LIBRARIES}) if(OPENGL_FOUND) add_subdirectory(opengltest) diff --git a/main.cpp b/main.cpp index d97dbcf7e5..f160f067b3 100644 --- a/main.cpp +++ b/main.cpp @@ -40,6 +40,11 @@ along with this program. If not, see . #include #include +#include +#include +#include "scripttesting.h" +#include "scripting/scripting.h" + #include #include #include @@ -53,6 +58,7 @@ along with this program. If not, see . #include "sm.h" #include "utils.h" #include "effects.h" +#include #define INT8 _X11INT8 #define INT32 _X11INT32 @@ -487,8 +493,11 @@ 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" )); + args.add( "stest", ki18n( "Load the script testing dialog" )); KCmdLineArgs::addCmdLineOptions( args ); - + + ScriptTesting* stestWindow; + if( KDE_signal( SIGTERM, KWin::sighandler ) == SIG_IGN ) KDE_signal( SIGTERM, SIG_IGN ); if( KDE_signal( SIGINT, KWin::sighandler ) == SIG_IGN ) @@ -503,6 +512,7 @@ KDE_EXPORT int kdemain( int argc, char * argv[] ) KWin::SessionManager weAreIndeed; KWin::SessionSaveDoneHelper helper; KGlobal::locale()->insertCatalog( "kwin_effects" ); + KWin::Scripting scripting; // Announce when KWIN_DIRECT_GL is set for above HACK if( qstrcmp( qgetenv( "KWIN_DIRECT_GL" ), "1" ) == 0 ) @@ -518,8 +528,18 @@ KDE_EXPORT int kdemain( int argc, char * argv[] ) QDBusConnection::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService ); + + KCmdLineArgs* sargs = KCmdLineArgs::parsedArgs(); + + if(sargs->isSet("stest")) { + stestWindow = new ScriptTesting(); + stestWindow->setEngine(&scripting); + stestWindow->runDefault(); + //QEvent* showSTest = new QEvent(QEvent::Type(QEvent::User + 7)); + //a.postEvent(stestWindow, showSTest, INT_MIN); + } return a.exec(); - } +} #include "main.moc"