Subject: FVWM: improvements to fvwmrc_convert

From: Austin Donnelly <[email-masked]>
Date: Fri, 19 Apr 96 16:32 BST

Here's a patch to fvwmrc_convert, which does:

 o corrects order of IconBox translation

 o if old .fvwmrc specified to use the built-in pager, then configure
     FvwmPager to be as similar as possible

 o fixes problem with old buttonstyle translation conde

 o fixed problem where spurious ')' could appear at the start of a
     line by itself

 o handles MWMBorders

 o handles Cursor

 o handles SloppyFocus

 o fixes a few problems with '$0' appearing in output rather than
     being expanded.

 o fixes problems translating menu defns with spaces in the title

Austin

--- .../fvwm-2.0.42.orig/utils/fvwmrc_convert	Thu Oct  5 19:34:18 1995
+++ fvwmrc_convert	Fri Apr 19 13:56:38 1996
@@ -23,10 +23,12 @@
 # Originally written by Martin Kraemer <[email-masked]>
 # Corrected, extended, and modified by Grant McDorman <[email-masked]>
 # 24 May 95
+# Further corrections and extensions by Austin Donnelly <[email-masked]>
+# 19 Apr 96
 
 echo "fvwmrc-to-2 1.7a"
-if [ ! -x /usr/local/contrib/bin/gnu/gawk ];then
-   echo "gawk (/usr/local/contrib/bin/gnu/gawk) missing, cannot run"
+if [ ! -x /usr/bin/gawk ];then
+   echo "gawk (/usr/bin/gawk) missing, cannot run"
    exit 1
 fi
 source=${1:-$HOME/.fvwmrc}
@@ -61,19 +63,25 @@
 	    menustipplecolor="";        dflt["menustipplecolor"] = "grey40";
 	    font="";                    dflt["font"] = "-adobe-helvetica-medium-r-*-*-18-*-*-*-*-*-iso8859-1";
 	    mwmmenus="";                dflt["mwmmenus"] = "fvwm";
+            dflt["pagerforecolor"] = "SlateBlue4";
+            dflt["pagerbackcolor"] = "SlateGrey";
+            dflt["pagerfont"] = "-*-times-medium-r-*-*-*-80-*-*-*-*-*-*";
+            dflt["desktopscale"] = "32";
 	    menustyle=FALSE;
 
 	    inpopup=FALSE;
 	    infunc=FALSE;
 	    prefix="";
 
+            seenIconbox=FALSE;
+            builtinpager=FALSE;
 	}
 /^#/    {   # Comment, pass it thru
 	    print $0;
 	    next
 	}
 
-/^$/    {   # Empty line, pass it thru
+/^[ \t]*$/    {   # Empty line, pass it thru
 	    print $0;
 	    next;
 	}
@@ -198,18 +206,62 @@
 	    next;
 	}
 
-# @@@@@@@@@@To Do@@@@@@@@@@@@@@@
+
+# Config FvwmPager module to look like built-in pager
+/^Pager[ \t]+/ {
+            builtinpager=TRUE;
+            dflt["pagerx"]=$2;
+            dflt["pagery"]=$3;
+            print "#! " $0 " (will configure FvwmPager to emulate builtin pager)";
+            next;
+        }
 /^PagerForeColor[	 ]/ {
 	    dflt["pagerforecolor"]=pagerforecolor=$2;
-	    printf ("#!%s (new command=Style FvwmPager)\n", $0);
+            print "#! " $0 " (use FvwmPager module)";
 	    next;
 	}
-# @@@@@@@@@@To Do@@@@@@@@@@@@@@@
+
 /^PagerBackColor[	 ]/ {
 	    dflt["pagerbackcolor"]=pagerbackcolor=$2;
-	    printf ("#!%s (new command=Style FvwmPager)\n", $0);
+            print "#! " $0 " (use FvwmPager module)";
 	    next;
 	}
+/^PagerFont[ \t]+/ {
+            dflt["pagerfont"]=$2;
+            print "#! " $0 " (use FvwmPager module)";
+            next;
+        }
+/^DeskTopScale[ \t]+/ {
+            dflt["desktopscale"]=$2;
+            print "#! " $0 " (use FvwmPager module)";
+            next;
+}
+/^Style "FvwmPager"/ {
+            if (builtinpager) {
+              print "#! " $0 " (reconfiguring FvwmPager)";
+              next;
+            } else {
+              print;
+              next;
+            }
+}
+/^Style "Fvwm Pager"[ \t]/ {
+            if (builtinpager)
+              sub("^Style \"Fvwm Pager\"[ \t]", "Style \"FvwmPager\" ");
+            print;
+            next;
+}
+# now nuke any FvwmPager module config if builtinpager is TRUE, since
+# were going to write our own config at the end
+/^\*FvwmPager/ { if (builtinpager) {
+                   print "#! " $0 " (reconfiguring FvwmPager to emulate builtin pager)";
+		   next;
+		 }
+                 else {
+		   print;
+                   next;
+		 }
+            }
 
 # Translate both old ButtonStyle formats to the new format:
 /^ButtonStyle[	 ]/  {
@@ -231,7 +283,7 @@
 		x=substr($3,1,p-1)/2;
 		y=substr($3,p+1)/2;
 		printf ("%s %s 5 %dx%d@0 %dx%d@0 %dx%d@0 %dx%d@1 %dx%d@1\n",
-		    $1, $2, 50-x,50+y, 50+x,50+y, 50-x,50-y, 50+x,50-y,
+		    $1, $2, 50-x,50+y, 50+x,50+y, 50+x,50-y, 50-x,50-y,
 		    50-x,50+y);
 	    }
 	    next;
@@ -246,22 +298,29 @@
 	}
 /^StdBackColor[	 ]/ {
 	    dflt["stdbackcolor"]=stdbackcolor=$2;
-	    printf ("#!%s (new command=Style \"*\" Color f/b)\n)\n", $0);
+	    printf ("#!%s (new command=Style \"*\" Color f/b)\n", $0);
 	    print "Style \"*\" BackColor " $2;
 	    next;
 	}
 /^IconBox[	 ]/ {
-	    print "Style \"*\" " $0;
+	    if (!seenIconbox) {
+	      print "Style \"*\" " $0;
+              seenIconbox=TRUE;
+            } else {
+              print "#! " $0 " (multiple iconboxes no longer possible)"
+            }
 	    next;
 	}
 /^MWMFunctionHints$/ { printf ("Style \"*\" MWMFunctions\n"); next; }
 /^MWMDecor$/         { printf ("Style \"*\" MWMDecor\n"); next; }
 /^MWMDecorHints$/         { printf ("Style \"*\" MWMDecor\n"); next; }
 /^MWMBorder$/        { printf ("Style \"*\" MWMBorder\n"); next; }
+/^MWMBorders$/        { printf ("Style \"*\" MWMBorder\n"); next; }
 /^MWMButtons$/       { printf ("Style \"*\" MWMButtons\n"); next; }
 /^MWMHintOverride$/  { printf ("Style \"*\" HintOverride\n"); next; }
 /^RandomPlacement$/ { print "Style \"*\" " $0; next; }
 /^SmartPlacement$/ { print "Style \"*\" " $0; next; }
+/^Cursor[ 	]/ { print "#! " $0 " (Cursor command withdrawn)"; next; }
 /^BorderWidth$/ { print "Style \"*\" " $0; next; }
 /^HandleWidth$/ { print "Style \"*\" " $0; next; }
 /^NoPPosition$/ { print "Style \"*\" " $0; next; }
@@ -269,11 +328,12 @@
 /^SuppressIcons$/      { print "Style \"*\" NoIcon"; next; }
 /^StickyIcons$/      { print "Style \"*\" StickyIcon"; next; }
 
+/^SloppyFocus$/ { print "Style \"*\" " $0; next; }
 /^AutoRaise[	 ]/	{ print "#! " $0 " (use Module FvwmAuto)";
 			  print "AddToFunc \"InitFunction\" \"I\" Module FvwmAuto " $2;
 			  next;
 			}
-/^ModulePath[	 ]/    { print "ModulePath /isg/proj/x11/contrib/clients/fvwm2"; next; }
+/^ModulePath[	 ]/    { print "#! " $0 " (using compiled-in default)"; next; }
 /^PixmapPath[	 ]/    { print $0; next; }
 /^IconPath[	 ]/      { print $0; next; }
 /^Style[	 ]/         { print $0; next; }
@@ -301,12 +361,7 @@
 /^EdgeScroll[	 ]/	{ print $0; next; }
 /^EdgeResistance[	 ]/ { print $0; next; }
 /^DeskTopSize[	 ]/ { print $0; next; }
-/^DeskTopScale/ {
-	print "#! " $0;
-	print "Warning: " $1 " not in Fvwm2, command dropped">"/dev/stderr";
-	next;
- }
-/^WindowListSkip[	 ]/ { print "#! $0 [deleted]";
+/^WindowListSkip[	 ]/ { print "#! " $0 " [deleted]";
 		if (warned[$1]==FALSE)
 		{
 		print "Warning: " $1 " commented out, obsolete" >"/dev/stderr";
@@ -314,7 +369,7 @@
 		}
 		next;
 	}
-/^Pager/ { print "#! $0 [deleted]";
+/^Pager/ { print "#! " $0 " [deleted]";
 		if (warned[$1]==FALSE)
 		{
 		print "Warning: " $1 " commented out, obsolete (use FvwmPager)" >"/dev/stderr";
@@ -366,14 +421,16 @@
 	    next;
 	}
 
-/^Popup[	 ]/ {
+/^Popup[ \t]+/ {
 	    if (inpopup)
 		print "ERROR: EndPopup missing" >"/dev/stderr";
 	    if (infunction)
 		print "ERROR: EndFunction missing" >"/dev/stderr";
 	    infunction=FALSE;
 	    inpopup=TRUE;
-	    prefix="AddToMenu " $2;
+            sub("^Popup[ \t]+", "");
+            sub("[ \t]+$", "");
+	    prefix="AddToMenu " $0;
 	    next;
 	}
 /^EndPopup$/ {
@@ -445,6 +502,19 @@
 	    {
 		printf ("\n#Set the foreground and background color for selected windows\n");
 		printf ("HilightColor   %s %s\n", dflt["hiforecolor"], dflt["hibackcolor"]);
+	    }
+	    if (builtinpager)
+	    {
+	      print "#! FvwmPager config to emulate builtin pager"
+	      print "*FvwmPagerBack " dflt["pagerbackcolor"];
+	      print "*FvwmPagerFore Black";
+	      print "*FvwmPagerFont none";
+	      print "*FvwmPagerHilight " dflt["pagerforecolor"];
+	      print "*FvwmPagerGeometry " dflt["pagerx"] dflt["pagery"];
+	      print "*FvwmPagerSmallFont " dflt["pagerfont"];
+              print "*FvwmPagerDeskTopScale " dflt["desktopscale"];
+	      print "#! Now start pager";
+	      print "Module FvwmPager 0 0";
 	    }
 	}
 '
--
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 [email-masked].
To report problems, send mail to [email-masked].