Subject: faces 1.6.1 patch

From: Dean Luick <[email-masked]>
Date: Fri, 16 Jul 93 08:12:31 -0500

Hi, I'm not on this list but the faces documentation said that patches
should be posted here.

I have a slight enhancement for the X11 version of faces.  You may do
with it what you will.

1) Add a border width option.

2) Change the fg&bg of the pixmap GC and the tile GC.  The pixmap GC (gc)
   now has a fg of black and a background of white while the tile GC (tilegc)
   has the fg & bg in the options.

The second change is obviously debatable.  I did it so that I could make
the unused portion of the faces window look like my background.  Your
milage may vary.  If you don't like the 2nd change, remove the 2nd band
in x11.c.

dean

Dean Luick
National Instruments

*** extern.h.ORIG	Mon Nov 18 22:00:48 1991
--- extern.h	Fri Jul 16 07:28:05 1993
***************
*** 82,87 ****
--- 82,88 ----
  extern int facetype ;      /* Type of face file found. */
  extern int firsttime ;     /* Zeroised after first mail/printer check. */
  extern int flashes ;       /* Number of flashes for arrival of new mail. */
+ extern int border_width ;  /* Border width of window. */
  extern int fromc_found ;   /* Set if "From:" line found during processing. */
  extern int froms_found ;   /* Set if "From " line found during processing. */
  extern int height ;        /* Height in pixels of faces display. */
*** faces.h.ORIG	Mon Nov 18 22:00:49 1991
--- faces.h	Fri Jul 16 07:29:45 1993
***************
*** 102,110 ****
  enum mon_type { MONNEW, MONALL, MONPRINTER, MONPROG, MONUSERS } ;
  
  /* X resources used by faces. */
! enum res_type { R_WINGEOM, R_ICONGEOM, R_FGCOLOR, R_BGCOLOR,
!                 R_FONT,    R_BGICON,   R_PERIOD,  R_BELL,
!                 R_FLASH,   R_LOWER,    R_RAISE,   R_BUT1CLR, R_DISPHOST,
  #ifdef AUDIO_SUPPORT
                  R_AUDIO,   R_AUDIOCMD, R_BELLFILE
  #endif /*AUDIO_SUPPORT*/
--- 102,111 ----
  enum mon_type { MONNEW, MONALL, MONPRINTER, MONPROG, MONUSERS } ;
  
  /* X resources used by faces. */
! enum res_type { R_WINGEOM, R_ICONGEOM,    R_FGCOLOR, R_BGCOLOR,
!                 R_FONT,    R_BGICON,      R_PERIOD,  R_BELL,
!                 R_FLASH,   R_BORDERWIDTH, R_LOWER,   R_RAISE,
! 		R_BUT1CLR, R_DISPHOST,
  #ifdef AUDIO_SUPPORT
                  R_AUDIO,   R_AUDIOCMD, R_BELLFILE
  #endif /*AUDIO_SUPPORT*/
*** main.c.ORIG	Mon Nov 18 22:00:47 1991
--- main.c	Fri Jul 16 07:33:45 1993
***************
*** 63,68 ****
--- 63,69 ----
    "period",                /* Integer: period in seconds between checks. */
    "bell",                  /* Integer: number of beeps for new arrival. */
    "flash",                 /* Integer: number of flashes for new arrival. */
+   "borderWidth",           /* Integer: border width of window. */
    "lower",                 /* Boolean: lower window if no mail. */
    "raise",                 /* Boolean: raise window on update? */
    "button1clear",          /* Boolean: mouse button 1 clear window? */
***************
*** 150,155 ****
--- 151,157 ----
  int facetype ;          /* Type of face file found. */
  int firsttime = 1 ;     /* Zeroised after first mail/printer check. */
  int flashes = 0 ;       /* Number of flashes for arrival of new mail. */
+ int border_width = 2 ;	/* Border width of window. */
  int fromc_found = 0 ;   /* Set if "From:" line found during processing. */
  int froms_found = 0 ;   /* Set if "From " line found during processing. */
  int height ;            /* Height in pixels of faces display. */
***************
*** 743,751 ****
    if (get_str_resource(R_FONT,      str))      read_str(&fontname,      str) ;
    if (get_str_resource(R_BGICON,    str))      read_str(&bgicon,        str) ;
  
!   if (get_int_resource(R_PERIOD,    &intval))  period       = intval ;
!   if (get_int_resource(R_BELL,      &intval))  beeps        = intval ;
!   if (get_int_resource(R_FLASH,     &intval))  flashes      = intval ;
  
    if (get_bool_resource(R_LOWER,    &boolval)) lowerwindow  = boolval ;
    if (get_bool_resource(R_RAISE,    &boolval)) raisewindow  = boolval ;
--- 745,754 ----
    if (get_str_resource(R_FONT,      str))      read_str(&fontname,      str) ;
    if (get_str_resource(R_BGICON,    str))      read_str(&bgicon,        str) ;
  
!   if (get_int_resource(R_PERIOD,     &intval)) period       = intval ;
!   if (get_int_resource(R_BELL,       &intval)) beeps        = intval ;
!   if (get_int_resource(R_FLASH,      &intval)) flashes      = intval ;
!   if (get_int_resource(R_BORDERWIDTH,&intval)) border_width = intval ;
  
    if (get_bool_resource(R_LOWER,    &boolval)) lowerwindow  = boolval ;
    if (get_bool_resource(R_RAISE,    &boolval)) raisewindow  = boolval ;
*** x11.c.ORIG	Mon Nov 18 22:00:50 1991
--- x11.c	Fri Jul 16 07:36:06 1993
***************
*** 58,64 ****
  
  #define  F_ICON              0         /* Icon index to frame array. */
  #define  F_WINDOW            1         /* Window index to frame array. */
- #define  FACES_BORDER_WIDTH  2
  #define  FRAME_MASK          (ButtonPressMask  | ExposureMask | \
                                ButtonMotionMask | KeyPressMask)
  #define  ICON_MASK            ExposureMask
--- 58,63 ----
***************
*** 364,374 ****
    init_font() ;
    gc_mask = GCFont | GCForeground | GCBackground | GCGraphicsExposures ;
    gc_val.font = sfont->fid ;
!   gc_val.foreground = foregnd ;
!   gc_val.background = backgnd ;
    gc_val.graphics_exposures = False ;
    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
  
    tilegc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
    if (depth == 1) XSetFillStyle(dpy, tilegc, FillOpaqueStippled) ;
    else            XSetFillStyle(dpy, tilegc, FillTiled) ;
--- 363,375 ----
    init_font() ;
    gc_mask = GCFont | GCForeground | GCBackground | GCGraphicsExposures ;
    gc_val.font = sfont->fid ;
!   gc_val.foreground = BlackPixel(dpy, screen) ;
!   gc_val.background = WhitePixel(dpy, screen) ;
    gc_val.graphics_exposures = False ;
    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
  
+   gc_val.foreground = foregnd ;
+   gc_val.background = backgnd ;
    tilegc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
    if (depth == 1) XSetFillStyle(dpy, tilegc, FillOpaqueStippled) ;
    else            XSetFillStyle(dpy, tilegc, FillTiled) ;
***************
*** 576,582 ****
    winattrs.event_mask = FRAME_MASK ;
  
    frame[F_WINDOW] = XCreateWindow(dpy, root, size.x, size.y,
!                         size.width, size.height, FACES_BORDER_WIDTH,
                          CopyFromParent, InputOutput, CopyFromParent,
                          CWBackPixel | CWBorderPixel | CWEventMask, &winattrs) ;
  
--- 577,583 ----
    winattrs.event_mask = FRAME_MASK ;
  
    frame[F_WINDOW] = XCreateWindow(dpy, root, size.x, size.y,
!                         size.width, size.height, border_width,
                          CopyFromParent, InputOutput, CopyFromParent,
                          CWBackPixel | CWBorderPixel | CWEventMask, &winattrs) ;
  
***************
*** 583,589 ****
    winattrs.event_mask = ICON_MASK ;
  
    frame[F_ICON] = XCreateWindow(dpy, root,
!                         ix, iy, imagewidth, imageheight, FACES_BORDER_WIDTH,
                          CopyFromParent, InputOutput, CopyFromParent, 
                          CWBackPixel | CWBorderPixel | CWEventMask, &winattrs) ;
  
--- 584,590 ----
    winattrs.event_mask = ICON_MASK ;
  
    frame[F_ICON] = XCreateWindow(dpy, root,
!                         ix, iy, imagewidth, imageheight, border_width,
                          CopyFromParent, InputOutput, CopyFromParent, 
                          CWBackPixel | CWBorderPixel | CWEventMask, &winattrs) ;