summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/thumbnail.c
diff options
context:
space:
mode:
authoronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-16 02:23:53 +0000
committeronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-16 02:23:53 +0000
commit9b61b68cb7e4d0942a819ccafa44ef401ba63109 (patch)
treede044f76117721f5255309ce0d9b8b26503e4e8c /beryl-plugins/src/thumbnail.c
parente5549273611783767673bf0376e4d7525deb6329 (diff)
downloadmarex-dev-9b61b68cb7e4d0942a819ccafa44ef401ba63109.tar.gz
marex-dev-9b61b68cb7e4d0942a819ccafa44ef401ba63109.tar.bz2
beryl-plugins: thumbnail: added switcher like background style
git-svn-id: file:///beryl/trunk@2703 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/thumbnail.c')
-rw-r--r--beryl-plugins/src/thumbnail.c59
1 files changed, 47 insertions, 12 deletions
diff --git a/beryl-plugins/src/thumbnail.c b/beryl-plugins/src/thumbnail.c
index 1892f74..e5e1eb6 100644
--- a/beryl-plugins/src/thumbnail.c
+++ b/beryl-plugins/src/thumbnail.c
@@ -90,6 +90,7 @@
#define THUMB_CURRENT_VIEWPORT_DEFAULT TRUE
#define THUMB_ALLWAYS_TOP_DEFAULT FALSE
+#define THUMB_WINDOW_LIKE_DEFAULT FALSE
#define THUMB_SCREEN_OPTION_SIZE 0
#define THUMB_SCREEN_OPTION_DELAY 1
@@ -98,7 +99,8 @@
#define THUMB_SCREEN_OPTION_FADE 4
#define THUMB_SCREEN_OPTION_CURRENT_VIEWPORT 5
#define THUMB_SCREEN_OPTION_ALLWAYS_TOP 6
-#define THUMB_SCREEN_OPTION_NUM 7
+#define THUMB_SCREEN_OPTION_WINDOW_LIKE 7
+#define THUMB_SCREEN_OPTION_NUM 8
#define THUMB_MOUSE_UPDATE_SPEED 100
@@ -143,6 +145,7 @@ typedef struct _ThumbScreen {
Thumbnail oldThumb;
CompTexture glowTexture;
+ CompTexture windowTexture;
CompOption opt[THUMB_SCREEN_OPTION_NUM];
} ThumbScreen;
@@ -581,7 +584,7 @@ thumbScreenInitOptions (ThumbScreen *ts)
o->type = CompOptionTypeBool;
o->value.b = THUMB_CURRENT_VIEWPORT_DEFAULT;
o->group = N_("Settings");
- o->subGroup = "Taskbar";
+ o->subGroup = N_("Taskbar");
o->advanced = False;
o->displayHints = "";
@@ -592,7 +595,18 @@ thumbScreenInitOptions (ThumbScreen *ts)
o->type = CompOptionTypeBool;
o->value.b = THUMB_ALLWAYS_TOP_DEFAULT;
o->group = N_("Settings");
- o->subGroup = "Taskbar";
+ o->subGroup = N_("Taskbar");
+ o->advanced = False;
+ o->displayHints = "";
+
+ o = &ts->opt[THUMB_SCREEN_OPTION_WINDOW_LIKE];
+ o->name = "window_like";
+ o->shortDesc = N_("Paint window like background");
+ o->longDesc = N_("Paint window like background instead of glow");
+ o->type = CompOptionTypeBool;
+ o->value.b = THUMB_WINDOW_LIKE_DEFAULT;
+ o->group = N_("Settings");
+ o->subGroup = "";
o->advanced = False;
o->displayHints = "";
@@ -659,6 +673,7 @@ thumbSetScreenOption (CompScreen *screen,
break;
case THUMB_SCREEN_OPTION_ALLWAYS_TOP:
case THUMB_SCREEN_OPTION_CURRENT_VIEWPORT:
+ case THUMB_SCREEN_OPTION_WINDOW_LIKE:
if (compSetBoolOption(o, value))
{
return TRUE;
@@ -752,20 +767,29 @@ thumbPaintThumb(CompScreen *s,Thumbnail *t)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glColor4us(ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[0],
- ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[1],
- ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[2],
- ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[3] * t->opacity);
+
+ if (ts->opt[THUMB_SCREEN_OPTION_WINDOW_LIKE].value.b)
+ {
+ glColor4f(1.0,1.0,1.0,t->opacity);
+ enableTexture(s, &ts->windowTexture, COMP_TEXTURE_FILTER_GOOD);
+ }
+ else
+ {
+ glColor4us(ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[0],
+ ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[1],
+ ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[2],
+ ts->opt[THUMB_SCREEN_OPTION_COLOR].value.c[3] * t->opacity);
+
+ enableTexture(s, &ts->glowTexture, COMP_TEXTURE_FILTER_GOOD);
+ }
glBegin(GL_QUADS);
+
+ glTexCoord2f(1,0);
glVertex2f(wx,wy);
glVertex2f(wx,wy+height);
glVertex2f(wx+width,wy+height);
glVertex2f(wx+width,wy);
- glEnd();
-
- enableTexture(s, &ts->glowTexture, COMP_TEXTURE_FILTER_GOOD);
- glBegin(GL_QUADS);
glTexCoord2f(0,1);
glVertex2f(wx-off,wy-off);
@@ -840,7 +864,15 @@ thumbPaintThumb(CompScreen *s,Thumbnail *t)
glVertex2f(wx+width+off,wy);
glEnd();
- disableTexture(s, &ts->glowTexture);
+
+ if (ts->opt[THUMB_SCREEN_OPTION_WINDOW_LIKE].value.b)
+ {
+ disableTexture(s, &ts->windowTexture);
+ }
+ else
+ {
+ disableTexture(s, &ts->glowTexture);
+ }
glDisable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
@@ -1127,8 +1159,10 @@ thumbInitScreen (CompPlugin *p,
compAddTimeout(THUMB_MOUSE_UPDATE_SPEED, thumbUpdateMouse, s);
initTexture (s, &ts->glowTexture);
+ initTexture (s, &ts->windowTexture);
imageToTexture (s, &ts->glowTexture,glowTex,32,32);
+ imageToTexture (s, &ts->windowTexture,windowTex,32,32);
return TRUE;
}
@@ -1150,6 +1184,7 @@ thumbFiniScreen (CompPlugin *p,
compRemoveTimeout (ts->mouseTimeout);
finiTexture (s, &ts->glowTexture);
+ finiTexture (s, &ts->windowTexture);
free (ts);
}