Subject: new patch which makes fvwm-2.0.47b look even more like mwm

From: Jakub Jasinski <[email-masked]>
Date: Thu, 25 Jun 1998 18:41:22 -0400 (EDT)

I added some minor bug fixes and made fvwm look even more like mwm.  One
of the changes includes an increase in the height of the title bar by 1 pixel.
The fvwm2rc is a simple example with title bar buttons that look like the
mwm buttons.

Enjoy.
MenuStyle Black gray80 black -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-* mwm

AddToDecor      Mwm
+       TitleStyle      Centered
+       TitleStyle      ActiveUp (Solid  #59659e79a699 -- Raised) \
                        Inactive (Solid grey80 -- Raised)
+       ButtonStyle     Reset
+       ButtonStyle     All -- UseTitleStyle
+       ButtonStyle 1   6  25x40@1 25x60@1 30x60@1 75x60@0 75x40@0 25x40@1
+       ButtonStyle 2   6  25x25@1 25x75@1 30x75@1 75x75@0 75x25@0 25x25@1
+       ButtonStyle 4  6  40x40@1 60x40@1 60x45@1 60x60@0 40x60@0 40x40@1
+       WindowFont      -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*
+	NewHilightColor	white #59659e79a699 #b6dad75cd75c #28a24d345144

ModulePath 		/usr/X11R6/lib/X11/fvwm2:$PATH
PixmapPath	     	/usr/include/X11/pixmaps
IconPath	     	/usr/include/X11/bitmaps

DeskTopSize 1x1
OpaqueMoveSize 0

Style "*" 		RandomPlacement
Style "*"            	ClickToFocus
Style "*"	     	MWMBorder
Style "*"     	     	MWMButtons
Style "*"            	HintOverride
Style "*"            	MWMDecor
Style "*"            	DecorateTransient
Style "*"            	IconBox 5 -740 10 -5
Style "*"		UseDecor Mwm
Style "*"		Icon unknown1.xpm
Style "*"		HandleWidth 6
Style "*"		BorderWidth 1
Style "*"		Color black/gray80

Style "Fvwm*"		NoTitle, NoHandles, Sticky, WindowListSkip,BorderWidth 2
Style "XFce*"		NoTitle, NoHandles, Sticky, StaysOnTop, BorderWidth 4
Style "XFbd*"           Sticky 
Style "Popup menu*"	Sticky, NoHandles, BorderWidth 3
Style "Alert*"		Sticky, NoHandles, BorderWidth 4, StaysOnTop 
Style "Question*"	Sticky, NoHandles, BorderWidth 4, StaysOnTop
Style "wmload"		Sticky, NoHandles, StaysOnTop
Style "wmpppload"	Sticky, NoHandles, StaysOnTop
Style "mozillaComponentBar"	Sticky, StaysOnTop

AddToFunc "InitFunction" 
+              "I" Desk 0 4
+              "I" Exec xsetroot -solid gray40

AddToFunc "RestartFunction" 
+              "I" Desk 0 4
+		"I" Exec xsetroot -solid gray40

AddToMenu "Quit-Verify" "Quit Fvwm? " Title
+              "Restart "    Restart fvwm2
+              "Restart Test"    Restart /root/fvwm-2.0.47b/fvwm/fvwm2
+              "Restart rxvt"    Restart rxvt -fn vga -fg gray -bg black
+              "Restart mwm"    Restart mwm
+              "Quit "       Quit
+              ""            Nop
+              "Don't Quit " Nop

AddToMenu "Module-Popup" "Modules" Title
+              "XFce" 		Module xfce -shared
+              "FvwmIdentify" 	Module FvwmIdent
+              "SaveDesktop" 	Module FvwmSave
+              "FvwmWinList" 	Module FvwmWinList
+	       "FvwmPager"	Module FvwmPager 0 3
+	       "FvwmConf"	Module FvwmConf

AddToMenu "Window-Ops2" "&Restore"      Iconify -1
+                       "&Move"         Move-or-Raise
+                       "&Size"         Resize-or-Raise
+                       "Mi&nimize"     Iconify 1
+                       "Ma&ximize"     Maximize 100 100
+			"&Cascade"	Module FvwmCascade -resize
+			"&Tile"		Module FvwmTile -nostretch 
+                       ""              Nop
+                       "&Exit"         Destroy
+                       "&Close Alt+F4" Delete

AddToMenu "Root" "Root menu" Title
+              "New window" 	Exec rxvt
+	       "Shuffle Up" 	Next [*] focus
+	       "Shuffle Down" 	Prev [*] focus
+	       "Refresh"	Refresh 
+              "" Nop
+	       "Backdrop..."	Exec xfbd -i
+              "" Nop
+              "Window..."   	Popup Window-Ops2 
+              "" Nop
+              "Modules..." 	Popup Module-Popup
+              "" Nop
+              "Exit Fvwm" 	Popup Quit-Verify

# This defines the most common window operations

AddToMenu "Window" "Window Ops" Title
+ "&Move"                     Function Move-or-Raise
+ "&Resize"                   Function Resize-or-Raise
+ "R&aise"		      Raise
+ "&Lower"    		      Lower
+ "(De)Iconify"               Iconify
+ "(Un)Stick"                 Stick
+ "(Un)Maximize"              Maximize 100 100
+ ""                          Nop
+ "&Close"                    Delete
+ ""                          Nop
+ "Switch to..."              WindowList
+ "Refresh Screen" 	      Refresh

AddToFunc "Iconify-and-Raise" "M" Iconify
+              "M" Raise

AddToFunc "Move-or-Lower" "M" Move
+              "M" Lower
+              "C" Lower
+              "D" RaiseLower

AddToFunc "Move-or-Iconify" "M" Move
+              "C" PopUp Window Ops2
+              "D" Iconify

AddToFunc "windowops-or-die" "M" PopUp Window Ops2
+              "C" PopUp Window Ops2
+              "D" Close

AddToFunc "Move-or-Raise" "M" Move
+              "M" Raise
+              "C" Raise
+              "D" Iconify

AddToFunc "Move-or-Lower" "M" Move
+              "C" Lower
+              "D" RaiseLower

AddToFunc "Resize-or-Raise" "M" Resize
+              "M" Raise
+              "C" Raise
+              "D" RaiseLower

AddToFunc "Resize-or-Lower" "M" Resize
+              "C" Lower
+              "D" RaiseLower

#     Button	Context Modifi 	Function
Mouse 1		R   	A       Menu "Root" Nop
Mouse 2		R    	A       Menu "Window" Nop
Mouse 3		R    	A      	WindowList

#     Button	Context Modifi 	Function
#Mouse 0		1    	A      	Iconify
#Mouse 0		2	A	Stick
Mouse 0		1    	A      	Function "windowops-or-die"
Mouse 0		2    	A     	Maximize
Mouse 0		4    	A     	Iconify

Mouse 1         FS      A       Function "Resize-or-Raise"
Mouse 2         FS      A       Function "Resize-or-Lower"
Mouse 1         T       A       Function "Move-or-Raise"
Mouse 2         T       A       Function "Move-or-Lower"

Mouse 1		I	A	Function "Move-or-Iconify"
Mouse 2		I	A	Function "Move-or-Iconify"
Mouse 3		I	A 	Menu "Window Ops2" Nop
Mouse 3		FST    	A      	Function "windowops-or-die"

Key Left	A	C	Scroll -100 0
Key Right	A	C	Scroll +100 +0
Key Up		A	C	Scroll +0   -100
Key Down	A	C	Scroll +0   +100

Key Left	A	M	Scroll -10 +0
Key Right	A	M	Scroll +10 +0
Key Up		A	M	Scroll +0   -10
Key Down	A	M	Scroll +0   +10

Key Left	A	SC	CursorMove -1 0
Key Right	A	SC	CursorMove +1 +0
Key Up		A	SC	CursorMove +0   -1
Key Down	A	SC	CursorMove +0   +1

Key Left	A	SM	CursorMove -10 +0
Key Right	A	SM	CursorMove +10 +0
Key Up		A	SM	CursorMove +0   -10
Key Down	A	SM	CursorMove +0   +10

Key F1		A	M	Popup "Window"
Key F2		A	M	Popup "Root"
Key F3		A	M	Lower
Key F4		A	M	Destroy
Key F5		A	M	Next [*] focus
Key F6		A	M	Prev [*] focus
Key F7		A	M	Move
Key F8		A	M	Resize
Key F9		A	M	Iconify
Key F10		A	M	Maximize

Key L5                IW      N       RaiseLower
Key L5                IW      S       Lower
Key L5                IW      C       Raise
Key L7                IW      A       Iconify

*FvwmIdentBack MidnightBlue
*FvwmIdentFore Yellow
*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*

*FvwmWinListBack #908090
*FvwmWinListFore Black
*FvwmWinListFont -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*
*FvwmWinListUseSkipList
*FvwmWinListGeometry +0-1
--- fvwm-2.0.47b/fvwm/add_window.c.orig	Tue Jun 23 16:02:18 1998
+++ fvwm-2.0.47b/fvwm/add_window.c	Tue Jun 23 17:17:31 1998
@@ -207,7 +207,7 @@
       tmp_win->fl = &Scr.DefaultDecor;
 #endif
 
-  tmp_win->title_height = GetDecor(tmp_win,TitleHeight) + tmp_win->bw;
+  tmp_win->title_height = GetDecor(tmp_win,TitleHeight) + tmp_win->bw + 1;
 
   GetMwmHints(tmp_win);
   GetOlHints(tmp_win);
--- fvwm-2.0.47b/fvwm/builtins.c.orig	Tue Jun 23 15:58:29 1998
+++ fvwm-2.0.47b/fvwm/builtins.c	Tue Jun 23 17:17:31 1998
@@ -1,3 +1,9 @@
+/* patched by Jakub Jasinski ([email-masked])                            */
+/* now you can set the top and bottom shadow of a hilighted window with a    */
+/* command NewHilightColor                                                   */
+/* eleet mwm combo is:(fg)  (background)  (topshadow)   (bottomshadow)       */
+/* NewHilightColor    white #59659e79a699 #b6dad75cd75c #28a24d345144        */
+
 /****************************************************************************
  * This module is all original code 
  * by Rob Nation 
@@ -1416,6 +1422,85 @@
   }
 }
 
+/* same as SetHiColor except that it also accepts top and bottom shadow */
+/* colors                                                               */
+
+void NewSetHiColor(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+		unsigned long context, char *action,int* Module)
+{
+  XGCValues gcv;
+  unsigned long gcm;
+  char *hifore=NULL, *hiback=NULL, *hitopshadow=NULL, *hibottomshadow=NULL;
+  extern char *white,*black;
+  FvwmWindow *hilight;
+#ifdef USEDECOR
+  FvwmDecor *fl = cur_decor ? cur_decor : &Scr.DefaultDecor;
+#else
+  FvwmDecor *fl = &Scr.DefaultDecor;
+#endif
+  
+  action = GetNextToken(action,&hifore);
+  action = GetNextToken(action,&hiback);
+  action = GetNextToken(action,&hitopshadow);
+  GetNextToken(action,&hibottomshadow);
+  if(Scr.d_depth > 2)
+  {
+    if(hifore != NULL)
+    {
+	fl->HiColors.fore = GetColor(hifore);
+    }
+    if(hiback != NULL)
+    {
+	fl->HiColors.back = GetColor(hiback);
+    }
+    if(hibottomshadow != NULL)
+    	fl->HiRelief.back = GetColor(hibottomshadow);
+    if(hitopshadow != NULL)
+    	fl->HiRelief.fore  = GetColor(hitopshadow);
+
+  }
+  else
+  {
+    fl->HiColors.back  = GetColor(white);
+    fl->HiColors.fore  = GetColor(black); 
+    fl->HiRelief.back  = GetColor(black);
+    fl->HiRelief.fore  = GetColor(white);
+  }
+  if (hifore) free(hifore); 
+  if (hiback) free(hiback);
+  if (hitopshadow) free(hitopshadow); 
+  if (hibottomshadow) free(hibottomshadow);
+  gcm = GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
+    GCBackground;
+  gcv.foreground = fl->HiRelief.fore;
+  gcv.background = fl->HiRelief.back;
+  gcv.fill_style = FillSolid;
+  gcv.plane_mask = AllPlanes;
+  gcv.function = GXcopy;
+  gcv.graphics_exposures = False;
+  gcv.line_width = 0;
+  if(fl->HiReliefGC != NULL)
+  {
+    XFreeGC(dpy,fl->HiReliefGC);
+  }
+  fl->HiReliefGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);  
+
+  gcv.foreground = fl->HiRelief.back;
+  gcv.background = fl->HiRelief.fore;
+  if(fl->HiShadowGC != NULL)
+  {
+    XFreeGC(dpy,fl->HiShadowGC);
+  }
+  fl->HiShadowGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);  
+
+  if((Scr.flags & WindowsCaptured)&&(Scr.Hilite != NULL))
+  {
+    hilight = Scr.Hilite;
+    SetBorder(Scr.Hilite,False,True,True,None);
+    SetBorder(hilight,True,True,True,None);
+  }
+}
+
 
 void SafeDefineCursor(Window w, Cursor cursor)
 {
@@ -1861,7 +1946,7 @@
 	    
 	    fl->WindowFont.y = fl->WindowFont.font->ascent 
 		+ (height - (fl->WindowFont.font->ascent 
-			     + fl->WindowFont.font->descent + 3)) / 2;
+			     + fl->WindowFont.font->descent + 3)) / 2 + 1;
 	    if (fl->WindowFont.y < fl->WindowFont.font->ascent)
 		fl->WindowFont.y = fl->WindowFont.font->ascent;
 
@@ -1971,7 +2056,7 @@
     fl->WindowFont.font = newfont;
     fl->WindowFont.height=
       fl->WindowFont.font->ascent+fl->WindowFont.font->descent;
-    fl->WindowFont.y = fl->WindowFont.font->ascent;
+    fl->WindowFont.y = fl->WindowFont.font->ascent + 1;
     extra_height = fl->TitleHeight;
     fl->TitleHeight=fl->WindowFont.font->ascent+fl->WindowFont.font->descent+3;
     extra_height -= fl->TitleHeight;
--- fvwm-2.0.47b/fvwm/functions.c.orig	Tue Jun 23 15:58:29 1998
+++ fvwm-2.0.47b/fvwm/functions.c	Tue Jun 23 17:17:31 1998
@@ -103,6 +103,7 @@
   {"ModulePath",   setModulePath,    F_MODULE_PATH,         FUNC_NO_WINDOW},
   {"Mouse",        ParseMouseEntry,  F_MOUSE,               FUNC_NO_WINDOW},
   {"Move",         move_window,      F_MOVE,                FUNC_NEEDS_WINDOW},
+  {"NewHilightColor", NewSetHiColor, F_NHICOLOR,            FUNC_NO_WINDOW},
   {"Next",         NextFunc,         F_NEXT,                FUNC_NO_WINDOW},
   {"None",         NoneFunc,         F_NONE,                FUNC_NO_WINDOW},
   {"Nop",          Nop_func,         F_NOP,                 FUNC_NOP},
--- fvwm-2.0.47b/fvwm/move.c.orig	Tue Jun 23 18:09:08 1998
+++ fvwm-2.0.47b/fvwm/move.c	Tue Jun 23 18:03:47 1998
@@ -395,16 +395,20 @@
 {
   char str [100];
   int offset;
+  unsigned long save_flags;
   
   (void) sprintf (str, " %+-4d %+-4d ", x, y);
   if(Init)
     {
       XClearWindow(dpy,Scr.SizeWindow);
+      save_flags = tmp_win->flags;
+      tmp_win->flags &= !MWMBorders;
       if(Scr.d_depth >= 2)
 	RelieveWindow(tmp_win,Scr.SizeWindow,0,0,
 		      Scr.SizeStringWidth+ SIZE_HINDENT*2,
 		      Scr.StdFont.height + SIZE_VINDENT*2,
 		      Scr.MenuReliefGC,Scr.MenuShadowGC, FULL_HILITE);
+      tmp_win->flags = save_flags;
     }
   else
     {
--- fvwm-2.0.47b/fvwm/resize.c.orig	Wed Apr  8 16:50:13 1998
+++ fvwm-2.0.47b/fvwm/resize.c	Tue Jun 23 18:02:01 1998
@@ -1,3 +1,4 @@
+/* Jakub Jasinski ([email-masked]) minor patch: resize frame simplified */
 
 /****************************************************************************
  * This module is all original code 
@@ -353,6 +354,7 @@
 {
   char str[100];
   int dwidth,dheight,offset;
+  unsigned long save_flags;
 
   if (last_width == width && last_height == height)
     return;
@@ -374,11 +376,14 @@
   if(Init)
     {
       XClearWindow(dpy,Scr.SizeWindow);
+      save_flags = tmp_win->flags;
+      tmp_win->flags &= !MWMBorders;
       if(Scr.d_depth >= 2)
 	RelieveWindow(tmp_win,
 		      Scr.SizeWindow,0,0,Scr.SizeStringWidth+ SIZE_HINDENT*2,
 		      Scr.StdFont.height + SIZE_VINDENT*2,
 		      Scr.MenuReliefGC,Scr.MenuShadowGC,FULL_HILITE);
+      tmp_win->flags = save_flags;
     }
   else
     {
@@ -543,7 +548,7 @@
   static int lasty = 0;
   static int lastWidth = 0;
   static int lastHeight = 0;
-  XRectangle rects[5];
+  XRectangle rects[3];
 
   if (x == lastx && y == lasty && width == lastWidth && height == lastHeight)
     return;
@@ -559,19 +564,7 @@
       rects[1].y = lasty+1;
       rects[1].width = lastWidth-2;
       rects[1].height = lastHeight-2;
-      rects[2].x = lastx+2;
-      rects[2].y = lasty+2;
-      rects[2].width = lastWidth-4;
-      rects[2].height = lastHeight-4;
-      rects[3].x = lastx+3;
-      rects[3].y = lasty+3 + (lastHeight-6)/3;
-      rects[3].width = lastWidth-6;
-      rects[3].height = (lastHeight-6)/3;
-      rects[4].x = lastx+3 + (lastWidth-6)/3;
-      rects[4].y = lasty+3;
-      rects[4].width = (lastWidth-6)/3;
-      rects[4].height = (lastHeight-6);
-      XDrawRectangles(dpy,Scr.Root,Scr.DrawGC,rects,5);
+      XDrawRectangles(dpy,Scr.Root,Scr.DrawGC,rects,2);
     }
   
   lastx = x;
@@ -590,19 +583,7 @@
       rects[1].y = lasty+1;
       rects[1].width = lastWidth-2;
       rects[1].height = lastHeight-2;
-      rects[2].x = lastx+2;
-      rects[2].y = lasty+2;
-      rects[2].width = lastWidth-4;
-      rects[2].height = lastHeight-4;
-      rects[3].x = lastx+3;
-      rects[3].y = lasty+3 + (lastHeight-6)/3;
-      rects[3].width = lastWidth-6;
-      rects[3].height = (lastHeight-6)/3;
-      rects[4].x = lastx+3 + (lastWidth-6)/3;
-      rects[4].y = lasty+3;
-      rects[4].width = (lastWidth-6)/3;
-      rects[4].height = (lastHeight-6);
-      XDrawRectangles(dpy,Scr.Root,Scr.DrawGC,rects,5);      
+      XDrawRectangles(dpy,Scr.Root,Scr.DrawGC,rects,2);      
     }
 }
 
--- fvwm-2.0.47b/fvwm/misc.h.orig	Tue Jun 23 15:58:30 1998
+++ fvwm-2.0.47b/fvwm/misc.h	Tue Jun 23 17:17:31 1998
@@ -475,6 +475,8 @@
 	  char *action, int *Module);
 void SetHiColor(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		unsigned long context, char *action,int* Module);
+void NewSetHiColor(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+		unsigned long context, char *action,int* Module);
 void SetMenuColor(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		unsigned long context, char *action,int* Module);
 void LoadIconFont(XEvent *eventp,Window w,FvwmWindow *tmp_win,
--- fvwm-2.0.47b/fvwm/parse.h.orig	Tue Jun 23 16:01:22 1998
+++ fvwm-2.0.47b/fvwm/parse.h	Tue Jun 23 17:20:39 1998
@@ -110,6 +110,7 @@
     F_WINDOW_SHADE,
     F_COLOR_LIMIT,
     F_ANIMATED_MOVE,
+    F_NHICOLOR,
 
 /* Functions for use by modules only! */
     F_SEND_WINDOW_LIST = 1000