diff -ur ratpoison/src/actions.c ratpoison-unbound/src/actions.c --- ratpoison/src/actions.c Thu Jan 10 13:03:55 2002 +++ ratpoison-unbound/src/actions.c Fri Jan 18 00:43:06 2002 @@ -1390,12 +1390,27 @@ int max_width = 0; int drawing_keys = 1; /* 1 if we are drawing keys 0 if we are drawing commands */ char *keysym_name; + char *unbound; /* string to know what commands that are not bound to any key */ + char *zap; /* pointer to area in unbound to blank */ + char *tmp; /* i know var names like this isn't supposed to exist */ + int tmplen; /* they are used to output unbound commands */ XMapRaised (dpy, s->help_window); XGetInputFocus (dpy, &fwin, &revert); XSetInputFocus (dpy, s->help_window, RevertToPointerRoot, CurrentTime); + unbound = malloc(1000); /* FIXME real size required & error handling */ + + strcpy(unbound, " "); + + for(i = 0; user_commands[i].name; i++) + { + strcat(unbound, user_commands[i].name); + strcat(unbound, " "); + } + + XDrawString (dpy, s->help_window, s->normal_gc, 10, y + defaults.font->max_bounds.ascent, "ratpoison key bindings", strlen ("ratpoison key bindings")); @@ -1417,7 +1432,7 @@ i = 0; old_i = 0; - while (imax_bounds.ascent, key_actions[i].data, strlen (key_actions[i].data)); + if((zap = strstr(unbound, key_actions[i].data))) + { + if((zap[-1] == ' ') && (zap[strlen(key_actions[i].data)] == ' ')) + memset(zap, ' ', strlen (key_actions[i].data)); + } + if (XTextWidth (defaults.font, key_actions[i].data, strlen (key_actions[i].data)) > max_width) { max_width = XTextWidth (defaults.font, key_actions[i].data, strlen (key_actions[i].data)); @@ -1476,6 +1497,24 @@ } } } + + /* */ + + for(i = 0; i < strlen(unbound) ; i++) + { + if(strchr(unbound + i, ' ') != unbound + i) + { + tmplen = (strchr(unbound + i, ' ') - (unbound + i)); + tmp = malloc(tmplen + 1); /* FIXME sizeof byte and stuff ? error handling */ + strncpy(tmp, unbound + i, tmplen); + tmp[tmplen] = '\0'; + XDrawString (dpy, s->help_window, s->normal_gc, + x, y + defaults.font->max_bounds.ascent, + tmp, tmplen); + y += FONT_HEIGHT (defaults.font); /* FIXME x & y */ + i += --tmplen; + } + } XMaskEvent (dpy, KeyPressMask, &ev); XUnmapWindow (dpy, s->help_window);