
Hi jwz.

Love your work. am playing with a PDA which has no keyboard, so here is a
patch to xkeycaps 2.42 that adds a -keycapsonly option. This gives me a bit
more screen real estate. Done only as a quick hack, but you asked for
mods :)

d

diff -ru ../xkeycaps-2.42/KbdWidget.c ./KbdWidget.c
--- ../xkeycaps-2.42/KbdWidget.c	Tue May 13 17:57:39 1997
+++ ./KbdWidget.c	Thu Sep  3 13:55:10 1998
@@ -47,7 +47,9 @@
 #endif
   { "selectCursor", "Cursor", XtRCursor, sizeof (Cursor),
       XtOffset (KeyboardWidget, keyboard.select_cursor), XtRString,
-      "crosshair" }
+      "crosshair" },
+  { "keycapsOnly", "KeycapsOnly", XtRBoolean, sizeof (XtRBoolean),
+       XtOffset (KeyboardWidget, keyboard.keycaps_only), XtRImmediate, False }
 };
 
 XtActionsRec keyboard_actions [] = {
diff -ru ../xkeycaps-2.42/KbdWidgetP.h ./KbdWidgetP.h
--- ../xkeycaps-2.42/KbdWidgetP.h	Tue May 13 17:57:38 1997
+++ ./KbdWidgetP.h	Thu Sep  3 13:56:07 1998
@@ -55,6 +55,7 @@
   Boolean use_xtrap;			/*  server extension to read events. */
   char *trap_data;			/* The XTrap "Trap Context" */
 #endif
+  Boolean keycaps_only;			/* Don't show buttons/info panel */
 
   struct info_labels *label_widgets;	/* For info.c */
   struct key_menus *key_menus;		/* For commands.c */
diff -ru ../xkeycaps-2.42/KeyWidget.c ./KeyWidget.c
--- ../xkeycaps-2.42/KeyWidget.c	Thu Dec 18 19:32:06 1997
+++ ./KeyWidget.c	Thu Sep  3 14:09:37 1998
@@ -12,7 +12,7 @@
 
 #include <X11/cursorfont.h>
 #include <X11/Intrinsic.h>
-#include "KbdWidget.h"
+#include "KbdWidgetP.h"
 #include "KeyWidgetP.h"
 #include <stdio.h>
 
@@ -343,7 +343,7 @@
 	XDrawString (dpy, window, k3_gc, x, y, k3, strlen (k3));
     }
 
-  if (w->key.keycode)
+  if (w->key.keycode && !((KeyboardWidget)XtParent(w))->keyboard.keycaps_only)
     {
       unsigned char buf [100];
       sprintf ((char *) buf, "%02X", w->key.keycode);
Only in .: Makefile
diff -ru ../xkeycaps-2.42/commands.c ./commands.c
--- ../xkeycaps-2.42/commands.c	Thu Jul 24 18:48:57 1997
+++ ./commands.c	Thu Sep  3 14:44:29 1998
@@ -1351,6 +1351,17 @@
   XtAddCallback (item, XtNcallback, restore_key_default, (XtPointer) widget);
   key_menus->popup_kids [i++] = item;
 
+  if (widget->keyboard.keycaps_only) {
+    /* ugh.. wish i had more time - maybe use an action on a button? */
+    item = XtCreateManagedWidget ("focus", smeBSBObjectClass, menu, av, ac);
+    XtAddCallback (item, XtNcallback, button_pick_window, (XtPointer) widget);
+    key_menus->popup_kids [i++] = item;
+
+    item = XtCreateManagedWidget ("quit", smeBSBObjectClass, menu, av, ac);
+    XtAddCallback (item, XtNcallback, button_quit, (XtPointer) widget);
+    key_menus->popup_kids [i++] = item;
+  }
+
   key_menus->edit_key_box = make_edit_key_dbox (widget);
   key_menus->select_kbd_box = make_select_kbd_dbox (widget);
   return key_menus;
@@ -1373,6 +1384,7 @@
   XtSetArg (av [ac], XtNsensitive, sensitive); ac++;
   for (i = 0; i < sizeof (key_menus->popup_kids); i++)
     if (! key_menus->popup_kids [i]) return;
+    else if (i >= 5) /* leave the command items */;
     else XtSetValues (key_menus->popup_kids [i], av, ac);
 }
 
diff -ru ../xkeycaps-2.42/defaults.h ./defaults.h
--- ../xkeycaps-2.42/defaults.h	Fri Jul  4 21:00:12 1997
+++ ./defaults.h	Thu Sep  3 14:43:07 1998
@@ -185,6 +185,8 @@
   "*keyMenu.cloneKey.label:		Duplicate Key",
   "*keyMenu.disableKey.label:		Disable Key",
   "*keyMenu.restoreKey.label:		Restore Key to Default",
+  "*keyMenu.focus.label:		Type At Window",
+  "*keyMenu.quit.label:			Quit",
 
   "*editKey*keysym1.label:		KeySym 1:",
   "*editKey*keysym2.label:		KeySym 2:",
@@ -456,5 +458,6 @@
   { "-no_xtrap",	"*useXTrap",			XrmoptionNoArg,"off" },
 #endif
   { "-keyboard",	"*Keyboard.keyboard",		XrmoptionSepArg, 0 },
-  { "-kbd",		"*Keyboard.keyboard",		XrmoptionSepArg, 0 }
+  { "-kbd",		"*Keyboard.keyboard",		XrmoptionSepArg, 0 },
+  { "-keycapsonly",	"*Keyboard.keycapsOnly",	XrmoptionNoArg, "on" },
 };
diff -ru ../xkeycaps-2.42/xkeycaps.c ./xkeycaps.c
--- ../xkeycaps-2.42/xkeycaps.c	Thu Jul  3 12:20:22 1997
+++ ./xkeycaps.c	Thu Sep  3 14:27:34 1998
@@ -307,6 +307,9 @@
   XtAddEventHandler ((Widget) keyboard, 0, True,
 		     keyboard_handle_mapping_notify, 0);
   XtRealizeWidget (toplevel);
+  if (keyboard->keyboard.keycaps_only) {
+  	XtUnrealizeWidget (box2);
+  }
 
   XtSetKeyboardFocus (toplevel, (Widget) keyboard);
   maybe_relabel_window (keyboard);
diff -ru ../xkeycaps-2.42/xkeycaps.man ./xkeycaps.man
--- ../xkeycaps-2.42/xkeycaps.man	Mon Jan 19 07:32:31 1998
+++ ./xkeycaps.man	Thu Sep  3 14:47:33 1998
@@ -48,6 +48,10 @@
 .TP 4
 .B \-font \fIfontname\fP
 Specifies the font to use to display the keycaps.
+.TP 4
+.B \-keycapsonly
+Displays only the keycaps, and hides the keycodes, status messages and
+buttons.
 .SH ""
 The following standard X Toolkit command line arguments are commonly 
 used with \fIxkeycaps\fP:
@@ -673,7 +677,7 @@
 vendor-specific keysyms.  
 .SH UPGRADES
 The latest version can always be found at 
-http://people.netscape.com/jwz/xkeycaps/
+http://www.jwz.org/xkeycaps/
 .SH SEE ALSO
 .BR X (1),
 .BR xmodmap (1),

