Commit graph

340 commits

Author SHA1 Message Date
Martin Gräßlin
6185bf00d3 Export useraction slots to scripting
All slots not requiring to be triggered from a QAction are exported.
This means that switchToDesktop is not exported but also not required,
as we have this through the properties.

Needs documentation...
2012-01-27 07:35:40 +01:00
Martin Gräßlin
651a0cca47 Export clientArea methods to scripting
For this a new MetaObject "KWin" is exported to have the
enum ClientAreaOption available in scripts. Unfortunately this
requires duplicating the enum from kwinglobals.h.
2012-01-26 22:56:24 +01:00
Martin Gräßlin
cf5b70bd2c Export displayWidth/height/size as properties of workspace 2012-01-26 16:53:07 +01:00
Martin Gräßlin
55088ba776 Remove repetitive code in WorkspaceWrapper 2012-01-26 08:37:38 +01:00
Martin Gräßlin
26d069981d Add property for number of desktops to scripting
Adding macros to define the wraping code.
2012-01-26 08:37:25 +01:00
Martin Gräßlin
0dbfdf4979 Simplify the Timer in scripting
Properties are already available thanks to QObject: no need to
export them again. Dropping the toString method allows to remove
the plasma-backportglobal.h file for which Krazy had many complains.
2012-01-22 13:02:34 +01:00
Martin Gräßlin
20d8d727ca Rename SWrapper::Workspace to KWin::WorkspaceWrapper
Resolves the problem of having two workspace.(h|cpp). The scripting
workspace is in fact just a wrapper, so having that clear is a plus.
2012-01-22 12:38:03 +01:00
Martin Gräßlin
03e892fcc9 Workspace Wrapper uses Q_PROPERTIES
The idea is to extend the wrapper to have it wrapping even more
functions provided by Workspace. Of course it would be possible to
just add the properties to Workspace itself and export this. But I
think complete Workspace is just too powerful to fully expose to
scripts. So a small wrapper around the parts which are usefull for
scripts might make more sense.

This breaks now also the API for Workspace and again it is already
more powerful with less code than before.
2012-01-21 17:48:07 +01:00
Martin Gräßlin
507ff411d6 Drop the WorkspaceProxy in Scripting
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.
2012-01-21 10:51:22 +01:00
Martin Gräßlin
49b24e4940 Clean-up Scripting Wrapper for Workspace
No need to manually convert everything to script values.
2012-01-21 10:04:47 +01:00
Martin Gräßlin
4f54cd95ee Fix singleton creation of WorkspaceProxy
What in scripting does actually work in the way it is supposed to
work?
2012-01-20 16:34:57 +01:00
Martin Gräßlin
a04cb2ed09 Drop also the IMPLIST as it is outdated 2012-01-01 15:06:45 +01:00
Martin Gräßlin
197658475b Make List of Clients in ClientGroup accessable in scripts
For that ClientList is exported as a sequence meta type and
property is added to ClientGroup.
2012-01-01 15:01:54 +01:00
Martin Gräßlin
698eb631cd ClientGroup becomes scriptable (again)
For this properties are defined in ClientGroup and several methods
are changed to be slots (to be invokable from scripts). On Client
the clientGroup is exported as a property.

The existing wrapper around ClientGroup is dropped as it is no
longer needed. Interestingly it was wrong anyway as it allowed to
construct a new ClientGroup, which has to be done internally.

At the same time the meta declarations get cleaned up a little bit.
2012-01-01 14:43:32 +01:00
Martin Gräßlin
30d2f260dc Drop unused code 2012-01-01 13:26:15 +01:00
Martin Gräßlin
510a07a135 Better set the QScript export of a Client
We don't want the script to delete our Client, or do we?
2012-01-01 10:00:13 +01:00
Martin Gräßlin
d00655fbcc Use single quoted char instead of double qouted
Fixes Krazy issu "Check single-char QString operations for efficiency".
SVN_SILENT
2012-01-01 09:19:46 +01:00
Martin Gräßlin
aecaaeb48e Drop another leftover of Chelate 2012-01-01 09:16:40 +01:00
Martin Gräßlin
2b434c3667 Drop WindowInfo JavaScript bindings
Everything they provided are also available directly as properties
on Toplevel or Client.
2011-12-31 14:24:32 +01:00
Martin Gräßlin
1953deab15 Drop "Chelate"
Whatever it was, we cannot need a "Lazy Logic (TM)" which is not
documented. And even if it were useful, KWin is not the right place
to develop language extensions to ECMAScript.
2011-12-31 14:22:22 +01:00
Martin Gräßlin
ab253cd178 Scripting meets D-Bus
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.
2011-12-31 13:41:00 +01:00
Martin Gräßlin
0420ecd649 Scripting does not need to inherit ScriptEngine 2011-12-31 13:41:00 +01:00
Martin Gräßlin
c56e70ca7c Make Script a proper class 2011-12-31 13:40:59 +01:00
Martin Gräßlin
716a38cdb4 Making the geometry mapping work 2011-12-31 08:58:43 +01:00
Martin Gräßlin
f47e7bb5ef KWin scripting goes properties
Dropping the wrapper around Client and just exporting the Client's
properties. This breaks all existing scripts as it's now e.g.:
client.caption
instead of
client.caption()

But the first one is the more natural one for JavaScript and also
for everyone writing QML as well.

Setters and signals are mostly still missing in client. Other parts
like ClientGroup must be converted to properties, too.
2011-12-31 08:58:40 +01:00
Martin Gräßlin
e320435eaa Scripting API moved to techbase
http://techbase.kde.org/Development/Tutorials/KWin/Scripting/API

So no need any more for the API doc generator nobody knew about.
2011-12-17 08:53:41 +01:00
Montel Laurent
62c5a5e276 normalize signal/slots 2011-08-17 23:51:55 +02:00
Martin Gräßlin
32a82141f0 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!
2011-07-10 10:48:25 +02:00
Martin Gräßlin
0a7e48f7aa KWin uses kdelibs coding style. 2011-01-31 20:07:03 +01:00
Martin Gräßlin
fd09961b8e Fix Krazy issues in scripting.
Let's start the new year with some good deeds and improve the code quality.
SVN_SILENT

svn path=/trunk/KDE/kdebase/workspace/; revision=1210594
2011-01-01 09:37:08 +00:00
André Wöbbeking
ea80dd8867 -pedantic
svn path=/trunk/KDE/kdebase/workspace/; revision=1205832
2010-12-12 18:22:09 +00:00
Rohan Ramdas Prabhu
b66cb70d34 Added:
workspace.clientSetKeepAbove
client.onSetKeepAbove

Documentation updated. Please refer to kwsapi.html for more details.

svn path=/trunk/KDE/kdebase/workspace/; revision=1191158
2010-10-29 19:06:54 +00:00
Pavel Heimlich
7da91a552a Qt macros should not be followed by ;. Fix build with Sun Studio.
svn path=/trunk/KDE/kdebase/workspace/; revision=1188803
2010-10-23 07:02:17 +00:00
Rohan Ramdas Prabhu
481af628f4 Fixed docs.
svn path=/trunk/KDE/kdebase/workspace/; revision=1180330
2010-09-27 17:32:36 +00:00
Rohan Ramdas Prabhu
1033a5a028 Fixed the API docs.
svn path=/trunk/KDE/kdebase/workspace/; revision=1180328
2010-09-27 17:30:57 +00:00
Rohan Ramdas Prabhu
a99947fdc7 IMPLIST is no longer maintained. Please refer to scripting/apidocs.xml
or scripting/apidocs.html for documentation.

svn path=/trunk/KDE/kdebase/workspace/; revision=1180322
2010-09-27 17:24:31 +00:00
Rohan Ramdas Prabhu
28527176d6 Added the following methods:
client.keepAbove
client.keepBelow
client.setKeepAbove
client.setKeepBelow

For more information on the abovementioned methods, please refer to
scripting/apidocs.xml.

These were added in a response to a feature suggestion from Eike Hein.
Thanks a lot Eike :)

svn path=/trunk/KDE/kdebase/workspace/; revision=1180319
2010-09-27 17:20:52 +00:00
Rohan Ramdas Prabhu
49b61f604c Added fancy documentation in HTML format and a custom XML format, and
also a small conversion program (it's not small and it's horribly ugly,
but it works under 5ms :) ).

svn path=/trunk/KDE/kdebase/workspace/; revision=1180045
2010-09-26 20:35:44 +00:00
Rohan Ramdas Prabhu
2b40492bea Deleted property svnmerge-integrated.
A non-void function, Chelate::equivGen was reaching the end of function
without a return value, which could cause a segmentation fault. FIXED.

svn path=/trunk/KDE/kdebase/workspace/; revision=1177875
2010-09-21 14:48:17 +00:00
Rohan Ramdas Prabhu
2aec750ebf Trembles the weave as the clock ticks, attain another microstate.
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
2010-09-21 14:31:40 +00:00