summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dodge.c93
1 files changed, 43 insertions, 50 deletions
diff --git a/dodge.c b/dodge.c
index d1b0e2f..d7c55b1 100644
--- a/dodge.c
+++ b/dodge.c
@@ -65,6 +65,7 @@ typedef struct _DodgeScreen
WindowStateChangeNotifyProc windowStateChangeNotify;
WindowMoveNotifyProc windowMoveNotify;
WindowResizeNotifyProc windowResizeNotify;
+ DonePaintScreenProc donePaintScreen;
PositionPollingHandle pollHandle;
@@ -81,6 +82,7 @@ typedef struct _DodgeScreen
Bool active;
Bool exiting;
Bool movelock;
+ Bool moreAdjust;
} DodgeScreen;
@@ -256,16 +258,12 @@ dodgestep (CompWindow *w, int ms, int away)
{
moveWindow (w,dw->vx*ms,dw->vy*ms,TRUE,TRUE);
syncWindowPosition (w);
- return 1;
+ ds->moreAdjust = TRUE;
}
- /*if(abs(WIN_CX(w) - dw->ox) < 1 &&
- abs(WIN_CY(w) - dw->oy) < 1)
+ if (dy || dx || dw->vx > 0.03 || dw->vy > 0.03)
{
- moveWindowToViewportPosition(w,(dw->ox - WIN_W(w)/2),
- (dw->oy - WIN_H(w)/2),1);
- printf("returning 0\n");
- return 0;
- }*/
+ ds->moreAdjust = TRUE;
+ }
return 0;
}
@@ -277,7 +275,6 @@ dodgePreparePaintScreen (CompScreen *s,
{
DODGE_SCREEN (s);
CompWindow *w;
- int count = 0; /* number of windows moved */
/* if another plugin has grabbed the screen we don't want to interfere
* except for expo or rotate cube, in which case windows return to their original
* positions */
@@ -292,20 +289,22 @@ dodgePreparePaintScreen (CompScreen *s,
if (ds->active)
{
ds->movelock = TRUE;
+ ds->moreAdjust = FALSE;
for (w = s->windows; w; w = w->next)
{
DODGE_WINDOW (w);
if (dw->isdodge)
- count += dodgestep(w,ms,!otherScreenGrabExist(s,"dodge",0)
- && (w->screen->display->activeWindow != w->id
- || dodgeGetDodgeActive (s->display)));
+ dodgestep(w,ms,!otherScreenGrabExist(s,"dodge",0)
+ && (w->screen->display->activeWindow != w->id
+ || dodgeGetDodgeActive (s->display)));
}
ds->movelock = FALSE;
}
- if (ds->exiting && !count)
+ if (ds->exiting && !ds->moreAdjust)
{
ds->active = FALSE;
ds->exiting = FALSE;
+ ds->moreAdjust = FALSE;
}
UNWRAP (ds, s, preparePaintScreen);
@@ -314,6 +313,19 @@ dodgePreparePaintScreen (CompScreen *s,
}
static void
+dodgeDonePaintScreen (CompScreen *s)
+{
+ DODGE_SCREEN(s);
+ if (ds->active && ds->moreAdjust)
+ {
+ damageScreen(s);
+ }
+ UNWRAP (ds, s, donePaintScreen);
+ (*s->donePaintScreen) (s);
+ WRAP (ds, s, donePaintScreen, dodgeDonePaintScreen);
+}
+
+static void
dodgeUpdateDodgeWindow (CompWindow *w)
{
DODGE_WINDOW (w);
@@ -421,41 +433,6 @@ dodgeToggle (CompDisplay *d,
return TRUE;
}
-
-static Bool
-dodgePaintOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- Bool status;
-
- DODGE_SCREEN (s);
- if (ds->active)
- {
- /* damage a small area around the mouse to prevent jerkiness */
- REGION r;
-
- r.rects = &r.extents;
- r.numRects = r.size = 1;
- r.extents.x1 = ds->px - PADDING;
- r.extents.x2 = ds->px + PADDING;
- r.extents.y1 = ds->py - PADDING;
- r.extents.y2 = ds->py + PADDING;
-
- damageScreenRegion(s,&r);
- }
-
-
- UNWRAP (ds, s, paintOutput);
- status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
- WRAP (ds, s, paintOutput, dodgePaintOutput);
-
- return status;
-}
-
static void
dodgeWindowMoveNotify (CompWindow *w,
int dx,
@@ -501,6 +478,21 @@ positionUpdate (CompScreen *s, int x, int y)
DODGE_SCREEN (s);
ds->px = x;
ds->py = y;
+ if (ds->active)
+ {
+ /* damage a small area around the mouse to prevent jerkiness */
+ REGION r;
+
+ r.rects = &r.extents;
+ r.numRects = r.size = 1;
+ r.extents.x1 = ds->px - PADDING;
+ r.extents.x2 = ds->px + PADDING;
+ r.extents.y1 = ds->py - PADDING;
+ r.extents.y2 = ds->py + PADDING;
+
+ damageScreenRegion(s,&r);
+ }
+
}
static void
@@ -646,12 +638,13 @@ dodgeInitScreen (CompPlugin *p,
ds->active = FALSE;
ds->exiting = FALSE;
+ ds->moreAdjust = FALSE;
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);
+ WRAP (ds, s, donePaintScreen, dodgeDonePaintScreen);
ds->windowPrivateIndex = allocateWindowPrivateIndex (s);
s->base.privates[dd->screenPrivateIndex].ptr = ds;
@@ -668,10 +661,10 @@ dodgeFiniScreen (CompPlugin *p,
DODGE_SCREEN (s);
DODGE_DISPLAY (s->display);
UNWRAP (ds, s, preparePaintScreen);
- UNWRAP (ds, s, paintOutput);
UNWRAP (ds, s, windowStateChangeNotify);
UNWRAP (ds, s, windowMoveNotify);
UNWRAP (ds, s, windowResizeNotify);
+ UNWRAP (ds, s, donePaintScreen);
(*dd->mpFunc->removePositionPolling) (s, ds->pollHandle);
free (ds);