The I/O intensive reading of the complete KWin Script
file into a QByteArray is moved into a thread.
Evaluating and setting up the script engine is still
performed in the main thread.
REVIEW: 104782
Searching for the scripts to load is performed in an own
thread including unloading of already loaded scripts which
no longer should be loaded.
To ensure that two threads are not trying to load/unload
at the same time a mutex is added to protect the list of
loaded scripts.
REVIEW: 104768
A global method "registerShortcut" is exported to the scripts which
can be used to register a callback to be called when the global
shortcut is triggered.
The shared code between Scripts and Effects is moved into template
functions defined in a new file scriptingutils.h.
REVIEW: 104400
Whenever the KWin configuration is changed, scripting has to unload
scripts no longer loaded and load the scripts which have been added.
For this new methods are introduced to check whether the script is
loaded.
REVIEW: 104037
New global method readConfig is exported to QtScript and declarative scripts.
Config is read from a config group stored in kwinrc called "Script-<pluginname>".
For this the ctors of the AbstractScript and derived classes are changed to also
take the pluginname.
For this the Script class is slightly refactored to have a common
base for JavaScript and QML based scripts.
Why QML bindings? This allows to use QML for example for the
desktop change OSD or for fullscreen effects like Present Windows.
Scripts are found by the KServiceTypeTrader and can now be
enabled/disabled. Loading of config is currently disabled. Will
be made available again after scripted effects are merged.
Unlike stated at several places in the code it is not difficult to
setup the connections to all Clients.
It would have been nice if the failed attempts to connect the Clients
would not have made it into the code as emitted signals which are
nowhere used. Not to mention that like in all places the signals to
inform that a state changed were emitted before the state changed was
performed.
Each KWin Script is also exported as a D-Bus object and can be
stopped (destroyed) and started through D-Bus. Output and errors
are emitted as D-Bus signals. That allows external applications
(e.g. Plasma desktop scripting console) to load a script and print
out the output.
The general interface is exported as /Scripting and allows to load
a new script by file. The script is not directly executed but only
loaded. To execute it the run method on the script object has to be
invoked.
Every disorder causes every duration, which ensures the one that stays.
reality is relative. natural is disorder.
[R]obinhood[P]andey
Merging scripting from
^/branches/work/kwin_scripting TO
^/trunk
svn path=/trunk/KDE/kdebase/workspace/; revision=1177865