From 28527176d61d7181fce89cfe6415865375e38ba3 Mon Sep 17 00:00:00 2001 From: Rohan Ramdas Prabhu Date: Mon, 27 Sep 2010 17:20:52 +0000 Subject: [PATCH] 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 --- scripting/apidocs.xml | 47 +++++++++++++++++++++++------- scripting/client.cpp | 36 +++++++++++++++++++++++ scripting/client.h | 4 +++ scripting/kwsapi.html | 67 ++++++++++++++++++++++++++++++++++++------- 4 files changed, 132 insertions(+), 22 deletions(-) diff --git a/scripting/apidocs.xml b/scripting/apidocs.xml index 177136c30f..b369723614 100644 --- a/scripting/apidocs.xml +++ b/scripting/apidocs.xml @@ -252,57 +252,82 @@ - Returns (true) of the client is shaded, (false) otherwise. + Returns (true) if the client is shaded, (false) otherwise. - Returns (true) of the client is shadeable (can be shaded), (false) otherwise. + Returns (true) if the client is shadeable (can be shaded), (false) otherwise. - Returns (true) of the client is minimized, (false) otherwise. + Returns (true) if the client is minimized, (false) otherwise. - Returns (true) of the client can be minimized, (false) otherwise. + Returns (true) if the client can be minimized, (false) otherwise. - Returns (true) of the client can be mazimized, (false) otherwise. + Returns (true) if the client can be mazimized, (false) otherwise. - Returns (true) of the client can be resized (changable size), (false) otherwise. + Returns (true) if the client can be resized (changable size), (false) otherwise. - Returns (true) of the client can be moved (non-fixed location), (false) otherwise. + Returns (true) if the client can be moved (non-fixed location), (false) otherwise. - Returns (true) of the client can be moved across screens (only valid in a multiple monitor setup), (false) otherwise. + Returns (true) if the client can be moved across screens (only valid in a multiple monitor setup), (false) otherwise. - Returns (true) of the client can be closed by user action (or any other action other than the system or the application itself), (false) otherwise. + Returns (true) if the client can be closed by user action (or any other action other than the system or the application itself), (false) otherwise. - Returns (true) of the client is in fullscreen mode, (false) otherwise. + Returns (true) if the client is in fullscreen mode, (false) otherwise. - Returns (true) of the client can be set to fullscreen mode, (false) otherwise. + Returns (true) if the client can be set to fullscreen mode, (false) otherwise. + + + + + Returns (true) if the window is 'normal', (false) otherwise. A normal window is a window which has a border, can be moved by the user, can be closed, etc. + + + + + Returns (true) if 'Keep Above Others' has been set on the client, (false) otherwise. + + + + + Returns (true) if 'Keep Below Others' has been set on the client, (false) otherwise. + + + + The 'Keep Above others' parameter to be applied to the client + Sets the 'Keep Above others' parameter value or unsets it according to keepabove. + + + + The 'Keep Below others' parameter to be applied to the client + Sets the 'Keep Below others' parameter value or unsets it according to keepbelow. diff --git a/scripting/client.cpp b/scripting/client.cpp index afa43d3bb4..c12d1599af 100644 --- a/scripting/client.cpp +++ b/scripting/client.cpp @@ -160,6 +160,8 @@ SWrapper::ClientResolution SWrapper::Client::newWrapper(KWin::Client* client, QS BOOLATTACHCLIENT(isMovable) BOOLATTACHCLIENT(isMovableAcrossScreens) BOOLATTACHCLIENT(isCloseable) + BOOLATTACHCLIENT(keepAbove) + BOOLATTACHCLIENT(keepBelow) func = eng->newFunction(unminimize, 0); value.setProperty("unminimize", func, QScriptValue::Undeletable); @@ -223,6 +225,40 @@ BOOLEXPORTCLIENT(isResizable) BOOLEXPORTCLIENT(isMovable) BOOLEXPORTCLIENT(isMovableAcrossScreens) BOOLEXPORTCLIENT(isCloseable) +BOOLEXPORTCLIENT(keepAbove) +BOOLEXPORTCLIENT(keepBelow) + +QScriptValue SWrapper::Client::setKeepAbove(QScriptContext* ctx, QScriptEngine* eng) + { + KWin::Client* central = eng->fromScriptValue(ctx->thisObject()); + QScriptValue setValue = ctx->argument(0); + + if((central == 0) || (setValue.isUndefined())) + { + return eng->toScriptValue(0); + } + else + { + central->setKeepAbove(eng->fromScriptValue(setValue)); + return eng->toScriptValue(1); + } + } + +QScriptValue SWrapper::Client::setKeepBelow(QScriptContext* ctx, QScriptEngine* eng) + { + KWin::Client* central = eng->fromScriptValue(ctx->thisObject()); + QScriptValue setValue = ctx->argument(0); + + if((central == 0) || (setValue.isUndefined())) + { + return eng->toScriptValue(0); + } + else + { + central->setKeepBelow(eng->fromScriptValue(setValue)); + return eng->toScriptValue(1); + } + } QScriptValue SWrapper::Client::isNormal(QScriptContext* ctx, QScriptEngine* eng) { diff --git a/scripting/client.h b/scripting/client.h index d2d388e2df..370b0ceece 100644 --- a/scripting/client.h +++ b/scripting/client.h @@ -164,6 +164,10 @@ class Client : public Toplevel static QScriptValue setMaximize(QScriptContext*, QScriptEngine*); static QScriptValue maximize(QScriptContext*, QScriptEngine*); static QScriptValue desktop(QScriptContext*, QScriptEngine*); + static QScriptValue keepAbove(QScriptContext*, QScriptEngine*); + static QScriptValue keepBelow(QScriptContext*, QScriptEngine*); + static QScriptValue setKeepAbove(QScriptContext*, QScriptEngine*); + static QScriptValue setKeepBelow(QScriptContext*, QScriptEngine*); static QScriptValue isShade(QScriptContext*, QScriptEngine*); static QScriptValue isShadeable(QScriptContext*, QScriptEngine*); diff --git a/scripting/kwsapi.html b/scripting/kwsapi.html index c7e1058835..1667b93b14 100644 --- a/scripting/kwsapi.html +++ b/scripting/kwsapi.html @@ -391,77 +391,122 @@
  • client.isShade()
-

Returns (true) of the client is shaded, (false) otherwise.

+

Returns (true) if the client is shaded, (false) otherwise.

client.isShadeable[ret: boolean]

  • client.isShadeable()
-

Returns (true) of the client is shadeable (can be shaded), (false) otherwise.

+

Returns (true) if the client is shadeable (can be shaded), (false) otherwise.

client.isMinimized[ret: boolean]

  • client.isMinimized()
-

Returns (true) of the client is minimized, (false) otherwise.

+

Returns (true) if the client is minimized, (false) otherwise.

client.isMinimizable[ret: boolean]

  • client.isMinimizable()
-

Returns (true) of the client can be minimized, (false) otherwise.

+

Returns (true) if the client can be minimized, (false) otherwise.

client.isMaximizable[ret: boolean]

  • client.isMaximizable()
-

Returns (true) of the client can be mazimized, (false) otherwise.

+

Returns (true) if the client can be mazimized, (false) otherwise.

client.isResizable[ret: boolean]

  • client.isResizable()
-

Returns (true) of the client can be resized (changable size), (false) otherwise.

+

Returns (true) if the client can be resized (changable size), (false) otherwise.

client.isMovable[ret: boolean]

  • client.isMovable()
-

Returns (true) of the client can be moved (non-fixed location), (false) otherwise.

+

Returns (true) if the client can be moved (non-fixed location), (false) otherwise.

client.isMovableAcrossScreens[ret: boolean]

  • client.isMovableAcrossScreens()
-

Returns (true) of the client can be moved across screens (only valid in a multiple monitor setup), (false) otherwise.

+

Returns (true) if the client can be moved across screens (only valid in a multiple monitor setup), (false) otherwise.

client.isCloseable[ret: boolean]

  • client.isCloseable()
-

Returns (true) of the client can be closed by user action (or any other action other than the system or the application itself), (false) otherwise.

+

Returns (true) if the client can be closed by user action (or any other action other than the system or the application itself), (false) otherwise.

client.isFullScreen[ret: boolean]

  • client.isFullScreen()
-

Returns (true) of the client is in fullscreen mode, (false) otherwise.

+

Returns (true) if the client is in fullscreen mode, (false) otherwise.

client.isFullScreenable[ret: boolean]

  • client.isFullScreenable()
-

Returns (true) of the client can be set to fullscreen mode, (false) otherwise.

+

Returns (true) if the client can be set to fullscreen mode, (false) otherwise.

+
+
+

client.isNormal[ret: boolean]

+
    +
  • client.isNormal()
  • +
+

Returns (true) if the window is 'normal', (false) otherwise. A normal window is a window which has a border, can be moved by the user, can be closed, etc.

+
+
+

client.keepAbove[ret: boolean]

+
    +
  • client.keepAbove()
  • +
+

Returns (true) if 'Keep Above Others' has been set on the client, (false) otherwise.

+
+
+

client.keepBelow[ret: boolean]

+
    +
  • client.keepBelow()
  • +
+

Returns (true) if 'Keep Below Others' has been set on the client, (false) otherwise.

+
+
+

client.setKeepAbove

+
    +
  • client.setKeepAbove(keepabove {})
  • +
+

Sets the 'Keep Above others' parameter value or unsets it according to keepabove.

+

setKeepAbove(keepabove {})
+

    +
  • keepabove {}: The 'Keep Above others' parameter to be applied to the client
  • +
+

+
+
+

client.setKeepBelow

+
    +
  • client.setKeepBelow(keepbelow {})
  • +
+

Sets the 'Keep Below others' parameter value or unsets it according to keepbelow.

+

setKeepBelow(keepbelow {})
+

    +
  • keepbelow {}: The 'Keep Below others' parameter to be applied to the client
  • +
+

client.clientGroup[ret: clientgroup]