> Let us have a look at the patch; then we can decide.

Ok. Here goes.

Remko


Index: modules/FvwmButtons/FvwmButtons.1
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.1,v
retrieving revision 1.61
diff -u -r1.61 FvwmButtons.1
--- modules/FvwmButtons/FvwmButtons.1   9 Nov 2002 15:18:52 -0000       1.61
+++ modules/FvwmButtons/FvwmButtons.1   25 Jun 2003 14:44:50 -0000
@@ -169,6 +169,12 @@
 Specifies a background pixmap to use.  Specify "none" (without the
 double quotes) for a transparent background.
 
+.IP "*FvwmButtons: ReliefStyle \fIstate\fP \fIstyle\fP"
+Specifies which style of relief to draw when the button is in the given
+state. \fIstate\fP can be either \fIUp\fP or \fIDown\fP. \fIstyle\fP 
+is one of \fIClean\fP (draws the background color), \fIRaised\fP or 
+\fISunken\fP.
+
 .IP "*FvwmButtons: Rows \fIrows\fP"
 Specifies the number of rows of buttons to be created. The default
 is 2 rows.
Index: modules/FvwmButtons/FvwmButtons.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.c,v
retrieving revision 1.179
diff -u -r1.179 FvwmButtons.c
--- modules/FvwmButtons/FvwmButtons.c   25 Apr 2003 07:21:00 -0000      1.179
+++ modules/FvwmButtons/FvwmButtons.c   25 Jun 2003 14:44:50 -0000
@@ -780,6 +780,8 @@
 
   UberButton->title   = MyName;
   UberButton->swallow = 1; /* the panel is shown */
+  UberButton->reliefstyle  = (RELIEFSTYLE_RAISED << 4) |
+                            (RELIEFSTYLE_SUNKEN); /* Default relief */
 
   /* parse module options */
   ParseConfiguration(UberButton);
Index: modules/FvwmButtons/FvwmButtons.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.h,v
retrieving revision 1.43
diff -u -r1.43 FvwmButtons.h
--- modules/FvwmButtons/FvwmButtons.h   5 Jun 2003 14:00:21 -0000       1.43
+++ modules/FvwmButtons/FvwmButtons.h   25 Jun 2003 14:44:50 -0000
@@ -89,6 +89,7 @@
                     0x02000000 /* By default this only done on Popup */
 #define b_Id         0x04000000 /* Has a user defined id for referencing */
 #define b_IconAlpha  0x08000000 /* Icon has an alpha chanel */
+#define b_ReliefStyle 0x10000000 /* Relief Style */
 
 /* Flags for b->swallow */
 #define b_Count       0x0003 /* Init counter for swallowing */
@@ -139,6 +140,7 @@
   Pixel bc,hc,sc;          /* b_Back && !b_IconBack */
   FvwmPicture *backicon;   /* b_Back && b_IconBack */
   ushort minx,miny;        /* b_Size */
+  byte reliefstyle;        /* b_ReliefStyle */
 };
 
 typedef struct
@@ -169,6 +171,10 @@
   char *back;              /* b_Back */
   char *fore;              /* b_Fore */
   int colorset;            /* b_Colorset */
+#define RELIEFSTYLE_CLEAN  0x0  /* No relief */
+#define RELIEFSTYLE_RAISED 0x1  /* Raised relief */
+#define RELIEFSTYLE_SUNKEN 0x2  /* Sunken relief */
+  byte reliefstyle;        /* b_ReliefStyle */
   byte xpad,ypad;          /* b_Padding */
   signed char framew;      /* b_Frame */
   byte justify;            /* b_Justify */
Index: modules/FvwmButtons/button.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/button.c,v
retrieving revision 1.31
diff -u -r1.31 button.c
--- modules/FvwmButtons/button.c        1 Oct 2002 07:03:29 -0000       1.31
+++ modules/FvwmButtons/button.c        25 Jun 2003 14:44:50 -0000
@@ -309,6 +309,24 @@
   return -1;
 }
 
+byte buttonReliefStyle(button_info *b)
+{
+    button_info *bb = b;
+    if (bb->flags & b_ReliefStyle) 
+        return bb->reliefstyle;
+    else if (bb->flags & b_Container && bb->c->flags & b_ReliefStyle)
+        return bb->reliefstyle;
+    while ((bb = bb->parent))
+    {
+        if (bb->c->flags & b_ReliefStyle)
+            return bb->c->reliefstyle;
+    }
+#ifdef DEBUG
+    fprintf(stderr,"%s: BUG: No relief definition?\n",MyName);
+#endif
+    return (RELIEFSTYLE_RAISED<<4) | RELIEFSTYLE_SUNKEN;
+}
+
 int buttonBackgroundButton(button_info *b, button_info **r_b)
 {
        button_info *tmpb, *pb;
@@ -515,6 +533,7 @@
     b->c->back=safestrdup("rgb:90/80/90");
     b->c->fore=safestrdup("black");
     b->c->framew=2;
+    b->c->reliefstyle= (RELIEFSTYLE_RAISED<<4) | RELIEFSTYLE_SUNKEN;
   }
 
 }
Index: modules/FvwmButtons/button.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/button.h,v
retrieving revision 1.14
diff -u -r1.14 button.h
--- modules/FvwmButtons/button.h        1 Oct 2002 07:03:29 -0000       1.14
+++ modules/FvwmButtons/button.h        25 Jun 2003 14:44:50 -0000
@@ -42,6 +42,7 @@
 Pixel buttonHilite(button_info*);
 Pixel buttonShadow(button_info*);
 int buttonColorset(button_info *b);
+byte buttonReliefStyle(button_info *b);
 int buttonBackgroundButton(button_info *b, button_info **r_b);
 byte buttonSwallow(button_info*);
 byte buttonJustify(button_info*);
Index: modules/FvwmButtons/draw.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/draw.c,v
retrieving revision 1.56
diff -u -r1.56 draw.c
--- modules/FvwmButtons/draw.c  13 Feb 2003 20:52:40 -0000      1.56
+++ modules/FvwmButtons/draw.c  25 Jun 2003 14:44:50 -0000
@@ -61,30 +61,51 @@
 *** RelieveButton()
 *** Draws the relief pattern around a window.
 **/
-void RelieveButton(Window wn,int width,int x,int y,int w,int h,Pixel relief,
-                  Pixel shadow,int rev)
+void RelieveButton(Window wn,int width,int x,int y,int w,int h,Pixel backgr,
+           Pixel relief, Pixel shadow,int buttonstate, byte reliefstyle)
 {
-  XGCValues gcv;
-  GC swapGC, reliefGC, shadowGC;
+  XGCValues reliefGCV,shadowGCV;
+  GC reliefGC, shadowGC, swapGC;
+  byte reliefStyle;
 
   if(!width)
     return;
 
-  gcv.foreground=relief;
-  XChangeGC(Dpy,NormalGC,GCForeground,&gcv);
+  reliefStyle = (buttonstate ? reliefstyle & 0xf          /* Button down */
+                             : (reliefstyle & 0xf0)>>4 ); /* Button up */
+  
+  switch (reliefStyle) {
+      case RELIEFSTYLE_RAISED:
+          reliefGCV.foreground = relief;
+          shadowGCV.foreground = shadow;
+          break;
+      case RELIEFSTYLE_SUNKEN:
+          reliefGCV.foreground = shadow;
+          shadowGCV.foreground = relief;
+          break;
+      case RELIEFSTYLE_CLEAN:
+          reliefGCV.foreground = backgr;
+          shadowGCV.foreground = backgr;
+          break;
+      default:
+          /* Shouldnt happen */
+          #ifdef DEBUG
+          fprintf(stderr,"%s: BUG: Illegal reliefstyle: %x\n",MyName,
+                                                                reliefStyle);
+          #endif
+          reliefGCV.foreground = backgr;
+          shadowGCV.foreground = backgr;
+  }
+
+  XChangeGC(Dpy,NormalGC,GCForeground,&reliefGCV);
   reliefGC=NormalGC;
 
-  gcv.foreground=shadow;
-  XChangeGC(Dpy,ShadowGC,GCForeground,&gcv);
+  XChangeGC(Dpy,ShadowGC,GCForeground,&shadowGCV);
   shadowGC=ShadowGC;
-
+  
   if(width<0)
   {
     width=-width;
-    rev = !rev;
-  }
-  if(rev)
-  {
     swapGC=reliefGC;
     reliefGC=shadowGC;
     shadowGC=swapGC;
@@ -618,7 +639,8 @@
        }
 
        /* relief */
-       RelieveButton(MyWindow,of,x,y,BW,BH,hc,sc,rev ^ rev_xor);
+       RelieveButton(MyWindow,of,x,y,BW,BH,bc,hc,sc,rev ^ rev_xor, 
+                  buttonReliefStyle(b));
 }
 
 /**
Index: modules/FvwmButtons/draw.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/draw.h,v
retrieving revision 1.11
diff -u -r1.11 draw.h
--- modules/FvwmButtons/draw.h  5 Nov 2002 12:30:29 -0000       1.11
+++ modules/FvwmButtons/draw.h  25 Jun 2003 14:44:50 -0000
@@ -33,7 +33,7 @@
 #define DRAW_FORCE       3
 #define DRAW_DESK_RELIEF 4
 
-void RelieveButton(Window,int,int,int,int,int,Pixel,Pixel,int);
+void RelieveButton(Window,int,int,int,int,int,Pixel,Pixel,Pixel,int,byte);
 void MakeButton(button_info*);
 void RedrawButton(button_info*, int draw, XEvent *pev);
 void DrawTitle(
Index: modules/FvwmButtons/output.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/output.c,v
retrieving revision 1.13
diff -u -r1.13 output.c
--- modules/FvwmButtons/output.c        26 Jun 2002 13:42:45 -0000      1.13
+++ modules/FvwmButtons/output.c        25 Jun 2003 14:44:50 -0000
@@ -66,6 +66,8 @@
     fprintf(stderr,"Title(%s) ",b->title);
   if(b->flags&b_Icon)
     fprintf(stderr,"Icon(%s,%i) ",b->icon_file,(int)b->IconWin);
+  if(b->flags&b_ReliefStyle) 
+        fprintf(stderr,"Relief(%x) ",b->reliefstyle); 
   if(b->flags&b_Icon)
     fprintf(stderr,"Panelw(%i) ",(int)b->PanelWin);
   if(b->flags&b_Action)
@@ -128,6 +130,18 @@
     fprintf(stderr,"Frame %i ",b->framew);
   if(b->flags&b_Padding)
     fprintf(stderr,"Padding %i %i ",b->xpad,b->ypad);
+  if(b->flags&b_ReliefStyle) {
+    switch((b->reliefstyle & 0xf0)>>4) {
+        case RELIEFSTYLE_CLEAN: fprintf(stderr,"Relief up clean "); break;
+        case RELIEFSTYLE_SUNKEN: fprintf(stderr,"Relief up sunken "); break;
+        case RELIEFSTYLE_RAISED: fprintf(stderr,"Relief up raised "); break;
+    }
+    switch((b->reliefstyle & 0xf)) {
+        case RELIEFSTYLE_CLEAN: fprintf(stderr,"Relief down clean "); break;
+        case RELIEFSTYLE_SUNKEN: fprintf(stderr,"Relief down sunken "); break;
+        case RELIEFSTYLE_RAISED: fprintf(stderr,"Relief down raised "); break;
+    }
+  }
   if(b->flags&b_Title)
   {
     fprintf(stderr,"Title ");
@@ -241,6 +255,18 @@
        fprintf(stderr,"Frame %i ",b->c->framew);
       if(b->c->flags&b_Padding)
        fprintf(stderr,"Padding %i %i ",b->c->xpad,b->c->ypad);
+      if(b->c->flags&b_ReliefStyle) {
+        switch((b->c->reliefstyle & 0xf0)>>4) {
+          case RELIEFSTYLE_CLEAN: fprintf(stderr,"Relief up clean "); break;
+          case RELIEFSTYLE_SUNKEN: fprintf(stderr,"Relief up sunken "); break;
+          case RELIEFSTYLE_RAISED: fprintf(stderr,"Relief up raised "); break;
+        }
+        switch((b->c->reliefstyle & 0xf)) {
+          case RELIEFSTYLE_CLEAN: fprintf(stderr,"Relief down clean "); break;
+          case RELIEFSTYLE_SUNKEN: fprintf(stderr,"Relief down sunken "); 
break;
+          case RELIEFSTYLE_RAISED: fprintf(stderr,"Relief down raised "); 
break;
+        }
+      }
       if(b->c->flags&b_Justify)
       {
        fprintf(stderr,"Title (");
Index: modules/FvwmButtons/parse.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/parse.c,v
retrieving revision 1.82
diff -u -r1.82 parse.c
--- modules/FvwmButtons/parse.c 25 Apr 2003 07:21:00 -0000      1.82
+++ modules/FvwmButtons/parse.c 25 Jun 2003 14:44:50 -0000
@@ -242,6 +242,84 @@
   *ss=s;
 }
 
+static void ParseReliefStyle(char **ss, button_info *b,
+                        byte *reliefstyle, unsigned long *flags)
+{
+    char *stateopts[] =
+    {
+      "up",
+      "down",
+      NULL
+    };
+    char *styleopts[] =
+    {
+      "clean",
+      "raised",
+      "sunken",
+      NULL
+    };
+    char *t,*s=*ss;
+    int state; 
+    byte style;
+    
+    /* Parse state */
+    s = trimleft(s);
+    state = GetTokenIndex(s,stateopts,-1,&s);
+    if (state < 0)  {
+            t = seekright(&s);
+            fprintf(stderr,"%s: Illegal relief state \"%s\"\n",
+                                                        MyName,(t)?t:""); 
+            s = trimleft(s);
+            t = seekright(&s);
+            if (t) free (t);
+            if (*s) s++;
+            *ss=s;
+            return;
+    }
+
+    /* Parse style */
+    s = trimleft(s);
+    switch (GetTokenIndex(s,styleopts,-1,&s)) 
+    {
+        case 0: /* Clean */
+            style = RELIEFSTYLE_CLEAN;
+            break;
+        case 1: /* Raised */
+            style = RELIEFSTYLE_RAISED;
+            break;
+        case 2: /* Sunken */
+            style = RELIEFSTYLE_SUNKEN;
+            break;
+        default:
+            t = seekright(&s);
+            fprintf(stderr,"%s: Illegal relief style \"%s\"\n",
+                                                        MyName,(t)?t:""); 
+            if(t) free (t);
+            if (*s) s++;
+            *ss=s;
+            return;
+    }
+    
+    /* Initialize defaults */
+    if (!(*flags & b_ReliefStyle)) {
+        *reliefstyle = buttonReliefStyle(b);
+        *flags |= b_ReliefStyle;
+    }
+
+    /* Set relief style */
+    switch (state) {
+        case 0: /* Up */
+            *reliefstyle = (*reliefstyle & ~0xf0) | style << 4;
+            break;
+        case 1: /* Down */
+            *reliefstyle = (*reliefstyle & ~0xf) | style;
+            break;
+    }
+
+    if (*s) s++;
+    *ss=s;
+}
+
 /**
 *** ParseSwallow()
 *** Parses the options possible to Swallow
@@ -576,6 +654,7 @@
     "size",
     "boxsize",
     "colorset",
+    "reliefstyle",
     NULL
   };
   char *t,*o,*s=*ss;
@@ -748,6 +827,10 @@
       }
       break;
 
+    case 13: /* Relief Style */
+        ParseReliefStyle(&s,b,&b->c->reliefstyle,&b->c->flags);
+        break;
+
     default:
       t=seekright(&s);
       fprintf(stderr,"%s: Illegal container option \"%s\"\n",MyName,
@@ -802,6 +885,7 @@
       "colorset",
       "action",
       "id",
+      "reliefstyle",
       NULL
     };
     s = trimleft(s);
@@ -1250,6 +1334,10 @@
        }
        break;
 
+      case 21: /* ReliefStyle */
+           ParseReliefStyle(&s,b,&b->reliefstyle,&b->flags);
+        break;
+        
       default:
        t=seekright(&s);
        fprintf(stderr,"%s: Illegal button option \"%s\"\n",MyName,
@@ -1348,6 +1436,7 @@
   return;
 }
 
+
 /**
 *** ParseConfigLine
 **/
@@ -1369,6 +1458,7 @@
     "pixmap",
     "boxsize",
     "colorset",
+    "reliefstyle",
     NULL
   };
   int i,j,k;
@@ -1467,6 +1557,11 @@
       ub->c->flags &= ~b_Colorset;
     }
     break;
+ 
+  case 13: /* Relief */ 
+    ParseReliefStyle(&s,ub,&ub->c->reliefstyle,&ub->c->flags);
+    break;
+  
   default:
     s = trimleft(s);
     ParseButton(ubb,s);
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to