summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <SmSpillaz@gmail.com>2010-05-24 23:37:05 +0800
committerSam Spilsbury <SmSpillaz@gmail.com>2010-05-24 23:37:05 +0800
commitba63d06c6f68490c99ab9dacf0a8d10180cbcaeb (patch)
treed635f7be5a1131306de17ac233a0f8836a9b7d51
parentb7f3c4e44d7ee04d5cc88c3d805290a9589280e6 (diff)
parent810ad32adf452d10edbc5f9b0e1f49850e13ad46 (diff)
downloadwallpaper-ba63d06c6f68490c99ab9dacf0a8d10180cbcaeb.tar.gz
wallpaper-ba63d06c6f68490c99ab9dacf0a8d10180cbcaeb.tar.bz2
Merge branch 'master' of git+ssh://git.compiz.org/git/compiz/plugins/wallpaper
-rw-r--r--src/wallpaper.cpp27
-rw-r--r--src/wallpaper.h3
-rw-r--r--wallpaper.xml.in2
3 files changed, 25 insertions, 7 deletions
diff --git a/src/wallpaper.cpp b/src/wallpaper.cpp
index 0eccabb..a5c555e 100644
--- a/src/wallpaper.cpp
+++ b/src/wallpaper.cpp
@@ -247,7 +247,7 @@ WallpaperScreen::updateBackgrounds ()
backgroundsPrimary.clear ();
- for (int i = 0; i < cBgImage.size (); i++)
+ for (unsigned int i = 0; i < cBgImage.size (); i++)
{
backgroundsPrimary.push_back (WallpaperBackground ());
@@ -329,6 +329,16 @@ WallpaperScreen::wallpaperCycleOptionChanged (CompOption *o,
updateTimers ();
}
+void
+WallpaperScreen::wallpaperToggleCycle (CompOption *o,
+ Options num)
+{
+ if (optionGetCycleWallpapers ())
+ rotateTimer.start (fadeTimeout, fadeTimeout * 1.2);
+ else
+ rotateTimer.stop ();
+}
+
WallpaperBackground *
WallpaperScreen::getBackgroundForViewport (WallpaperBackgrounds &bg)
{
@@ -417,6 +427,7 @@ WallpaperWindow::drawBackgrounds (GLFragment::Attrib &attrib,
GLTexture::Matrix matrix;
GLTexture::MatrixList tmpMatrixList;
WallpaperBackground *back = ws->getBackgroundForViewport (bg);
+ GLFragment::Attrib tmpAttrib = attrib;
tmpMatrixList.push_back (matrix);
@@ -440,16 +451,16 @@ WallpaperWindow::drawBackgrounds (GLFragment::Attrib &attrib,
if (ws->optionGetCycleWallpapers ())
{
if (fadingIn)
- attrib.setOpacity (OPAQUE * (1.0f - ws->alpha));
+ tmpAttrib.setOpacity ((OPAQUE * (1.0f - ws->alpha)) * (attrib.getOpacity () / (float)OPAQUE));
else
- attrib.setOpacity (OPAQUE * ws->alpha);
+ tmpAttrib.setOpacity ((OPAQUE * ws->alpha) * (attrib.getOpacity () / (float)OPAQUE));
}
- if (attrib.getOpacity () != OPAQUE)
+ if (tmpAttrib.getOpacity () != OPAQUE)
mask |= PAINT_WINDOW_BLEND_MASK;
if (gWindow->geometry ().vCount)
- gWindow->glDrawTexture(back->fillTex[0], attrib, mask);
+ gWindow->glDrawTexture(back->fillTex[0], tmpAttrib, mask);
if (back->imgSize.width () && back->imgSize.height ())
{
@@ -547,7 +558,7 @@ WallpaperWindow::drawBackgrounds (GLFragment::Attrib &attrib,
}
if (gWindow->geometry ().vCount)
- gWindow->glDrawTexture (back->imgTex[0], attrib, mask | PAINT_WINDOW_BLEND_MASK);
+ gWindow->glDrawTexture (back->imgTex[0], tmpAttrib, mask | PAINT_WINDOW_BLEND_MASK);
}
}
@@ -575,7 +586,7 @@ WallpaperWindow::glDraw (const GLMatrix &transform,
saveFilter = ws->gScreen->filter (filterIdx);
ws->gScreen->setFilter (filterIdx, GLTexture::Good);
- if (ws->optionGetCycleWallpapers ())
+ if (ws->optionGetCycleWallpapers () && ws->rotateTimer.active ())
drawBackgrounds (attrib, region, mask,
ws->backgroundsSecondary, true);
drawBackgrounds (attrib, region, mask,
@@ -637,6 +648,8 @@ WallpaperScreen::WallpaperScreen (CompScreen *screen) :
optionSetBgColor2Notify (boost::bind (&WallpaperScreen::
wallpaperBackgroundsChanged, this, _1, _2));
+ optionSetCycleWallpapersNotify (boost::bind (&WallpaperScreen::
+ wallpaperToggleCycle, this, _1, _2));
optionSetCycleTimeoutNotify (boost::bind (&WallpaperScreen::
wallpaperCycleOptionChanged, this, _1, _2));
optionSetFadeDurationNotify (boost::bind (&WallpaperScreen::
diff --git a/src/wallpaper.h b/src/wallpaper.h
index 2059978..3d00aa1 100644
--- a/src/wallpaper.h
+++ b/src/wallpaper.h
@@ -91,6 +91,9 @@ class WallpaperScreen :
void wallpaperCycleOptionChanged (CompOption *opt,
Options num);
+ void wallpaperToggleCycle (CompOption *opt,
+ Options num);
+
WallpaperBackground *getBackgroundForViewport (WallpaperBackgrounds&);
void
diff --git a/wallpaper.xml.in b/wallpaper.xml.in
index 5fa7ef4..f6584a3 100644
--- a/wallpaper.xml.in
+++ b/wallpaper.xml.in
@@ -11,6 +11,8 @@
<plugin>decor</plugin>
</requirement>
<relation type="after">
+ <plugin>composite</plugin>
+ <plugin>opengl</plugin>
<plugin>svg</plugin>
<plugin>png</plugin>
<plugin>imgjpeg</plugin>