summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2008-02-10 12:17:01 +0100
committerDanny Baumann <dannybaumann@web.de>2008-02-10 12:17:01 +0100
commit55cc91aa628f3b51a0d360de25306219e2217e80 (patch)
tree9f3de106679ac5d400135695ba846ea2fc56c35e
parent4d5739898d181b5648e822752b8eef50a05deefc (diff)
downloadput-55cc91aa628f3b51a0d360de25306219e2217e80.tar.gz
put-55cc91aa628f3b51a0d360de25306219e2217e80.tar.bz2
Use screen work area for put-to-corner if user double-tapped the corresponding key.
-rw-r--r--put.c51
1 files changed, 38 insertions, 13 deletions
diff --git a/put.c b/put.c
index f5d6a45..fed01d3 100644
--- a/put.c
+++ b/put.c
@@ -73,6 +73,9 @@ typedef struct _PutDisplay
HandleEventProc handleEvent; /* handle event function pointer */
+ Window lastWindow;
+ PutType lastType;
+
Atom compizPutWindowAtom; /* client event atom */
} PutDisplay;
@@ -333,6 +336,7 @@ putInitiate (CompDisplay *d,
PutType type;
XRectangle workArea;
+ PUT_DISPLAY (d);
PUT_WINDOW (w);
px = getIntOptionNamed (option, nOption, "x", 0);
@@ -354,31 +358,49 @@ putInitiate (CompDisplay *d,
/* get the Xinerama head from the options list */
head = getIntOptionNamed(option, nOption, "head", -1);
-
/* no head in options list so we use the current head */
if (head == -1)
- head = s->currentOutputDev;
-
- /* make sure the head number is not out of bounds */
- head = MIN (head, s->nOutputDev - 1);
+ {
+ /* no head given, so use the current head if this wasn't
+ a double tap */
+ if (pd->lastType != type || pd->lastWindow != w->id)
+ head = s->currentOutputDev;
+ }
+ else
+ {
+ /* make sure the head number is not out of bounds */
+ head = MIN (head, s->nOutputDev - 1);
+ }
- /* some error has occured so we bail out */
- if (head < 0)
- return FALSE;
+ if (head == -1)
+ {
+ /* user double-tapped the key, so use the screen work area */
+ workArea = s->workArea;
+ /* set the type to unknown to have a toggle-type behaviour
+ between 'use head's work area' and 'use screen work area' */
+ pd->lastType = PutUnknown;
+ }
+ else
+ {
+ /* single tap or head provided via options list,
+ use the head's work area */
+ getWorkareaForOutput (s, head, &workArea);
+ pd->lastType = type;
+ }
- /* working area of the screen */
- getWorkareaForOutput (s, head, &workArea);
width = workArea.width;
- height = workArea.height;
+ height = workArea.height;
hx = workArea.x;
hy = workArea.y;
+ pd->lastWindow = w->id;
+
/* the windows location */
x = w->attrib.x;
y = w->attrib.y;
- /* handle the put types
- *
+ /*
+ * handle the put types
*/
switch (type)
{
@@ -1278,6 +1300,9 @@ putInitDisplay (CompPlugin *p,
pd->compizPutWindowAtom = XInternAtom(d->display,
"_COMPIZ_PUT_WINDOW", 0);
+ pd->lastWindow = None;
+ pd->lastType = PutUnknown;
+
putSetPutViewportInitiate (d, putToViewport);
putSetPutViewport1KeyInitiate (d, putToViewport);
putSetPutViewport2KeyInitiate (d, putToViewport);