[beryl-commits] r1518 - branches/beryl-group-with-tab-plugin
svn at server.beryl-project.org
svn at server.beryl-project.org
Sun Dec 3 22:19:07 CET 2006
Author: svn
Date: 2006-12-03 22:19:06 +0100 (Sun, 03 Dec 2006)
New Revision: 1518
Modified:
branches/beryl-group-with-tab-plugin/Makefile
branches/beryl-group-with-tab-plugin/group.c
Log:
Modified: branches/beryl-group-with-tab-plugin/Makefile
===================================================================
--- branches/beryl-group-with-tab-plugin/Makefile 2006-12-03 19:33:30 UTC (rev 1517)
+++ branches/beryl-group-with-tab-plugin/Makefile 2006-12-03 21:19:06 UTC (rev 1518)
@@ -1,5 +1,4 @@
-DESTDIR = /usr/lib/beryl
-
+DESTDIR = ~/.beryl/plugins
PLUGIN = group
CC = gcc
Modified: branches/beryl-group-with-tab-plugin/group.c
===================================================================
--- branches/beryl-group-with-tab-plugin/group.c 2006-12-03 19:33:30 UTC (rev 1517)
+++ branches/beryl-group-with-tab-plugin/group.c 2006-12-03 21:19:06 UTC (rev 1518)
@@ -36,6 +36,10 @@
#include <beryl.h>
#include <beryl_ipcs.h>
+#include <math.h>
+
+#define PI 3.1415926535897
+
/*
* Defaults
*
@@ -1735,7 +1739,94 @@
}
}
+#define THUMB_SIZE 48
+#define SPACING 20
+#define BORDER_COLOR 0.0f, 0.0f, 0.0f, 1.0f
+#define BAR_COLOR 0.8f, 0.8f, 0.8f, 1.0f
+#define BORDER_RADIUS 10
+#define CIRCLE_POINTS 25
+#define WIDTH 50
+#define HEIGHT 50
+
+#define REAL_POSITION(x, s) ( (x >= 0)? x: x + (s)->hsize * (s)->width )
+
+#define VIEWPORT(x, s) ( ( REAL_POSITION(x, s) / (s)->width ) % (s)->hsize )
+
/*
+ * groupTabBarVertices
+ *
+ */
+
+static void
+groupTabBarVertices ()
+{
+ float angle;
+ int i;
+
+ for (i = 0; i <= CIRCLE_POINTS; i++)
+ {
+ angle = (PI / 2) * ((float)i/CIRCLE_POINTS);
+ glVertex2f(BORDER_RADIUS * cos(angle) + WIDTH - BORDER_RADIUS, -BORDER_RADIUS * sin(angle) + BORDER_RADIUS);
+ }
+
+ for (i = CIRCLE_POINTS; i >= 0; i--)
+ {
+ angle = (PI / 2) * ((float)i/CIRCLE_POINTS);
+ glVertex2f(-BORDER_RADIUS * cos(angle) + BORDER_RADIUS, -BORDER_RADIUS * sin(angle) + BORDER_RADIUS);
+ }
+
+
+ for (i = 0; i <= CIRCLE_POINTS; i++)
+ {
+ angle = (PI / 2) * ((float)i/CIRCLE_POINTS);
+ glVertex2f(-BORDER_RADIUS * cos(angle) + BORDER_RADIUS, BORDER_RADIUS * sin(angle) + HEIGHT - BORDER_RADIUS);
+ }
+
+ for (i = CIRCLE_POINTS; i >= 0; i--)
+ {
+ angle = (PI / 2) * ((float)i/CIRCLE_POINTS);
+ glVertex2f(BORDER_RADIUS * cos(angle) + WIDTH - BORDER_RADIUS, BORDER_RADIUS * sin(angle) + HEIGHT - BORDER_RADIUS);
+ }
+}
+
+/*
+ * groupPaintTabBar
+ *
+ */
+static void
+groupPaintTabBar (GroupSelection* group)
+{
+ if(!group->tabbed)
+ return;
+
+ if(VIEWPORT(group->topTab->attrib.x, group->topTab->screen))
+ return;
+
+ glTranslatef(group->topTab->serverX, group->topTab->serverY, 0.0f);
+
+ glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+ glEnable (GL_BLEND);
+
+ glBegin(GL_POLYGON);
+ groupTabBarVertices();
+ glEnd();
+
+ glColor4f(BORDER_COLOR);
+
+ glBegin(GL_LINE_LOOP);
+ groupTabBarVertices();
+ glEnd();
+
+ glColor4usv (defaultColor);
+
+ glDisable (GL_BLEND);
+ glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+
+ glTranslatef(-group->topTab->serverX, -group->topTab->serverY, 0.0f);
+
+ addWindowDamage(group->topTab);
+}
+/*
* groupPreparePaintScreen
*
*/
@@ -1767,6 +1858,12 @@
Bool status;
gs->wasTransformed = FALSE;
+ if (mask & PAINT_SCREEN_ORDER_FRONT_TO_BACK_MASK)
+ mask &= ~PAINT_SCREEN_ORDER_FRONT_TO_BACK_MASK;
+
+ if (!(mask & PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK))
+ mask |= PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK;
+
UNWRAP (gs, s, paintScreen);
status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (gs, s, paintScreen, groupPaintScreen);
@@ -1880,6 +1977,7 @@
Bool status;
GROUP_WINDOW (w);
GROUP_SCREEN (w->screen);
+ GROUP_DISPLAY (w->screen->display);
WindowPaintAttrib gAttrib = *attrib;
@@ -1901,6 +1999,10 @@
UNWRAP (gs, w->screen, paintWindow);
status = (*w->screen->paintWindow) (w, &gAttrib, region, mask);
WRAP (gs, w->screen, paintWindow, groupPaintWindow);
+
+ int index = groupFindGroupAtDisplay (gd, gw->groupID);
+ if (index != -1)
+ groupPaintTabBar(&gd->groups[index]);
return status;
}
More information about the commits
mailing list