--- ../ctwm-3.5.2-gnome/screen.h	Tue Dec 14 19:49:28 1999
+++ screen.h	Tue Feb 29 13:02:57 2000
@@ -130,6 +130,11 @@
     MenuRoot *Workspaces;	/* the TwmWorkspaces menu */
     MenuRoot *AllWindows;	/* the TwmAllWindows menu */
 
+  /******************************************************/
+  /* Added by Dan Lilliehorn (dl@dl.nu) 2000-02-29)     */
+    MenuRoot *Keys;             /* the TwmKeys menu     */
+    MenuRoot *Visible;          /* thw TwmVisible menu  */
+
     TwmWindow *Ring;		/* one of the windows in window ring */
     TwmWindow *RingLeader;	/* current window in ring */
 
--- ../ctwm-3.5.2-gnome/menus.h	Tue Dec 14 19:49:02 1999
+++ menus.h	Tue Feb 29 13:03:33 2000
@@ -70,6 +70,11 @@
 #define TWM_WORKSPACES	"TwmWorkspaces"	/* for f.menu "TwmWorkspaces" */
 #define TWM_ALLWINDOWS	"TwmAllWindows"	/* for f.menu "TwmAllWindows" */
 
+/*******************************************************************/
+/* Added by Dan Lilliehorn (dl@dl.nu) 2000-02-29                   */
+#define TWM_KEYS        "TwmKeys"       /* for f.menu "TwmKeys"    */
+#define TWM_VISIBLE     "TwmVisible"    /* for f.menu "TwmVisible" */
+
 #define MAX_FILE_SIZE 4096	/* max chars to read from file for cut */
 
 typedef struct MenuItem
--- ../ctwm-3.5.2-gnome/menus.c	Tue Dec 14 19:49:27 1999
+++ menus.c	Tue Feb 29 13:08:12 2000
@@ -953,6 +953,7 @@
     char *name;
 {
     MenuRoot *tmp;
+    static MenuRoot	*tmpRoot;
 
 #define UNUSED_PIXEL ((unsigned long) (~0))	/* more than 24 bits */
 
@@ -1003,6 +1004,16 @@
     if (strcmp(name, TWM_ALLWINDOWS) == 0)
 	Scr->AllWindows = tmp;
 
+    /* Added by Dan Lilliehorn (dl@dl.nu) 2000-02-29       */
+
+    if (strcmp(name, TWM_KEYS) == 0)
+	Scr->Keys = tmp;
+
+    if (strcmp(name, TWM_VISIBLE) == 0)
+      Scr->Visible = tmp;
+
+    /* End addition */
+
     return (tmp);
 }
 
@@ -1067,7 +1078,12 @@
     if ((menu == Scr->Workspaces) ||
 	(menu == Scr->Windows) ||
 	(menu == Scr->Icons) ||
-	(menu == Scr->AllWindows)) {
+	(menu == Scr->AllWindows) ||
+
+	/* Added by Dan Lillehorn (dl@dl.nu) 2000-02-29 */
+	(menu == Scr->Keys) ||
+	(menu == Scr->Visible)) {
+
 	itemname = item;
     } else
     if (*item == '*') {
@@ -1430,17 +1446,20 @@
 
     if ((menu == Scr->Windows) ||
 	(menu == Scr->Icons) ||
-	(menu == Scr->AllWindows))
+	(menu == Scr->AllWindows) ||
+	/* Added by Dan Lilliehorn (dl@dl.nu) 2000-02-29 */
+	(menu == Scr->Visible))
     {
 	TwmWindow *tmp_win;
 	WorkSpaceList *wlist;
-	Boolean all, icons;
+	Boolean all, icons, visible;      /* visible: Added by dl */
 	int func;
 
 	/* this is the twm windows menu,  let's go ahead and build it */
 
 	all = (menu == Scr->AllWindows);
 	icons = (menu == Scr->Icons);
+	visible = (menu == Scr->Visible);    /* Added by dl */
 	DestroyMenu (menu);
 
 	menu->first = NULL;
@@ -1456,6 +1475,11 @@
 	if (menu == Scr->Icons) 
   	    AddToMenu(menu, "TWM Icons", NULLSTR, NULL, F_TITLE, NULLSTR, NULLSTR);
 	else
+	  /* Added by dl */
+	  if (menu == Scr->Visible)
+	    AddToMenu(menu, "TWM Visible", NULLSTR, NULL, F_TITLE, NULLSTR, NULLSTR);
+
+	else
   	    AddToMenu(menu, "TWM All Windows", NULLSTR, NULL, F_TITLE,NULLSTR,NULLSTR);
   
 	wlist = NULL;
@@ -1478,6 +1502,7 @@
 
 	  if (!all && !OCCUPY (tmp_win, wlist)) continue;
 	  if (icons && !tmp_win->isicon) continue;
+	  if (visible && tmp_win->isicon) continue;  /* added by dl */
 	  WindowNameCount++;
 	}
         WindowNames = (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount);
@@ -1493,6 +1518,7 @@
 
 	    if (!all && ! OCCUPY (tmp_win, wlist)) continue;
 	    if (icons && !tmp_win->isicon) continue;
+	    if (visible && tmp_win->isicon) continue;  /* added by dl */
             tmp_win2 = tmp_win;
             for (i=0;i<WindowNameCount;i++)
             {
@@ -1518,6 +1544,83 @@
 	MakeMenu(menu);
     }
 
+    /* Keys added by dl */
+
+    if (menu == Scr->Keys)
+      {
+	FuncKey *tmpKey;
+	char *tmpStr, *tmpStr2;
+	char tmpStr3[21];
+	char modStr[5];
+	int oldact = 0, oldmod = 0;
+	int tmpLen;
+
+	DestroyMenu (menu);
+
+	menu->first = NULL;
+	menu->last = NULL;
+	menu->items = 0;
+	menu->width = 0;
+	menu->mapped = NEVER_MAPPED;
+	menu->highlight.fore = UNUSED_PIXEL;
+	menu->highlight.back = UNUSED_PIXEL;
+
+	AddToMenu(menu, "Twm Keys", NULLSTR,
+		  NULL, F_TITLE, NULLSTR, NULLSTR);
+
+	for (tmpKey = Scr->FuncKeyRoot.next; tmpKey != NULL; 
+	     tmpKey = tmpKey->next)
+	  {
+	    if(tmpKey->func == F_EXEC)
+	      {
+		strcpy(modStr, "");
+
+		switch(tmpKey->mods)
+		  {
+		  case 1:
+		    strcpy(modStr, "S");
+		      break;
+		  case 4:
+		    strcpy(modStr, "C");
+		    break;
+		  case 5:
+		    strcpy(modStr, "S + C");
+		    break;
+		  case 8:
+		    strcpy(modStr, "M");
+		    break;
+		  case 9:
+		    strcpy(modStr, "S + M");
+		    break;
+		  case 12:
+		    strcpy(modStr, "C + M");
+		    break;
+		  default:
+		    break;
+		  }
+
+		tmpLen = (strlen(tmpKey->name) + strlen(modStr) + 5);
+		tmpStr = malloc(sizeof(char) * tmpLen);
+		sprintf(tmpStr,"[%s + %s]", tmpKey->name, 
+			modStr);
+		tmpStr2 = malloc(sizeof(char) * (strlen(tmpKey->action)
+							+ tmpLen + 2));
+		sprintf(tmpStr2, "%s %s\0", tmpStr, tmpKey->action);
+
+		if((tmpKey->action != oldact) || (tmpKey->mods != oldmod))
+		  {
+		    AddToMenu(menu, tmpStr2, tmpKey->action, NULL,
+			      tmpKey->func, NULLSTR, NULLSTR);
+		    oldact = tmpKey->action;
+		    oldmod = tmpKey->mods;
+		  }
+	      }
+	  }
+
+	menu->pinned = False;
+	MakeMenu(menu);
+      }
+    
     if (menu->w == None || menu->items == 0) return False;
 
     /* Prevent recursively bringing up menus. */
