Subject: FVWM: FvwmButtons backgroundPixmap patch

From: Patrice Fortier <[email-masked]>
Date: Wed, 30 Oct 1996 16:20:25 +0100 (MET)

I made a small patch for FvwmButtons to put a background pixmap
behind an icon. It uses the Back(Icon) command.
Like this (Goodstuff style)

*FvwmButtons(Back(Icon) TissueRed.xpm)	xterm	Xterm.xpm	Exec ""	color-xterm &

or (FvwmButtons style)

*FvwmButtons(Back(Icon) TissueRed.xpm,Title xterm,Icon Xterm.xpm, Action `Exec "" color-xterm &`)

Note that this only work on a per button basis. You can't do this for
a container for example. So you need to put the 'back' option on every
button definition (boring I know....)

To make a patch to change also the Container background pixmap will
require to modify the data structure and a lot of code... Since I'm
not the maintainer of FvwmButtons...

you can have a look here:
http://www.emi.u-bordeaux.fr/~fortier/Fvwm/index.html

----------------------------------Cut Here----------------------------------
*** FvwmButtons.c.orig	Sun Sep 29 09:19:05 1996
--- FvwmButtons.c	Wed Oct 30 12:20:32 1996
***************
*** 230,241 ****
      {
        if(b->flags&b_Icon)
  	DestroyPicture(Dpy,b->icon);
- /*
        if(b->flags&b_IconBack)
  	DestroyPicture(Dpy,b->backicon);
        if(b->flags&b_Container && b->c->flags&b_IconBack)
  	DestroyPicture(Dpy,b->c->backicon);
- */
      }
  
    exit(0);
--- 230,239 ----
*** button.c.orig	Wed Oct 30 12:14:59 1996
--- button.c	Mon Oct 28 20:47:16 1996
***************
*** 179,188 ****
  **/
  Pixel buttonBack(button_info *b)
  {
!   if(b->flags&b_Back)
      return b->bc;
    while((b=b->parent))
!     if(b->c->flags&b_Back)
        return b->c->bc;
  #ifdef DEBUG
    fprintf(stderr,"%s: BUG: No background definition?\n",MyName);
--- 179,188 ----
  **/
  Pixel buttonBack(button_info *b)
  {
!   if(b->flags&b_Back && !(b->flags&b_IconBack))
      return b->bc;
    while((b=b->parent))
!     if(b->c->flags&b_Back && !(b->flags&b_IconBack))
        return b->c->bc;
  #ifdef DEBUG
    fprintf(stderr,"%s: BUG: No background definition?\n",MyName);
***************
*** 196,205 ****
  **/
  Pixel buttonHilite(button_info *b)
  {
!   if(b->flags&b_Back)
      return b->hc;
    while((b=b->parent))
!     if(b->c->flags&b_Back)
        return b->c->hc;
  #ifdef DEBUG
    fprintf(stderr,"%s: BUG: No background definition?\n",MyName);
--- 196,205 ----
  **/
  Pixel buttonHilite(button_info *b)
  {
!   if(b->flags&b_Back && !(b->flags&b_IconBack))
      return b->hc;
    while((b=b->parent))
!     if(b->c->flags&b_Back && !(b->flags&b_IconBack))
        return b->c->hc;
  #ifdef DEBUG
    fprintf(stderr,"%s: BUG: No background definition?\n",MyName);
***************
*** 213,222 ****
  **/
  Pixel buttonShadow(button_info *b)
  {
!   if(b->flags&b_Back)
      return b->sc;
    while((b=b->parent))
!     if(b->c->flags&b_Back)
        return b->c->sc;
  #ifdef DEBUG
    fprintf(stderr,"%s: BUG: No background definition?\n",MyName);
--- 213,222 ----
  **/
  Pixel buttonShadow(button_info *b)
  {
!   if(b->flags&b_Back && !(b->flags&b_IconBack))
      return b->sc;
    while((b=b->parent))
!     if(b->c->flags&b_Back && !(b->flags&b_IconBack))
        return b->c->sc;
  #ifdef DEBUG
    fprintf(stderr,"%s: BUG: No background definition?\n",MyName);
*** draw.c.orig	Sun Sep 29 10:18:29 1996
--- draw.c	Wed Oct 30 12:43:44 1996
***************
*** 119,124 ****
--- 119,138 ----
    if(!(b->flags&b_Icon) && (buttonSwallowCount(b)<3))
      return;
  
+   /* Set the background pixmap if we need one */
+   if(b->flags&b_IconBack)
+     {
+       int x,y,px,py,f,BW,BH;
+ 
+       XSetWindowBackgroundPixmap(Dpy,MyWindow,b->backicon->picture);
+       BW = buttonWidth(b);
+       BH = buttonHeight(b);
+       buttonInfo(b,&x,&y,&px,&py,&f);
+       f=abs(f);
+       if(BW>2*f && BH>2*f)
+ 	XClearArea(Dpy,MyWindow,x+f,y+f,BW-2*f,BH-2*f,False);
+     }
+ 
    font = buttonFont(b);
  
    GetInternalSize(b,&ix,&iy,&iw,&ih);
***************
*** 230,236 ****
  	  if(h1)XFillRectangle(Dpy,MyWindow,NormalGC,x1,y1,w,h1);
  	  if(h2)XFillRectangle(Dpy,MyWindow,NormalGC,x1,y1+h-h2,w,h2);
  	}
!       else 
  	XFillRectangle(Dpy,MyWindow,NormalGC,x+f,y+f,BW-2*f,BH-2*f);
      }
  
--- 244,250 ----
  	  if(h1)XFillRectangle(Dpy,MyWindow,NormalGC,x1,y1,w,h1);
  	  if(h2)XFillRectangle(Dpy,MyWindow,NormalGC,x1,y1+h-h2,w,h2);
  	}
!       else if(!(b->flags&b_IconBack))
  	XFillRectangle(Dpy,MyWindow,NormalGC,x+f,y+f,BW-2*f,BH-2*f);
      }
  
*** parse.c.orig	Mon Sep 23 22:47:23 1996
--- parse.c	Mon Oct 28 21:04:13 1996
***************
*** 118,124 ****
  	{
  	case 0: /* Icon */
  	  r=1;
- 	  fprintf(stderr,"%s: Back(Icon) not supported yet\n",MyName);
  	  break;
  	default:
  	  t=seekright(&s);
--- 118,123 ----
----------------------------------Cut Here----------------------------------
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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].