summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Young <rcxdude@gmail.com>2008-05-17 12:52:11 +0100
committerDouglas Young <rcxdude@gmail.com>2008-05-17 12:52:11 +0100
commitce375da4ed5f7df9a06f9872aaf8c38085298f41 (patch)
treea037ac6bb5282fab98d240a876372a8eb43a921d
parente8af1f58814124797a6540b400191890fa60c9e2 (diff)
downloaddodge-ce375da4ed5f7df9a06f9872aaf8c38085298f41.tar.gz
dodge-ce375da4ed5f7df9a06f9872aaf8c38085298f41.tar.bz2
added option for dodging the active window
-rw-r--r--dodge.c52
-rw-r--r--dodge.xml.in9
2 files changed, 58 insertions, 3 deletions
diff --git a/dodge.c b/dodge.c
index 7cfb315..07017f7 100644
--- a/dodge.c
+++ b/dodge.c
@@ -63,6 +63,8 @@ typedef struct _DodgeScreen
PaintOutputProc paintOutput;
PreparePaintScreenProc preparePaintScreen;
WindowStateChangeNotifyProc windowStateChangeNotify;
+ WindowMoveNotifyProc windowMoveNotify;
+ WindowResizeNotifyProc windowResizeNotify;
PositionPollingHandle pollHandle;
@@ -81,6 +83,7 @@ typedef struct _DodgeScreen
float friction;
Bool active;
Bool exiting;
+ Bool movelock;
} DodgeScreen;
@@ -308,12 +311,16 @@ dodgePreparePaintScreen (CompScreen *s,
if (ds->active)
{
+ ds->movelock = TRUE;
for (w = s->windows; w; w = w->next)
{
DODGE_WINDOW (w);
if (dw->isdodge)
- count += dodgestep(w,ms,!otherScreenGrabExist(s,"dodge",0));
+ count += dodgestep(w,ms,!otherScreenGrabExist(s,"dodge",0)
+ && (w->screen->display->activeWindow != w->id
+ || dodgeGetDodgeActive (s->display)));
}
+ ds->movelock = FALSE;
}
if (ds->exiting && !count)
{
@@ -471,6 +478,44 @@ dodgePaintOutput (CompScreen *s,
return status;
}
+static void
+dodgeWindowMoveNotify (CompWindow *w,
+ int dx,
+ int dy,
+ Bool immediate)
+{
+ DODGE_WINDOW (w);
+ DODGE_SCREEN (w->screen);
+
+ if (!ds->movelock && ds->active)
+ {
+ dw->ox += dx;
+ dw->oy += dy;
+ }
+ UNWRAP (ds, w->screen, windowMoveNotify);
+ (*w->screen->windowMoveNotify) (w, dx, dy, immediate);
+ WRAP (ds, w->screen, windowMoveNotify, dodgeWindowMoveNotify);
+}
+
+static void
+dodgeWindowResizeNotify (CompWindow *w,
+ int dx,
+ int dy,
+ int dwidth,
+ int dheight)
+{
+ DODGE_WINDOW (w);
+ DODGE_SCREEN (w->screen);
+
+ if (!ds->movelock && ds->active)
+ {
+ dw->ox += dx;
+ dw->oy += dy;
+ }
+ UNWRAP (ds, w->screen, windowResizeNotify);
+ (*w->screen->windowResizeNotify) (w, dx, dy, dwidth, dheight);
+ WRAP (ds, w->screen, windowResizeNotify, dodgeWindowResizeNotify);
+}
static void
positionUpdate (CompScreen *s, int x, int y)
@@ -627,6 +672,8 @@ dodgeInitScreen (CompPlugin *p,
WRAP (ds, s, preparePaintScreen, dodgePreparePaintScreen);
WRAP (ds, s, paintOutput, dodgePaintOutput);
WRAP (ds, s, windowStateChangeNotify, dodgeStateChange);
+ WRAP (ds, s, windowMoveNotify, dodgeWindowMoveNotify);
+ WRAP (ds, s, windowResizeNotify, dodgeWindowResizeNotify);
ds->windowPrivateIndex = allocateWindowPrivateIndex (s);
s->base.privates[dd->screenPrivateIndex].ptr = ds;
@@ -645,6 +692,9 @@ dodgeFiniScreen (CompPlugin *p,
UNWRAP (ds, s, preparePaintScreen);
UNWRAP (ds, s, paintOutput);
UNWRAP (ds, s, windowStateChangeNotify);
+ UNWRAP (ds, s, windowMoveNotify);
+ UNWRAP (ds, s, windowResizeNotify);
+
(*dd->mpFunc->removePositionPolling) (s, ds->pollHandle);
free (ds);
}
diff --git a/dodge.xml.in b/dodge.xml.in
index 89eaed7..f750e56 100644
--- a/dodge.xml.in
+++ b/dodge.xml.in
@@ -41,8 +41,7 @@
</option>
<option name="dodge_select_key" type="key">
<_short>Select Window</_short>
- <_long>Mark the active window so it will
- dodge</_long>
+ <_long>Mark the active window so it will dodge</_long>
<default>none</default>
</option>
<option name="model" type="int">
@@ -64,6 +63,12 @@
<_name>Off Screen</_name>
</desc>
</option>
+ <option name="dodge_active" type="bool">
+ <_short>Dodge the active window</_short>
+ <_long>Controls whether the active window will be dodged</_long>
+ <default>false</default>
+ </option>
+
<option name="spring_k" type="float">
<_short>Spring K</_short>
<_long>Spring Stiffness</_long>