FVWM: Experimental Titlebar Addition

From: Andrew Veliath <veliaa_at_rpi.edu>
Date: Wed, 18 Sep 1996 23:25:24 -0400

Uh oh, here is an experimental [i.e., first implementation :] patch
which textures pixmaps in the window frame background... Please note
this may or may not cause problems for you, but please email me
problems you have [or don't have]. I've not tested it extensively.

All it does is add a new titlestyle, i.e.:

titlestyle activetexture <a pixmap>

or

titlestyle inactivetexture <a pixmap>

The options can be combined to one line. Use at your own risk! :)
Sorry for the length. It is not large, but for email it is not small
either. You should be able to omit the pixmap to get rid of the
texture. If response to this is okay and it is refined, I might
integrate this into my next titlebar patch.

Dare you try it, you need to apply my tbp5 patch and then this one (in
that order).

-- 
Andrew Veliath <veliaa_at_rpi.edu>        http://www.rpi.edu/~veliaa
Finger for PGP Public Key
Key fingerprint =  51 56 5D 3E 51 43 8B 74  7C B2 E4 B6 84 8E 8B 08
-- cut here --
diff -cr orig/fvwm-2.0.43.tbp5/fvwm/add_window.c fvwm-2.0.43/fvwm/add_window.c
*** orig/fvwm-2.0.43.tbp5/fvwm/add_window.c	Thu Apr 11 11:25:58 1996
--- fvwm-2.0.43/fvwm/add_window.c	Wed Sep 18 22:56:53 1996
***************
*** 82,87 ****
--- 82,90 ----
  {
    FvwmWindow *tmp_win;		        /* new fvwm window structure */
    unsigned long valuemask;		/* mask for create windows */
+ #if defined(XPM) && defined(PIXMAP_TITLEBARS)
+   Pixmap TexturePixmap;
+ #endif
    XSetWindowAttributes attributes;	/* attributes for create windows */
    int i,width,height;
    int a,b;
***************
*** 305,310 ****
--- 308,326 ----
    ConstrainSize(tmp_win, &tmp_win->frame_width, &tmp_win->frame_height);
  
    valuemask = CWBorderPixel | CWCursor | CWEventMask; 
+ #if defined(XPM) && defined(PIXMAP_TITLEBARS)
+   TexturePixmap = Scr.TitleStyle.inactiveTexture ?
+       Scr.TitleStyle.inactiveTexture->picture : None;
+   if(Scr.d_depth < 2 || TexturePixmap)
+     {
+       attributes.background_pixmap = 
+ 	  TexturePixmap ? TexturePixmap : Scr.light_gray_pixmap;
+       if(tmp_win->flags & STICKY)
+ 	attributes.background_pixmap =
+ 	    TexturePixmap ? TexturePixmap : Scr.sticky_gray_pixmap;
+       valuemask |= CWBackPixmap;
+     }
+ #else
    if(Scr.d_depth < 2)
      {
        attributes.background_pixmap = Scr.light_gray_pixmap ;
***************
*** 312,317 ****
--- 328,334 ----
  	attributes.background_pixmap = Scr.sticky_gray_pixmap;
        valuemask |= CWBackPixmap;
      }
+ #endif
    else
      {
        attributes.background_pixel = tmp_win->BackPixel;
diff -cr orig/fvwm-2.0.43.tbp5/fvwm/borders.c fvwm-2.0.43/fvwm/borders.c
*** orig/fvwm-2.0.43.tbp5/fvwm/borders.c	Wed Sep 18 22:44:19 1996
--- fvwm-2.0.43/fvwm/borders.c	Wed Sep 18 22:42:16 1996
***************
*** 71,76 ****
--- 71,79 ----
    GC ReliefGC,ShadowGC;
    Pixel BorderColor,BackColor;
    Pixmap BackPixmap,TextColor;
+ #if defined(XPM) && defined(PIXMAP_TITLEBARS)
+   Pixmap TexturePixmap;
+ #endif
    Bool NewColor = False;
    XSetWindowAttributes attributes;
    unsigned long valuemask;
***************
*** 84,97 ****
    
    if(!t)
      return;
!   
    if (onoroff) 
    {
      /* don't re-draw just for kicks */
      if((!force)&&(Scr.Hilite == t))
        return;
!       
!       
      if(Scr.Hilite != t)
        NewColor = True;
        
--- 87,103 ----
    
    if(!t)
      return;
! 
! 
    if (onoroff) 
    {
      /* don't re-draw just for kicks */
      if((!force)&&(Scr.Hilite == t))
        return;
!     
!     TexturePixmap = Scr.TitleStyle.activeTexture ?
! 	Scr.TitleStyle.activeTexture->picture : None;
!     
      if(Scr.Hilite != t)
        NewColor = True;
        
***************
*** 108,114 ****
--- 114,124 ----
      Scr.Hilite = t;
        
      TextColor = Scr.HiColors.fore;
+ #if defined(XPM) && defined(PIXMAP_TITLEBARS)
+     BackPixmap= TexturePixmap ? TexturePixmap : Scr.gray_pixmap;
+ #else
      BackPixmap= Scr.gray_pixmap;
+ #endif
      BackColor = Scr.HiColors.back;
      ReliefGC = Scr.HiReliefGC;
      ShadowGC = Scr.HiShadowGC;
***************
*** 119,124 ****
--- 129,137 ----
      /* don't re-draw just for kicks */
      if((!force)&&(Scr.Hilite != t))
        return;
+ 
+     TexturePixmap = Scr.TitleStyle.inactiveTexture ?
+ 	Scr.TitleStyle.inactiveTexture->picture : None;
        
      if(Scr.Hilite == t)
      {
***************
*** 127,135 ****
      }
        
      TextColor =t->TextPixel;
!     BackPixmap = Scr.light_gray_pixmap;
      if(t->flags & STICKY)
        BackPixmap = Scr.sticky_gray_pixmap;
      BackColor = t->BackPixel;
      Globalgcv.foreground = t->ReliefPixel;
      Globalgcm = GCForeground;
--- 140,154 ----
      }
        
      TextColor =t->TextPixel;
! #if defined(XPM) && defined(PIXMAP_TITLEBARS)
!     BackPixmap = TexturePixmap ? TexturePixmap : Scr.gray_pixmap;
!     if(t->flags & STICKY)
!       BackPixmap = TexturePixmap ? TexturePixmap : Scr.sticky_gray_pixmap;
! #else
!     BackPixmap = Scr.gray_pixmap;
      if(t->flags & STICKY)
        BackPixmap = Scr.sticky_gray_pixmap;
+ #endif
      BackColor = t->BackPixel;
      Globalgcv.foreground = t->ReliefPixel;
      Globalgcm = GCForeground;
***************
*** 150,156 ****
--- 169,180 ----
    
    valuemask = CWBorderPixel;
    attributes.border_pixel = BorderColor;
+ 
+ #if defined(XPM) && defined(PIXMAP_TITLEBARS)
+   if(Scr.d_depth < 2 || TexturePixmap)
+ #else
    if(Scr.d_depth < 2)
+ #endif
    {
      attributes.background_pixmap = BackPixmap;
      valuemask |= CWBackPixmap;
***************
*** 548,553 ****
--- 572,578 ----
    int hor_off, w,i, state;
    GC ReliefGC,ShadowGC,tGC;
    Pixel Forecolor, BackColor;
+   Pixmap TexturePixmap;
  
    if(!t)
      return;
***************
*** 610,626 ****
    
    NewFontAndColor(Scr.WindowFont.font->fid,Forecolor, BackColor);
  
!   if (onoroff)
        if (PressedW == t->title_w) state = 2;
        else state = 1;
!   else
        state = 0;
  
    if (Scr.TitleStyle.face[state].style == SolidButton
        || Scr.TitleStyle.face[state].style == FullSolidButton)
        XSetWindowBackground(dpy,t->title_w,Scr.TitleStyle.face[state].u.back);
!   else
!       XSetWindowBackground(dpy,t->title_w,BackColor);
  
    XClearWindow(dpy,t->title_w);
    
--- 635,666 ----
    
    NewFontAndColor(Scr.WindowFont.font->fid,Forecolor, BackColor);
  
!   if (onoroff) {
! #if defined(XPM) && defined(PIXMAP_TITLEBARS)
!       TexturePixmap = Scr.TitleStyle.activeTexture ?
! 	  Scr.TitleStyle.activeTexture->picture : None;
! #endif
        if (PressedW == t->title_w) state = 2;
        else state = 1;
!   } else {
! #if defined(XPM) && defined(PIXMAP_TITLEBARS)
!       TexturePixmap = Scr.TitleStyle.inactiveTexture ?
! 	  Scr.TitleStyle.inactiveTexture->picture : None;
! #endif
        state = 0;
+   }
  
    if (Scr.TitleStyle.face[state].style == SolidButton
        || Scr.TitleStyle.face[state].style == FullSolidButton)
        XSetWindowBackground(dpy,t->title_w,Scr.TitleStyle.face[state].u.back);
!   else {
! #if defined(XPM) && defined(PIXMAP_TITLEBARS)
!       if (TexturePixmap)
! 	  XSetWindowBackgroundPixmap(dpy,t->title_w,TexturePixmap);
!       else
! #endif
! 	  XSetWindowBackground(dpy,t->title_w,BackColor);
!   }
  
    XClearWindow(dpy,t->title_w);
    
diff -cr orig/fvwm-2.0.43.tbp5/fvwm/builtins.c fvwm-2.0.43/fvwm/builtins.c
*** orig/fvwm-2.0.43.tbp5/fvwm/builtins.c	Wed Sep 18 22:44:19 1996
--- fvwm-2.0.43/fvwm/builtins.c	Wed Sep 18 22:34:15 1996
***************
*** 1562,1568 ****
      {
        Scr.TitleStyle.appearance = TITLE_MWM;
      }
!     else if (mystrncasecmp(parm,"inactive",8)==0
  	     || mystrncasecmp(parm,"activeup",8)==0
  	     || mystrncasecmp(parm,"activedown",10)==0)
      {
--- 1562,1568 ----
      {
        Scr.TitleStyle.appearance = TITLE_MWM;
      }
!     else if (mystrcasecmp(parm,"inactive")==0 /* full check here */
  	     || mystrncasecmp(parm,"activeup",8)==0
  	     || mystrncasecmp(parm,"activedown",10)==0)
      {
***************
*** 1588,1593 ****
--- 1588,1645 ----
  	free(tmp);
  	action = end + 1;
      }
+ #ifdef XPM
+ #ifdef PIXMAP_TITLEBARS
+     else if (mystrncasecmp(parm,"activetexture",12)==0)
+     {
+ 	char *file;
+ 	action = GetNextToken(action,&file);
+ 	if (file) {
+ 	    if (Scr.TitleStyle.activeTexture)
+ 		DestroyPicture(dpy, Scr.TitleStyle.activeTexture);
+ 	    
+ 	    Scr.TitleStyle.activeTexture = CachePicture(dpy,
+ 							Scr.Root,
+ 							IconPath,
+ 							PixmapPath,
+ 							file);
+ 	    if (Scr.TitleStyle.activeTexture == NULL)
+ 		fvwm_msg(ERR,"SetTitleStyle","Couldn't load active texture %s: %s", 
+ 			 file, action);
+ 	    free(file);
+ 	} 
+ 	else
+ 	{
+ 	    DestroyPicture(dpy, Scr.TitleStyle.activeTexture);
+ 	    Scr.TitleStyle.activeTexture = NULL;
+ 	}
+     }
+     else if (mystrncasecmp(parm,"inactivetexture",14)==0)
+     {
+ 	char *file;
+ 	action = GetNextToken(action,&file);
+ 	if (file) {
+ 	    if (Scr.TitleStyle.inactiveTexture)
+ 		DestroyPicture(dpy, Scr.TitleStyle.inactiveTexture);
+ 	    
+ 	    Scr.TitleStyle.inactiveTexture = CachePicture(dpy,
+ 							  Scr.Root,
+ 							  IconPath,
+ 							  PixmapPath,
+ 							  file);
+ 	    if (Scr.TitleStyle.inactiveTexture == NULL)
+ 		fvwm_msg(ERR,"SetTitleStyle","Couldn't load active texture %s: %s", 
+ 			 file, action);
+ 	    free(file);
+ 	} 
+ 	else
+ 	{
+ 	    DestroyPicture(dpy, Scr.TitleStyle.inactiveTexture);
+ 	    Scr.TitleStyle.inactiveTexture = NULL;
+ 	}	    
+     }
+ #endif
+ #endif
      else if (mystrncasecmp(parm,"height",6)==0)
      {
  	int height, next;
diff -cr orig/fvwm-2.0.43.tbp5/fvwm/fvwm.c fvwm-2.0.43/fvwm/fvwm.c
*** orig/fvwm-2.0.43.tbp5/fvwm/fvwm.c	Wed Sep 18 22:44:19 1996
--- fvwm-2.0.43/fvwm/fvwm.c	Wed Sep 18 21:39:32 1996
***************
*** 1021,1026 ****
--- 1021,1028 ----
  	Scr.TitleStyle.face[i].style = SimpleButton;
  #ifdef XPM
  #ifdef PIXMAP_TITLEBARS
+ 	Scr.TitleStyle.activeTexture = NULL;
+ 	Scr.TitleStyle.inactiveTexture = NULL;
  	Scr.TitleStyle.face[i].u.picture = NULL;
  #endif
  #endif
diff -cr orig/fvwm-2.0.43.tbp5/fvwm/fvwm2.man fvwm-2.0.43/fvwm/fvwm2.man
*** orig/fvwm-2.0.43.tbp5/fvwm/fvwm2.man	Wed Sep 18 22:44:19 1996
--- fvwm-2.0.43/fvwm/fvwm2.man	Wed Sep 18 23:15:46 1996
***************
*** 1304,1322 ****
  
  .IP "TitleStyle \fI[state] (buttonstyle [args])\fP"
  Defines a face for one of the title-bar states, where state can be one
! of "ActiveUp," "ActiveDown" or "Inactive".  After the state, one
! should enclose in parenthesis a new button style command (see the
! 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.
  
! Pixmap justification flags are supported, and can optionally be
! prepended by "Tiled" (tiled pixmaps are not transparent).  Examples:
  .EX
  TitleStyle ActiveUp (Pixmap symbol.xpm -- Bottom Left)
  TitleStyle InActive (TiledFullPixmap pattern1.xpm)
  .EE
  
  .IP "WarpToWindow \fIx y\fP"
  Warps the cursor to the associated window.  The parameters x and y
--- 1304,1333 ----
  
  .IP "TitleStyle \fI[state] (buttonstyle [args])\fP"
  Defines a face for one of the title-bar states, where state can be one
! of "ActiveUp," "ActiveDown," "Inactive," "ActiveTexture," or
! "InactiveTexture".  
  
! For the first three, one should enclose in parenthesis a new button style
! command (see the 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.
! 
! The active and inactive texture commands should be followed by a
! single pixmap.  If either of these directives are given, the
! underlying window frame will be composed of a textured pixmap instead
! of a solid color.
! 
! Pixmap justification flags are supported for the first three states,
! and can optionally be prepended by "Tiled" (tiled pixmaps are not
! transparent).  Examples:
  .EX
  TitleStyle ActiveUp (Pixmap symbol.xpm -- Bottom Left)
  TitleStyle InActive (TiledFullPixmap pattern1.xpm)
+ TitleStyle InactiveTexture nicetexture.xpm
  .EE
+ 
  
  .IP "WarpToWindow \fIx y\fP"
  Warps the cursor to the associated window.  The parameters x and y
diff -cr orig/fvwm-2.0.43.tbp5/fvwm/screen.h fvwm-2.0.43/fvwm/screen.h
*** orig/fvwm-2.0.43.tbp5/fvwm/screen.h	Wed Sep 18 22:44:19 1996
--- fvwm-2.0.43/fvwm/screen.h	Wed Sep 18 21:39:38 1996
***************
*** 202,207 ****
--- 202,213 ----
    {
      int justify;                /* left, right, centered */
      int appearance;             /* raised, sunk, flat, not implemented yet */
+ #ifdef XPM
+ #ifdef PIXMAP_TITLEBARS
+     Picture *activeTexture;
+     Picture *inactiveTexture;
+ #endif
+ #endif
      TitleFace face[3];
    } TitleStyle;
    FvwmWindow *Hilite;		/* the fvwm window that is highlighted 
--
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 Wed Sep 18 1996 - 22:27:28 BST

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