summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-15 18:11:09 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-15 18:11:09 +0000
commit5d3fd210022b69328ba7b7e042a52731c4f9d9ad (patch)
tree6f04ef367a547bdfa5153d2039149d2ee6faa00e
parent818c263a808e01f1d534aa1abdadda261e1c1457 (diff)
downloadmarex-dev-5d3fd210022b69328ba7b7e042a52731c4f9d9ad.tar.gz
marex-dev-5d3fd210022b69328ba7b7e042a52731c4f9d9ad.tar.bz2
water plugin: only draw window wave on the window's default viewport
git-svn-id: file:///beryl/trunk@4085 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-plugins/src/water.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/beryl-plugins/src/water.c b/beryl-plugins/src/water.c
index 7aa477b..97fc8dc 100644
--- a/beryl-plugins/src/water.c
+++ b/beryl-plugins/src/water.c
@@ -161,7 +161,10 @@ typedef struct _WaterScreen
float wiperAngle;
float wiperSpeed;
- Window current;
+ struct {
+ CompWindow *w;
+ int vpX, vpY;
+ } current;
WaterFunction *bumpMapFunctions;
} WaterScreen;
@@ -913,8 +916,8 @@ static Bool waterRainTimeout(void *closure)
WATER_SCREEN(s);
WATER_DISPLAY(s->display);
- if (ws->current)
- ws->current = 0;
+ if (ws->current.w)
+ ws->current.w = NULL;
p.x = (int)(s->width * (rand() / (float)RAND_MAX));
p.y = (int)(s->height * (rand() / (float)RAND_MAX));
@@ -940,8 +943,8 @@ static Bool waterWiperTimeout(void *closure)
ws->wiperSpeed = 2.5f;
else if (ws->wiperAngle == 180.0f)
ws->wiperSpeed = -2.5f;
- if (ws->current)
- ws->current = 0;
+ if (ws->current.w)
+ ws->current.w = NULL;
}
return TRUE;
@@ -1020,8 +1023,9 @@ waterDrawWindowTexture(CompWindow * w,
unsigned int mask)
{
WATER_SCREEN(w->screen);
+ Bool drawIt = TRUE;
- if (w->id == ws->current)
+ if (ws->current.w && (w->id == ws->current.w->id))
{
UNWRAP(ws, w->screen, drawWindowTexture);
(*w->screen->drawWindowTexture) (w, texture, fAttrib, mask);
@@ -1030,7 +1034,13 @@ waterDrawWindowTexture(CompWindow * w,
return;
}
- if (ws->count)
+ if (ws->current.w)
+ {
+ if ((w->screen->x != ws->current.vpX) || (w->screen->y != ws->current.vpY))
+ drawIt = FALSE;
+ }
+
+ if (drawIt && ws->count)
{
FragmentAttrib fa = *fAttrib;
Bool lighting = w->screen->lighting;
@@ -1205,7 +1215,7 @@ static void waterDonePaintScreen(CompScreen * s)
if (ws->count)
damageScreen(s);
else
- ws->current = 0;
+ ws->current.w = NULL;
UNWRAP(ws, s, donePaintScreen);
(*s->donePaintScreen) (s);
@@ -1258,8 +1268,8 @@ waterInitiate(CompDisplay * d,
if (!ws->grabIndex)
ws->grabIndex = pushScreenGrab(s, None, "water");
- if (ws->current)
- ws->current = 0;
+ if (ws->current.w)
+ ws->current.w = NULL;
if (XQueryPointer
(d->display, s->root, &root, &child, &xRoot, &yRoot, &i, &i, &ui))
@@ -1300,7 +1310,7 @@ waterTerminate(CompDisplay * d,
removeScreenGrab(s, ws->grabIndex, 0);
ws->grabIndex = 0;
}
- ws->current = 0;
+ ws->current.w = NULL;
}
return FALSE;
@@ -1528,7 +1538,8 @@ waterWin(CompDisplay * d,
WATER_DISPLAY(d);
WATER_SCREEN(w->screen);
- ws->current = xid;
+ ws->current.w = w;
+ defaultViewportForWindow(w, &ws->current.vpX, &ws->current.vpY);
o[0].type = CompOptionTypeInt;
o[0].name = "root";
@@ -2052,7 +2063,9 @@ static Bool waterInitScreen(CompPlugin * p, CompScreen * s)
return FALSE;
ws->grabIndex = 0;
- ws->current = 0;
+ ws->current.w = NULL;
+ ws->current.vpX = 0;
+ ws->current.vpY = 0;
addScreenAction(s, &wd->opt[WATER_DISPLAY_OPTION_INITIATE].value.action);
addScreenAction(s,