… | |
… | |
707 | { "4", 1, Mod4Mask }, |
707 | { "4", 1, Mod4Mask }, |
708 | { "5", 1, Mod5Mask }, |
708 | { "5", 1, Mod5Mask }, |
709 | }; |
709 | }; |
710 | |
710 | |
711 | int |
711 | int |
712 | rxvt_term::bind_action (const char *str, const char *arg) |
712 | rxvt_term::parse_keysym (const char *str, unsigned int &state) |
713 | { |
713 | { |
714 | int sym; |
714 | int sym; |
715 | unsigned int state = 0; |
|
|
716 | const char *key = strrchr (str, '-'); |
715 | const char *key = strrchr (str, '-'); |
|
|
716 | |
|
|
717 | state = 0; |
717 | |
718 | |
718 | if (!key) |
719 | if (!key) |
719 | key = str; |
720 | key = str; |
720 | else |
721 | else |
721 | key++; |
722 | key++; |
722 | |
723 | |
723 | // string or key is empty |
724 | // string or key is empty |
724 | if (*arg == '\0' || *key == '\0') |
725 | if (*key == '\0') |
725 | return -1; |
726 | return -1; |
726 | |
727 | |
727 | // parse modifiers |
728 | // parse modifiers |
728 | while (str < key) |
729 | while (str < key) |
729 | { |
730 | { |
… | |
… | |
754 | sym = strtol (str, &end, 16); |
755 | sym = strtol (str, &end, 16); |
755 | if (*end) |
756 | if (*end) |
756 | return -1; |
757 | return -1; |
757 | } |
758 | } |
758 | |
759 | |
|
|
760 | return sym; |
|
|
761 | } |
|
|
762 | |
|
|
763 | int |
|
|
764 | rxvt_term::bind_action (const char *str, const char *arg) |
|
|
765 | { |
|
|
766 | int sym; |
|
|
767 | unsigned int state; |
|
|
768 | |
|
|
769 | if (*arg == '\0' || (sym = parse_keysym (str, state)) == -1) |
|
|
770 | return -1; |
|
|
771 | |
759 | wchar_t *ws = rxvt_mbstowcs (arg); |
772 | wchar_t *ws = rxvt_mbstowcs (arg); |
760 | if (!HOOK_INVOKE ((this, HOOK_REGISTER_COMMAND, DT_INT, sym, DT_INT, state, DT_WCS_LEN, ws, wcslen (ws), DT_END))) |
|
|
761 | keyboard->register_action (sym, state, ws); |
773 | keyboard->register_action (sym, state, ws); |
762 | |
774 | |
763 | free (ws); |
775 | free (ws); |
764 | return 1; |
776 | return 1; |
765 | } |
777 | } |
766 | |
778 | |