FVWM: Patch to title-bar patch

From: Richard Lister <listerrj_at_helios.aston.ac.uk>
Date: Sun, 11 Aug 1996 21:00:23 +0100

Hi folks

I started using Andrew Veliath's title-bar patch fvwm-2.0.43.tbp4.diff,
and it's fun! I like using something like:

  TitleStyle ActiveUp (Solid <backcolor>)

But I also wanted to change the foreground colour, so here's a patch
to do that. Now you say:

  TitleStyle ActiveUp (Solid <forecolor>/<backcolor>)

You need to start with a new fvwm-2.0.43, apply fvwm-2.0.43.tbp4.diff
to the whole distribution, then apply the patch below in the fvwm-2.0.43
directory.

Cheers
Ric

Richard J. Lister, Research Assistant
Neural Computing Research Group, Aston University
r.j.lister_at_aston.ac.uk
http://www.ncrg.aston.ac.uk/~listerrj/



diff -u fvwm.orig/borders.c fvwm/borders.c
--- fvwm.orig/borders.c Sun Aug 11 20:43:53 1996
+++ fvwm/borders.c Sun Aug 11 20:51:31 1996
_at_@ -483,7 +483,7 @@
             && (Scr.TitleStyle.appearance!=TITLE_FLAT)
             && (button_type == FullSolidButton))
             --h;
- XSetWindowBackground(dpy, win, bf->u.back);
+ XSetWindowBackground(dpy, win, bf->u.solid.back);
         XClearArea(dpy, win, border, border,
                    w - border * 2, h - border * 2,
                    False);
_at_@ -517,7 +517,7 @@
     {
     case SolidButton:
     case FullSolidButton:
- bf.u.back = Scr.TitleStyle.face[state].u.back;
+ bf.u.solid.back = Scr.TitleStyle.face[state].u.solid.back;
         DrawButton(t, win, 11, t->title_width, t->title_height, &bf, False);
         break;
 
_at_@ -536,6 +536,7 @@
     default:
         break;
     }
+
 }
 
 /****************************************************************************
_at_@ -607,7 +608,7 @@
       hor_off = (t->title_width - w)/2;
       break;
   }
-
+
   NewFontAndColor(Scr.WindowFont.font->fid,Forecolor, BackColor);
 
   if (onoroff)
_at_@ -618,7 +619,7 @@
 
   if (Scr.TitleStyle.face[state].style == SolidButton
       || Scr.TitleStyle.face[state].style == FullSolidButton)
- XSetWindowBackground(dpy,t->title_w,Scr.TitleStyle.face[state].u.back);
+ XSetWindowBackground(dpy,t->title_w,Scr.TitleStyle.face[state].u.solid.back);
   else
       XSetWindowBackground(dpy,t->title_w,BackColor);
 
_at_@ -661,6 +662,7 @@
     }
     DrawTitlebar(t, t->title_w, state);
     if(t->name != (char *)NULL)
+ NewFontAndColor(Scr.WindowFont.font->fid,Scr.TitleStyle.face[state].u.solid.fore, BackColor); /* change title foreground color */
       XDrawString (dpy, t->title_w,Scr.ScratchGC3,hor_off, Scr.WindowFont.y+1,
                    t->name, strlen(t->name));
   }
diff -u fvwm.orig/builtins.c fvwm/builtins.c
--- fvwm.orig/builtins.c Sun Aug 11 20:43:54 1996
+++ fvwm/builtins.c Sun Aug 11 20:36:50 1996
_at_@ -1413,7 +1413,7 @@
 void ReadTitleFace(char *s, TitleFace *tf)
 {
     int offset;
- char style[256], *file;
+ char style[256], *file, *tmp_color;
 
     if (sscanf(s, "%s%n", style, &offset) < 1) {
         fvwm_msg(ERR, "ReadTitleFace", "error in title face: %s", s);
_at_@ -1447,7 +1447,21 @@
         s = GetNextToken(s, &file);
         if (file && *file) {
             tf->style = !mystrncasecmp(style,"Solid",5) ? SolidButton : FullSolidButton;
- tf->u.back = GetColor(file);
+
+ /* parse out fore and back colors */
+ tmp_color = strtok(file, "/");
+ tf->u.solid.fore = GetColor(tmp_color);
+
+ if ( tmp_color = strtok(NULL, "/") ) {
+ tf->u.solid.back = GetColor(tmp_color);
+ }
+ else {
+ /* just in case only one color is given go to old behaviour */
+ tf->u.solid.back = tf->u.solid.fore;
+ tf->u.solid.fore = Scr.HiColors.fore;
+ fvwm_msg(ERR, "ReadTitleFace", "TitleStyle Solid Color spec is now 'fore/back'");
+ return;
+ }
         } else {
             fvwm_msg(ERR,"ReadTitleFace", "no color given for Solid face type");
             return;
diff -u fvwm.orig/fvwm2.man fvwm/fvwm2.man
--- fvwm.orig/fvwm2.man Sun Aug 11 20:43:58 1996
+++ fvwm/fvwm2.man Sun Aug 11 20:36:51 1996
_at_@ -1309,7 +1309,8 @@
 ButtonStyle command). Only pixmap button types are supported from the
 standard button style types, and only one pixmap can be given. There
 are two additional styles, "Solid" and "FullSolid." These styles,
-followed by a color, change the title-bar color in the given state.
+followed by a color pair (foreground/background), change the title-bar
+color in the given state.
 
 Pixmap justification flags are supported, and can optionally be
 prepended by "Tiled" (tiled pixmaps are not transparent). Examples:
diff -u fvwm.orig/screen.h fvwm/screen.h
--- fvwm.orig/screen.h Sun Aug 11 20:44:01 1996
+++ fvwm/screen.h Sun Aug 11 20:36:50 1996
_at_@ -117,7 +117,7 @@
     ButtonFaceStyle style;
     union {
         struct { Picture *up, *down; } picture;
- Pixel back;
+ ColorPair solid;
     } u;
 } ButtonFace;
 
_at_@ -126,7 +126,7 @@
     ButtonFaceStyle style;
     union {
         Picture *picture;
- Pixel back;
+ ColorPair solid;
     } u;
 } TitleFace;
 
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Sun Aug 11 1996 - 15:10:16 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST