summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/group
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 07:11:13 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 07:11:13 +0000
commit6f2ce07a1d85c262cb9e7375f387eaaf3bed9a19 (patch)
treeee29e6fc7883a4d550931bc69c5e1f3bd46e5c81 /beryl-plugins/src/group
parent051a1a9afb3ac3124ef131e7438ec811a00c7b16 (diff)
downloadmarex-dev-6f2ce07a1d85c262cb9e7375f387eaaf3bed9a19.tar.gz
marex-dev-6f2ce07a1d85c262cb9e7375f387eaaf3bed9a19.tar.bz2
group plugin: fixed group for new transform interface
git-svn-id: file:///beryl/trunk@4013 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/group')
-rw-r--r--beryl-plugins/src/group/group.h12
-rw-r--r--beryl-plugins/src/group/paint.c132
2 files changed, 85 insertions, 59 deletions
diff --git a/beryl-plugins/src/group/group.h b/beryl-plugins/src/group/group.h
index 2a9723a..0e13e62 100644
--- a/beryl-plugins/src/group/group.h
+++ b/beryl-plugins/src/group/group.h
@@ -594,14 +594,14 @@ void groupComputeGlowQuads(CompWindow *w, CompMatrix *matrix);
void groupRenderTopTabHighlight(GroupSelection *group);
void groupRenderTabBarBackground(GroupSelection *group);
void groupRenderWindowTitle(GroupSelection *group);
-void groupPaintThumb(GroupSelection *group, GroupTabBarSlot *slot, int targetOpacity);
-void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib, unsigned int mask, Region clipRegion);
+void groupPaintThumb(GroupSelection *group, GroupTabBarSlot *slot, const CompTransform *transform, int targetOpacity);
+void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib, const CompTransform *transform, unsigned int mask, Region clipRegion);
void groupPreparePaintScreen(CompScreen * s, int msSinceLastPaint);
-Bool groupPaintScreen(CompScreen * s, const ScreenPaintAttrib * sAttrib, Region region, int output, unsigned int mask);
-void groupPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa, Region region, int output, unsigned int mask);
+Bool groupPaintScreen(CompScreen * s, const ScreenPaintAttrib * sAttrib, const CompTransform *transform, Region region, int output, unsigned int mask);
+void groupPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa, const CompTransform *transform, Region region, int output, unsigned int mask);
void groupDonePaintScreen(CompScreen * s);
-Bool groupDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib, Region region, unsigned int mask);
-Bool groupPaintWindow(CompWindow * w, const WindowPaintAttrib * attrib, Region region, unsigned int mask);
+Bool groupDrawWindow(CompWindow * w, const CompTransform *transform, const FragmentAttrib * attrib, Region region, unsigned int mask);
+Bool groupPaintWindow(CompWindow * w, const WindowPaintAttrib * attrib, const CompTransform *transform, Region region, unsigned int mask);
/*
* init.c
diff --git a/beryl-plugins/src/group/paint.c b/beryl-plugins/src/group/paint.c
index 9332915..cf7e29f 100644
--- a/beryl-plugins/src/group/paint.c
+++ b/beryl-plugins/src/group/paint.c
@@ -28,7 +28,7 @@
* groupPaintThumb - taken from switcher and modified for tab bar
*
*/
-void groupPaintThumb(GroupSelection *group, GroupTabBarSlot *slot, int targetOpacity)
+void groupPaintThumb(GroupSelection *group, GroupTabBarSlot *slot, const CompTransform *transform, int targetOpacity)
{
DrawWindowGeometryProc oldDrawWindowGeometry;
AddWindowGeometryProc oldAddWindowGeometry;
@@ -83,12 +83,30 @@ void groupPaintThumb(GroupSelection *group, GroupTabBarSlot *slot, int targetOpa
sAttrib.xTranslate = slot->region->extents.x1 - w->attrib.x + vx;
sAttrib.yTranslate = slot->region->extents.y1 - w->attrib.y + vy;
- (w->screen->drawWindow) (w, &sAttrib, getInfiniteRegion(),
+ FragmentAttrib fragment;
+ CompTransform wTransform = *transform;
+
+ initFragmentAttrib(&fragment, &sAttrib);
+
+ matrixTranslate(&wTransform, WIN_X(w), WIN_Y(w), 0.0f);
+ matrixScale(&wTransform, sAttrib.xScale, sAttrib.yScale, 0.0f);
+ matrixTranslate(&wTransform,
+ sAttrib.xTranslate / sAttrib.xScale - WIN_X(w),
+ sAttrib.yTranslate / sAttrib.yScale - WIN_Y(w),
+ 0.0f);
+
+ glPushMatrix();
+ glLoadMatrixf(wTransform.m);
+
+ (w->screen->drawWindow) (w, &wTransform, &fragment, getInfiniteRegion(),
PAINT_WINDOW_TRANSFORMED_MASK);
+ glPopMatrix();
+
addWindowDamage(w);
}
+
w->screen->drawWindowGeometry = oldDrawWindowGeometry;
w->screen->addWindowGeometry = oldAddWindowGeometry;
}
@@ -285,7 +303,8 @@ void groupRenderWindowTitle(GroupSelection *group)
* groupPaintTabBar
*
*/
-void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib, unsigned int mask, Region clipRegion)
+void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib,
+ const CompTransform *transform, unsigned int mask, Region clipRegion)
{
if (!group || !HAS_TOP_WIN(group) || !group->tabBar || (group->tabBar->state == PaintOff))
return;
@@ -397,7 +416,7 @@ void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib,
if (layer) {
CompMatrix matrix = layer->texture.matrix;
- FragmentAttrib fAttrib = { 0 };
+ FragmentAttrib fragment;
// remove the old x1 and y1 so we have a relative value
box.extents.x2 -= box.extents.x1;
@@ -424,6 +443,8 @@ void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib,
topTab->vCount = 0;
+ initFragmentAttrib(&fragment, &attrib);
+
addWindowGeometry(topTab, &matrix, 1, &box, clipRegion);
alpha = alpha * wAttrib->opacity / 0xffff;
@@ -431,15 +452,11 @@ void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib,
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4us(alpha, alpha, alpha, alpha);
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- pushWindowTransform(topTab, &attrib);
-
- (*group->screen->drawWindowTexture) (topTab,
- &layer->texture, &attrib, &fAttrib,
- PAINT_WINDOW_TRANSLUCENT_MASK | PAINT_WINDOW_TRANSFORMED_MASK);
-
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- glPopMatrix();
+ if (topTab->vCount)
+ (*group->screen->drawWindowTexture) (topTab,
+ &layer->texture, &fragment, mask |
+ PAINT_WINDOW_TRANSLUCENT_MASK |
+ PAINT_WINDOW_TRANSFORMED_MASK);
screenTexEnvMode(s, GL_REPLACE);
@@ -462,7 +479,7 @@ void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib,
for(slot = bar->slots; slot; slot = slot->next)
{
if(slot != gs->draggedSlot || !gs->dragged)
- groupPaintThumb(group, slot, wAttrib->opacity);
+ groupPaintThumb(group, slot, transform, wAttrib->opacity);
}
s->display->textureFilter = oldTextureFilter;
@@ -474,6 +491,7 @@ void groupPaintTabBar(GroupSelection * group, const WindowPaintAttrib *wAttrib,
*/
static void
groupPaintSelectionOutline (CompScreen *s, const ScreenPaintAttrib *sa,
+ const CompTransform *transform,
int output, Bool transformed)
{
GROUP_SCREEN(s);
@@ -486,14 +504,16 @@ groupPaintSelectionOutline (CompScreen *s, const ScreenPaintAttrib *sa,
y2 = MAX(gs->y1, gs->y2);
if (gs->grabState == ScreenGrabSelect) {
- glPushMatrix();
+ CompTransform sTransform = *transform;
if (transformed) {
- glLoadIdentity();
- (s->applyScreenTransform) (s, sa, output);
- prepareXCoords(s, output, -sa->zTranslate);
+ (s->applyScreenTransform) (s, sa, output, &sTransform);
+ transformToScreenSpace (s, output, -sa->zTranslate, &sTransform);
} else
- prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
+ transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
+
+ glPushMatrix();
+ glLoadMatrixf(sTransform.m);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_BLEND);
@@ -566,6 +586,7 @@ void groupPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
Bool
groupPaintScreen(CompScreen * s,
const ScreenPaintAttrib * sAttrib,
+ const CompTransform *transform,
Region region, int output, unsigned int mask)
{
GROUP_SCREEN(s);
@@ -586,7 +607,7 @@ groupPaintScreen(CompScreen * s,
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
UNWRAP(gs, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
+ status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
WRAP(gs, s, paintScreen, groupPaintScreen);
gs->isRotating = FALSE;
@@ -594,19 +615,23 @@ groupPaintScreen(CompScreen * s,
if (status && !gs->painted) {
if ((gs->grabState == ScreenGrabTabDrag) && gs->draggedSlot) {
GROUP_WINDOW(gs->draggedSlot->window);
+
+ CompTransform wTransform = *transform;
+
+ transformToScreenSpace(s, output, -DEFAULT_Z_CAMERA, &wTransform);
glPushMatrix();
- prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
+ glLoadMatrixf(wTransform.m);
// prevent tab bar drawing..
PaintState state = gw->group->tabBar->state;
gw->group->tabBar->state = PaintOff;
- groupPaintThumb(NULL, gs->draggedSlot, 0xffff);
+ groupPaintThumb(NULL, gs->draggedSlot, &wTransform, 0xffff);
gw->group->tabBar->state = state;
glPopMatrix();
} else if (gs->grabState == ScreenGrabSelect) {
- groupPaintSelectionOutline (s, sAttrib, output, FALSE);
+ groupPaintSelectionOutline (s, sAttrib, transform, output, FALSE);
}
}
@@ -619,6 +644,7 @@ groupPaintScreen(CompScreen * s,
*/
void
groupPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
+ const CompTransform *transform,
Region region, int output, unsigned int mask)
{
GROUP_SCREEN(s);
@@ -627,24 +653,25 @@ groupPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
(fmod(sa->vRotate, 90.0) != 0.0));
UNWRAP(gs, s, paintTransformedScreen);
- (*s->paintTransformedScreen) (s, sa, region, output, mask);
+ (*s->paintTransformedScreen) (s, sa, transform, region, output, mask);
WRAP(gs, s, paintTransformedScreen, groupPaintTransformedScreen);
if ((gs->vpX == s->x) && (gs->vpY == s->y)) {
gs->painted = TRUE;
if ((gs->grabState == ScreenGrabTabDrag) && gs->draggedSlot && gs->dragged) {
+ CompTransform wTransform = *transform;
+
+ (s->applyScreenTransform) (s, sa, output, &wTransform);
+ transformToScreenSpace(s, output, -sa->zTranslate, &wTransform);
glPushMatrix();
+ glLoadMatrixf(wTransform.m);
- glLoadIdentity();
- (s->applyScreenTransform) (s, sa, output);
- prepareXCoords(s, output, -sa->zTranslate);
-
- groupPaintThumb(NULL, gs->draggedSlot, 0xffff);
+ groupPaintThumb(NULL, gs->draggedSlot, &wTransform, 0xffff);
glPopMatrix();
} else if (gs->grabState == ScreenGrabSelect) {
- groupPaintSelectionOutline (s, sa, output, TRUE);
+ groupPaintSelectionOutline (s, sa, transform, output, TRUE);
}
}
}
@@ -855,7 +882,8 @@ groupComputeGlowQuads (CompWindow *w, CompMatrix *matrix)
*/
Bool
groupDrawWindow(CompWindow * w,
- const WindowPaintAttrib * attrib,
+ const CompTransform *transform,
+ const FragmentAttrib *attrib,
Region region, unsigned int mask)
{
Bool status;
@@ -886,12 +914,11 @@ groupDrawWindow(CompWindow * w,
}
if (w->vCount) {
- WindowPaintAttrib wAttrib = *attrib;
- FragmentAttrib fAttrib = { 0 };
+ FragmentAttrib fAttrib = *attrib;
- wAttrib.opacity = OPAQUE;
- wAttrib.saturation = COLOR;
- wAttrib.brightness = BRIGHT;
+ fAttrib.opacity = OPAQUE;
+ fAttrib.saturation = COLOR;
+ fAttrib.brightness = BRIGHT;
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE); - maybe add an option for that...
@@ -899,19 +926,12 @@ groupDrawWindow(CompWindow * w,
glColor4us(gw->group->color[0], gw->group->color[1],
gw->group->color[2], attrib->opacity);
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- pushWindowTransform(w, &wAttrib);
-
/* we use PAINT_WINDOW_TRANSFORMED_MASK here to force
the usage of a good texture filter */
(*w->screen->drawWindowTexture) (w, &gs->glowTexture,
- &wAttrib, &fAttrib,
- mask | PAINT_WINDOW_TRANSLUCENT_MASK |
+ &fAttrib, mask | PAINT_WINDOW_TRANSLUCENT_MASK |
PAINT_WINDOW_TRANSFORMED_MASK | PAINT_WINDOW_DECORATION_MASK);
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- glPopMatrix();
-
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
screenTexEnvMode (w->screen, GL_REPLACE);
glColor4usv(defaultColor);
@@ -920,7 +940,7 @@ groupDrawWindow(CompWindow * w,
}
UNWRAP(gs, w->screen, drawWindow);
- status = (*w->screen->drawWindow) (w, attrib, region, mask);
+ status = (*w->screen->drawWindow) (w, transform, attrib, region, mask);
WRAP(gs, w->screen, drawWindow, groupDrawWindow);
return status;
@@ -933,14 +953,17 @@ groupDrawWindow(CompWindow * w,
Bool
groupPaintWindow(CompWindow * w,
const WindowPaintAttrib * attrib,
+ const CompTransform *transform,
Region region, unsigned int mask)
{
+ FragmentAttrib fragment;
Bool status;
Bool doRotate;
GROUP_SCREEN(w->screen);
GROUP_WINDOW(w);
WindowPaintAttrib gAttrib = *attrib;
+ CompTransform wTransform = *transform;
if (gw->inSelection) {
int opacity = gs->opt[GROUP_SCREEN_OPTION_OPACITY].value.i;
@@ -984,6 +1007,8 @@ groupPaintWindow(CompWindow * w,
gAttrib.opacity = gAttrib.opacity * opacity / 100;
}
+
+ initFragmentAttrib(&fragment, &gAttrib);
doRotate = gw->group && (gw->group->changeState != PaintOff) &&
(IS_TOP_TAB(w, gw->group) || IS_PREV_TOP_TAB(w, gw->group));
@@ -1003,27 +1028,28 @@ groupPaintWindow(CompWindow * w,
if (gw->group->changeAnimationDirection < 0)
rotateAngle *= -1.0f;
+ matrixScale(&wTransform, 1.0f, 1.0f, 1.0f / w->screen->width);
+ matrixTranslate(&wTransform, WIN_X(w) + WIN_WIDTH(w)/2.0f, 0.0f, 0.0f);
+ matrixRotate(&wTransform, rotateAngle, 0.0f, 1.0f, 0.0f);
+ matrixTranslate(&wTransform, -WIN_X(w) - WIN_WIDTH(w)/2.0f, 0.0f, 0.0f);
+
glPushMatrix();
+ glLoadMatrixf(wTransform.m);
- glScalef(1.0f, 1.0f, 1.0f / w->screen->width);
-
- glTranslatef(WIN_X(w) + WIN_WIDTH(w)/2.0f, 0.0f, 0.0f);
- glRotatef(rotateAngle, 0.0f, 1.0f, 0.0f);
- glTranslatef(-WIN_X(w) - WIN_WIDTH(w)/2.0f, 0.0f, 0.0f);
mask |= PAINT_WINDOW_TRANSFORMED_MASK;
}
UNWRAP(gs, w->screen, paintWindow);
- status = (*w->screen->paintWindow) (w, &gAttrib, region, mask);
+ status = (*w->screen->paintWindow) (w, &gAttrib, &wTransform, region, mask);
if (gw->group && gw->group->tabBar) {
if (HAS_TOP_WIN(gw->group) && IS_TOP_TAB(w, gw->group)) {
if ((gw->group->changeState == PaintOff) || (gw->group->changeState == PaintFadeOut))
- groupPaintTabBar(gw->group, attrib, mask, region);
+ groupPaintTabBar(gw->group, attrib, &wTransform, mask, region);
} else if (IS_PREV_TOP_TAB(w, gw->group)) {
if (gw->group->changeState == PaintFadeIn)
- groupPaintTabBar(gw->group, attrib, mask, region);
+ groupPaintTabBar(gw->group, attrib, &wTransform, mask, region);
}
}