summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2008-02-11 09:37:45 +0100
committerDanny Baumann <dannybaumann@web.de>2008-02-11 09:37:45 +0100
commita0380511834922d1624d5e61bfb04711a5a612ea (patch)
treef68868e2014720e0dbd39accf8c9ae2ff1ad70a8
parente0c312f8625f6c9dba2391539a1d93081da54899 (diff)
downloadput-a0380511834922d1624d5e61bfb04711a5a612ea.tar.gz
put-a0380511834922d1624d5e61bfb04711a5a612ea.tar.bz2
Replace "Put exact" option by a versatile "Put" option which can take a string that gives the type of put.
-rw-r--r--put.c74
-rw-r--r--put.xml.in6
2 files changed, 64 insertions, 16 deletions
diff --git a/put.c b/put.c
index 78302cc..87b948d 100644
--- a/put.c
+++ b/put.c
@@ -657,6 +657,65 @@ putInitiateCommon (CompDisplay *d,
return FALSE;
}
+static PutType
+putTypeFromString (char *type)
+{
+ if (strcmp (type, "exact") == 0)
+ return PutExact;
+ else if (strcmp (type, "pointer") == 0)
+ return PutPointer;
+ else if (strcmp (type, "viewport") == 0)
+ return PutViewport;
+ else if (strcmp (type, "viewportleft") == 0)
+ return PutViewportLeft;
+ else if (strcmp (type, "viewportright") == 0)
+ return PutViewportRight;
+ else if (strcmp (type, "viewportup") == 0)
+ return PutViewportUp;
+ else if (strcmp (type, "viewportdown") == 0)
+ return PutViewportDown;
+ else if (strcmp (type, "restore") == 0)
+ return PutRestore;
+ else if (strcmp (type, "bottomleft") == 0)
+ return PutBottomLeft;
+ else if (strcmp (type, "left") == 0)
+ return PutLeft;
+ else if (strcmp (type, "topleft") == 0)
+ return PutTopLeft;
+ else if (strcmp (type, "top") == 0)
+ return PutTop;
+ else if (strcmp (type, "topright") == 0)
+ return PutTopRight;
+ else if (strcmp (type, "right") == 0)
+ return PutRight;
+ else if (strcmp (type, "bottomright") == 0)
+ return PutBottomRight;
+ else if (strcmp (type, "bottom") == 0)
+ return PutBottom;
+ else if (strcmp (type, "center") == 0)
+ return PutCenter;
+ else
+ return PutUnknown;
+}
+
+static Bool
+putInitiate (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
+{
+ PutType type = PutUnknown;
+ char *typeString;
+
+ typeString = getStringOptionNamed (option, nOption, "type", NULL);
+ if (typeString)
+ type = putTypeFromString (typeString);
+
+ return putInitiateCommon (d, action, state,
+ option, nOption, type);
+}
+
static Bool
putToViewport (CompDisplay *d,
CompAction *action,
@@ -668,7 +727,7 @@ putToViewport (CompDisplay *d,
CompOption o[4];
/* get the face option */
- face = getIntOptionNamed(option, nOption, "face", -1);
+ face = getIntOptionNamed (option, nOption, "face", -1);
/* if it's not supplied, lets figure it out */
if (face < 0)
@@ -777,17 +836,6 @@ putPointer (CompDisplay *d,
}
static Bool
-putExact (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- return putInitiateCommon (d, action, state,
- option, nOption, PutExact);
-}
-
-static Bool
putCenter (CompDisplay *d,
CompAction *action,
CompActionState state,
@@ -1000,7 +1048,7 @@ putInitDisplay (CompPlugin *p,
putSetPutPointerKeyInitiate (d, putPointer);
putSetPutRestoreButtonInitiate (d, restore);
putSetPutPointerButtonInitiate (d, putPointer);
- putSetPutExactInitiate (d, putExact);
+ putSetPutPutInitiate (d, putInitiate);
putSetPutCenterKeyInitiate (d, putCenter);
putSetPutLeftKeyInitiate (d, putLeft);
putSetPutRightKeyInitiate (d, putRight);
diff --git a/put.xml.in b/put.xml.in
index 8ff8306..f681822 100644
--- a/put.xml.in
+++ b/put.xml.in
@@ -186,9 +186,9 @@
<_short>Put Pointer</_short>
<_long>Move window to the pointer position</_long>
</option>
- <option name="put_exact" type="action">
- <_short>Put Exact</_short>
- <_long>Move window to x, y</_long>
+ <option name="put_put" type="action">
+ <_short>Put</_short>
+ <_long>Move window arbitrarily by passing x, y and type.</_long>
<allowed/>
<default/>
</option>