Hi,

I've created a patch that allows filled polygons as vector buttons. To
use it, just increase the desired line color by ten. It also works in
combination with normal lines.
An arrow filled with the highlight color would be:
[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL 
PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]

I've neither done heavy testing, nor do I know if it's done the right
way. But perhaps it is useful for anyone.

Cu,
  Volker.

Index: fvwm/borders.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/borders.c,v
retrieving revision 1.251
diff -u -r1.251 borders.c
--- fvwm/borders.c	27 Jan 2007 11:33:15 -0000	1.251
+++ fvwm/borders.c	14 Mar 2008 03:44:20 -0000
@@ -1668,7 +1668,8 @@
 	struct vector_coords *coords, rectangle *pixmap_g)
 {
 	GC gcs[4];
-	int i;
+	int i, poly_cnt;
+	XPoint poly[coords->num];
 
 	if (coords->use_fgbg == 1)
 	{
@@ -1690,13 +1691,44 @@
 		gcs[0] = cd->shadow_gc;
 		gcs[1] = cd->relief_gc;
 	}
+
+	poly_cnt = 0;
 	for (i = 1; i < coords->num; i++)
 	{
-		if (coords->c[i] < 0 || coords->c[i] >= 4)
+                /* c is already set to 4 on parsing if it shoudn't get drawn */
+		if (coords->c[i] == 4)
 		{
 			/* don't draw a line */
 			continue;
 		}
+		/* collect points for filled polygon */
+		if (coords->c[i] >= 10)
+		{
+			poly[poly_cnt].x = pixmap_g->width * 
+				coords->x[i-1] / 100 + coords->xoff[i-1];
+			poly[poly_cnt].y = pixmap_g->height *
+				coords->y[i-1] / 100 + coords->yoff[i-1];
+			poly_cnt++;
+
+			/* no points left or next line isn't part of the poly */
+			if ((i+1 == coords->num) || (coords->c[i+1] < 10)) {
+				poly[poly_cnt].x = pixmap_g->width * 
+					coords->x[i] / 100 + coords->xoff[i];
+				poly[poly_cnt].y = pixmap_g->height *
+					coords->y[i] / 100 + coords->yoff[i];
+				poly_cnt++;				
+
+				/* draw filled polygon */
+				XFillPolygon(dpy, dest_pix,
+					gcs[coords->c[i]-10],
+					poly, poly_cnt, 0, CoordModeOrigin);
+				poly_cnt = 0;
+
+			}
+			continue;
+		}
+
+
 		XDrawLine(
 			dpy, dest_pix, gcs[coords->c[i]],
 			pixmap_g->width * coords->x[i-1] / 100 +
Index: fvwm/builtins.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/builtins.c,v
retrieving revision 1.431
diff -u -r1.431 builtins.c
--- fvwm/builtins.c	31 Jan 2008 22:02:00 -0000	1.431
+++ fvwm/builtins.c	14 Mar 2008 03:44:21 -0000
@@ -1663,7 +1663,7 @@
 				{
 					y = 100;
 				}
-				if (c < 0 || c > 4)
+				if (c < 0 || (c > 4 && c<10) || c > 14)
 				{
 					c = 4;
 				}

Reply via email to