Subject: Support for "BorderStyle -- Flat"

From: Tony Finch <[email-masked]>
Date: Fri, 10 Sep 1999 20:44:37 +0100

I prefer a very uncluttered look to my window manager. I'm switching
from ctwm to fvwm2 because fvwm is more keyboardable, but it's harder
to turn off the 3D look in fvwm. This patch makes "BorderStyle --
Flat" do the expected thing.

An alternative (and somewhat more thorough/flexible) would be to allow
the user to specify the relief and shadow colours.

BTW, I'm not subscribed to the list.

Tony.
-- 
f.a.n.finch    [email-masked]    [email-masked]    e pluribus unix

--- add_window.c.old    Fri Sep 10 20:41:55 1999
+++ 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 |
--- borders.c.old       Fri Sep 10 19:38:47 1999
+++ borders.c   Fri Sep 10 20:15:44 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),
--
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-masked].
To report problems, send mail to [email-masked]

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 13 Sep 1999 13:26:50 +0200

> Flat" do the expected thing.

Hi Tony,

the development sources are already too far away from this patch
to apply cleanly. Could you please create a patch for the current
sources? You'll find instructions on how to fetch the latest
sources on our web page (downloads) at http://fvwm.org . If you
don't have CVS, fetch a snapshot.

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
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-masked].
To report problems, send mail to [email-masked]