Commit 64866c3d5c20fa5e7cc5838030e59965e55f7a85

Authored by bellard
1 parent 294e8637

more keycodes - hexa keycodes - keycode completion


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1907 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 33 additions and 0 deletions
monitor.c
... ... @@ -666,6 +666,8 @@ static const KeyDef key_defs[] = {
666 666 { 0x09, "8" },
667 667 { 0x0a, "9" },
668 668 { 0x0b, "0" },
  669 + { 0x0c, "minus" },
  670 + { 0x0d, "equal" },
669 671 { 0x0e, "backspace" },
670 672  
671 673 { 0x0f, "tab" },
... ... @@ -715,6 +717,24 @@ static const KeyDef key_defs[] = {
715 717 { 0x45, "num_lock" },
716 718 { 0x46, "scroll_lock" },
717 719  
  720 + { 0xb5, "kp_divide" },
  721 + { 0x37, "kp_multiply" },
  722 + { 0x4a, "kp_substract" },
  723 + { 0x4e, "kp_add" },
  724 + { 0x9c, "kp_enter" },
  725 + { 0x53, "kp_decimal" },
  726 +
  727 + { 0x52, "kp_0" },
  728 + { 0x4f, "kp_1" },
  729 + { 0x50, "kp_2" },
  730 + { 0x51, "kp_3" },
  731 + { 0x4b, "kp_4" },
  732 + { 0x4c, "kp_5" },
  733 + { 0x4d, "kp_6" },
  734 + { 0x47, "kp_7" },
  735 + { 0x48, "kp_8" },
  736 + { 0x49, "kp_9" },
  737 +
718 738 { 0x56, "<" },
719 739  
720 740 { 0x57, "f11" },
... ... @@ -740,11 +760,18 @@ static const KeyDef key_defs[] = {
740 760 static int get_keycode(const char *key)
741 761 {
742 762 const KeyDef *p;
  763 + char *endp;
  764 + int ret;
743 765  
744 766 for(p = key_defs; p->name != NULL; p++) {
745 767 if (!strcmp(key, p->name))
746 768 return p->keycode;
747 769 }
  770 + if (strstart(key, "0x", NULL)) {
  771 + ret = strtoul(key, &endp, 0);
  772 + if (*endp == '\0' && ret >= 0x01 && ret <= 0xff)
  773 + return ret;
  774 + }
748 775 return -1;
749 776 }
750 777  
... ... @@ -2152,6 +2179,7 @@ void readline_find_completion(const char *cmdline)
2152 2179 int nb_args, i, len;
2153 2180 const char *ptype, *str;
2154 2181 term_cmd_t *cmd;
  2182 + const KeyDef *key;
2155 2183  
2156 2184 parse_cmdline(cmdline, &nb_args, args);
2157 2185 #ifdef DEBUG_COMPLETION
... ... @@ -2213,6 +2241,11 @@ void readline_find_completion(const char *cmdline)
2213 2241 for(cmd = info_cmds; cmd->name != NULL; cmd++) {
2214 2242 cmd_completion(str, cmd->name);
2215 2243 }
  2244 + } else if (!strcmp(cmd->name, "sendkey")) {
  2245 + completion_index = strlen(str);
  2246 + for(key = key_defs; key->name != NULL; key++) {
  2247 + cmd_completion(str, key->name);
  2248 + }
2216 2249 }
2217 2250 break;
2218 2251 default:
... ...