--- fvwm/add_window.c.orig	Fri Sep 10 20:41:55 1999
+++ fvwm/add_window.c	Fri Sep 10 20:38:50 1999
@@ -426,7 +426,12 @@
       valuemask |= CWBackPixel;
     }
 
-  attributes.border_pixel = tmp_win->ShadowPixel;
+#if defined(PIXMAP_BUTTONS) && defined(BORDERSTYLE)
+    if (GetDecor(tmp_win,BorderStyle.active.style) & FlatButton)
+      attributes.border_pixel = tmp_win->BackPixel;
+    else 
+#endif
+      attributes.border_pixel = tmp_win->ShadowPixel;
 
   attributes.cursor = Scr.FvwmCursors[DEFAULT];
   attributes.event_mask = (SubstructureRedirectMask | ButtonPressMask |
--- fvwm/borders.c.orig	Fri Sep 10 19:38:47 1999
+++ fvwm/borders.c	Fri Sep 10 20:28:26 1999
@@ -121,13 +121,6 @@
     if((Scr.Hilite != t)&&(Scr.Hilite != NULL))
       SetBorder(Scr.Hilite,False,False,True,None);
 
-#if defined(PIXMAP_BUTTONS) && defined(BORDERSTYLE)
-    /* are we using textured borders? */
-    if ((GetDecor(t,BorderStyle.active.style)
-	 & ButtonFaceTypeMask) == TiledPixmapButton)
-	TexturePixmap = GetDecor(t,BorderStyle.active.u.p->picture);
-#endif
-
     /* set the keyboard focus */
     if((Mapped)&&(t->flags&MAPPED)&&(Scr.Hilite != t))
       w = t->w;
@@ -136,12 +129,21 @@
       w = t->icon_w;
     Scr.Hilite = t;
 
+#if defined(PIXMAP_BUTTONS) && defined(BORDERSTYLE)
+    /* are we using textured borders? */
+    if ((GetDecor(t,BorderStyle.active.style)
+	 & ButtonFaceTypeMask) == TiledPixmapButton)
+	TexturePixmap = GetDecor(t,BorderStyle.active.u.p->picture);
+    if (GetDecor(t,BorderStyle.active.style) & FlatButton)
+      BorderColor = GetDecor(t,HiColors.back);
+    else
+#endif
+      BorderColor = GetDecor(t,HiRelief.back);
     TextColor = GetDecor(t,HiColors.fore);
     BackPixmap= Scr.gray_pixmap;
     BackColor = GetDecor(t,HiColors.back);
     ReliefGC = GetDecor(t,HiReliefGC);
     ShadowGC = GetDecor(t,HiShadowGC);
-    BorderColor = GetDecor(t,HiRelief.back);
   }
   else
   {
@@ -159,8 +161,11 @@
     if ((GetDecor(t,BorderStyle.inactive.style)
 	 & ButtonFaceTypeMask) == TiledPixmapButton)
 	TexturePixmap = GetDecor(t,BorderStyle.inactive.u.p->picture);
+    if (GetDecor(t,BorderStyle.active.style) & FlatButton)
+      BorderColor = t->BackPixel;
+    else
 #endif
-
+      BorderColor = t->ShadowPixel;
     TextColor =t->TextPixel;
     BackPixmap = Scr.light_gray_pixmap;
     if(t->flags & STICKY)
@@ -174,7 +179,6 @@
     Globalgcv.foreground = t->ShadowPixel;
     XChangeGC(dpy,Scr.ScratchGC2,Globalgcm,&Globalgcv);
     ShadowGC = Scr.ScratchGC2;
-    BorderColor = t->ShadowPixel;
   }
 
   if(t->flags & ICONIFIED)
@@ -422,7 +426,7 @@
 				: (TOP_HILITE|BOTTOM_HILITE),
 				(0x0001<<i)
 		    );
-        } else
+        } else if (!(flags&FlatButton))
 #endif /* BORDERSTYLE */
 	    RelieveWindow(t,t->sides[i],0,0,
 			  ((i%2)?t->boundary_width:x),
@@ -456,7 +460,7 @@
 		    RelieveParts(t,i|HH_HILITE,
 				 ((i/2)?sgc:sgc),(vertical?sgc:sgc));
 	    }
-         } else {
+         } else if (!(flags&FlatButton)) {
 #endif /* ! BORDERSTYLE */
 	     RelieveWindow(t,t->corners[i],0,0,t->corner_width,
 			   ((i/2)?t->corner_width+t->bw:t->corner_width),
