summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Young <rcxdude@gmail.com>2008-05-01 19:18:05 +0100
committerDouglas Young <rcxdude@gmail.com>2008-05-01 19:18:05 +0100
commit6309993d80faee726352e923aead29c45efac1e4 (patch)
treef64c5a1a9a2727065ce91de04bf54424ee9ee39e
parentc8b24531724760da1e79a5b5f86bf807a79263b8 (diff)
downloaddodge-6309993d80faee726352e923aead29c45efac1e4.tar.gz
dodge-6309993d80faee726352e923aead29c45efac1e4.tar.bz2
actually implement toggling on an edge
-rw-r--r--dodge.c17
-rw-r--r--dodge.xml.in5
2 files changed, 11 insertions, 11 deletions
diff --git a/dodge.c b/dodge.c
index 2f790d4..150e5ad 100644
--- a/dodge.c
+++ b/dodge.c
@@ -102,13 +102,7 @@ typedef struct _DodgeScreen
DodgeWindow *dw = GET_DODGE_WINDOW (w, \
GET_DODGE_SCREEN (w->screen, \
GET_DODGE_DISPLAY (w->screen->display)))
-static float
-noneg (float x)
-{
- if (x<0)
- return 0;
- return x;
-}
+#define POSITIVE(x) ((x)>0?(x):0)
static void
positionUpdate (CompScreen *s, int x, int y)
@@ -150,14 +144,14 @@ dodgestep (CompWindow *w, int ms, int away)
if(WIN_W(w)/2 + PADDING - abs(dx) >
WIN_H(w)/2 + PADDING - abs(dy))
{
- dw->vx += noneg(WIN_H(w)/2 + PADDING - abs(dy))
+ dw->vx += POSITIVE(WIN_H(w)/2 + PADDING - abs(dy))
* SPRING_K * dx/(abs(dx) + abs(dy)) * ms;
- dw->vy += noneg(WIN_H(w)/2 + PADDING - abs(dy))
+ dw->vy += POSITIVE(WIN_H(w)/2 + PADDING - abs(dy))
* SPRING_K * dy/(abs(dx) + abs(dy)) * ms;
} else {
- dw->vx += noneg(WIN_W(w)/2 + PADDING - abs(dx))
+ dw->vx += POSITIVE(WIN_W(w)/2 + PADDING - abs(dx))
* SPRING_K * dx/(abs(dx) + abs(dy)) * ms;
- dw->vy += noneg(WIN_W(w)/2 + PADDING - abs(dx))
+ dw->vy += POSITIVE(WIN_W(w)/2 + PADDING - abs(dx))
* SPRING_K * dy/(abs(dx) + abs(dy)) * ms;
}
break;
@@ -482,6 +476,7 @@ dodgeInitDisplay (CompPlugin *p,
d->base.privates[displayPrivateIndex].ptr = dd;
dodgeSetDodgeToggleKeyInitiate (d, dodgeToggle);
dodgeSetDodgeToggleButtonInitiate (d, dodgeToggle);
+ dodgeSetDodgeToggleEdgeInitiate (d, dodgeToggle);
dd->mpFunc = d->base.privates[mousepollindex].ptr;
return TRUE;
diff --git a/dodge.xml.in b/dodge.xml.in
index b6ad2ea..c2fed20 100644
--- a/dodge.xml.in
+++ b/dodge.xml.in
@@ -29,6 +29,11 @@
<_long>Toggle Dodging</_long>
<default>none</default>
</option>
+ <option name="dodge_toggle_edge" type="edge">
+ <_short>Toggle Dodging</_short>
+ <_long>Toggle Dodging</_long>
+ <default>none</default>
+ </option>
<option name="window_types" type="match">
<_short>Window Types</_short>
<_long>Windows which should dodge</_long>