--- builtins.c.orig     Fri Jun  9 13:44:26 1995
+++ builtins.c  Fri Jun  9 14:11:03 1995
@@ -857,6 +857,25 @@
   Scr.MoveResistance = val2;
 }

+void SetColormapFocus(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                      unsigned long context, char *action,int* Module)
+{
+  if (mystrncasecmp(action,"FollowsFocus",12)==0)
+  {
+    Scr.ColormapFocus = COLORMAP_FOLLOWS_FOCUS;
+  }
+  else if (mystrncasecmp(action,"FollowsMouse",12)==0)
+  {
+    Scr.ColormapFocus = COLORMAP_FOLLOWS_MOUSE;
+  }
+  else
+  {
+    fvwm_err("ColormapFocus requires 1 arg: FollowsFocus or FollowsMouse",
+             NULL,NULL,NULL);
+    return;
+  }
+}
+
 void SetClick(XEvent *eventp,Window w,FvwmWindow *tmp_win,
               unsigned long context, char *action,int* Module)
 {
--- events.c.orig       Fri May 12 16:30:03 1995
+++ events.c    Fri Jun  9 13:55:36 1995
@@ -287,6 +287,17 @@
          SetBorder(Scr.Hilite,False,True,True,None);
          Broadcast(M_FOCUS_CHANGE,5,0,0,0,Scr.HiColors.fore,
                    Scr.HiColors.back,0,0);
+          if (Scr.ColormapFocus == COLORMAP_FOLLOWS_FOCUS)
+          {
+            if(!(Scr.Hilite->flags & ICONIFIED))
+            {
+              InstallWindowColormaps(Scr.Hilite);
+            }
+            else
+            {
+              InstallWindowColormaps(NULL);
+            }
+          }
        }
     }
   else if(Tmp_win != Scr.Hilite)
@@ -295,6 +306,17 @@
       Broadcast(M_FOCUS_CHANGE,5,Tmp_win->w,
                Tmp_win->frame,(unsigned long)Tmp_win,Scr.HiColors.fore,
                Scr.HiColors.back,0,0);
+      if (Scr.ColormapFocus == COLORMAP_FOLLOWS_FOCUS)
+      {
+        if(!(Scr.Hilite->flags & ICONIFIED))
+        {
+          InstallWindowColormaps(Scr.Hilite);
+        }
+        else
+        {
+          InstallWindowColormaps(NULL);
+        }
+      }
     }
 }

@@ -1000,7 +1022,10 @@
        {
          SetFocus(Scr.NoFocusWin,NULL,1);
        }
-      InstallWindowColormaps(NULL);
+      if (Scr.ColormapFocus == COLORMAP_FOLLOWS_MOUSE)
+      {
+        InstallWindowColormaps(NULL);
+      }
       return;
     }

@@ -1017,10 +1042,13 @@
       else
        SetFocus(Tmp_win->w,Tmp_win,1);
     }
-  if((!(Tmp_win->flags & ICONIFIED))&&(Event.xany.window == Tmp_win->w))
-    InstallWindowColormaps(Tmp_win);
-  else
-    InstallWindowColormaps(NULL);
+  if (Scr.ColormapFocus == COLORMAP_FOLLOWS_MOUSE)
+  {
+    if((!(Tmp_win->flags & ICONIFIED))&&(Event.xany.window == Tmp_win->w))
+      InstallWindowColormaps(Tmp_win);
+    else
+      InstallWindowColormaps(NULL);
+  }
   return;
 }

--- functions.c.orig    Fri Jun  9 13:44:20 1995
+++ functions.c Fri Jun  9 13:58:44 1995
@@ -41,6 +41,7 @@
   {"ButtonStyle",  ButtonStyle,      F_BUTTON_STYLE,        FUNC_NO_WINDOW},
   {"ClickTime",    SetClick,         F_CLICK,               FUNC_NO_WINDOW},
   {"Close",        close_function,   F_CLOSE,               FUNC_NEEDS_WINDOW},
+  {"ColormapFocus",SetColormapFocus, F_COLORMAP_FOCUS,      FUNC_NO_WINDOW},
   {"CursorMove",   movecursor,       F_MOVECURSOR,          FUNC_NO_WINDOW},
   {"Delete",       delete_function,  F_DELETE,              FUNC_NEEDS_WINDOW},
   {"DesktopSize",  SetDeskSize,       F_SETDESK,            FUNC_NO_WINDOW},
--- fvwm.c.orig Fri Jun  9 13:51:03 1995
+++ fvwm.c      Fri Jun  9 13:51:56 1995
@@ -662,6 +662,7 @@
   Scr.ScrollResistance = Scr.MoveResistance = 0;
   Scr.OpaqueSize = 5;
   Scr.ClickTime = 150;
+  Scr.ColormapFocus = COLORMAP_FOLLOWS_MOUSE;

   /* set major operating modes */
   Scr.NumBoxes = 0;
--- misc.h.orig Fri Jun  9 14:11:12 1995
+++ misc.h      Fri Jun  9 14:11:49 1995
@@ -305,6 +305,8 @@
                     unsigned long context, char *action,int *Module);
 void ButtonStyle(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                 unsigned long context, char *action,int *Module);
+void SetColormapFocus(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                      unsigned long context, char *action,int* Module);
 FVWM_INLINE void DrawPattern(Window, GC, GC, int, int,int);
 Pixel    GetShadow(Pixel);
 Pixel    GetHilite(Pixel);
--- parse.h.orig        Fri Jun  9 13:58:51 1995
+++ parse.h     Fri Jun  9 13:59:42 1995
@@ -70,6 +70,7 @@
 #define F_DESTROY_MENU         52
 #define F_ZAP                  53
 #define F_QUIT_SCREEN          54
+#define F_COLORMAP_FOCUS        55
 /* Functions which require a target window */
 #define F_RESIZE               100
 #define F_RAISE                        101
--- screen.h.orig       Fri Jun  9 13:46:01 1995
+++ screen.h    Fri Jun  9 13:51:13 1995
@@ -69,6 +69,11 @@
 #define BOTTOM_RIGHT 16
 #define MAX_CURSORS 18

+/* colormap focus styes */
+#define COLORMAP_FOLLOWS_MOUSE 1 /* default */
+#define COLORMAP_FOLLOWS_FOCUS 2
+
+
 #ifndef NON_VIRTUAL
 typedef struct
 {
@@ -176,6 +181,7 @@
   int MoveResistance;          /* res to moving windows over viewport edge */
   int OpaqueSize;
   int CurrentDesk;             /* The current desktop number */
+  int ColormapFocus;           /* colormap focus style */

   /* new style */
   Boolean use_new_style[10];   /* if true then use custom shapes */

