ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/xdefaults.C
(Generate patch)

Comparing rxvt-unicode/src/xdefaults.C (file contents):
Revision 1.177 by root, Sun May 18 18:09:52 2014 UTC vs.
Revision 1.182 by sf-exg, Wed Sep 3 18:47:16 2014 UTC

9 * Copyright (c) 2003-2006 Marc Lehmann <schmorp@schmorp.de> 9 * Copyright (c) 2003-2006 Marc Lehmann <schmorp@schmorp.de>
10 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> 10 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or 14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version. 15 * (at your option) any later version.
16 * 16 *
17 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96 STRG (Rs_geometry, "geometry", "geometry", "geometry", "size (in characters) and position"), 96 STRG (Rs_geometry, "geometry", "geometry", "geometry", "size (in characters) and position"),
97 SWCH ("C", Opt_console, 0, "intercept console messages"), 97 SWCH ("C", Opt_console, 0, "intercept console messages"),
98 SWCH ("iconic", Opt_iconic, 0, "start iconic"), 98 SWCH ("iconic", Opt_iconic, 0, "start iconic"),
99 SWCH ("ic", Opt_iconic, 0, NULL), /* short form */ 99 SWCH ("ic", Opt_iconic, 0, NULL), /* short form */
100 STRG (Rs_chdir, "chdir", "cd", "string", "start shell in this directory"), 100 STRG (Rs_chdir, "chdir", "cd", "string", "start shell in this directory"),
101 SWCH ("dockapp", Opt_dockapp, 0, "start as dockapp"),
101 BOOL (Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, 0, "reverse video"), 102 BOOL (Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, 0, "reverse video"),
102 BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, 0, "login shell"), 103 BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, 0, "login shell"),
104 STRG (Rs_multiClickTime, "multiClickTime", "mc", "number", "Maximum time (in ms) between multi-click selections"),
103 BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, 0, "jump scrolling"), 105 BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, 0, "jump scrolling"),
104 BOOL (Rs_skipScroll, "skipScroll", "ss", Opt_skipScroll, 0, "skip scrolling"), 106 BOOL (Rs_skipScroll, "skipScroll", "ss", Opt_skipScroll, 0, "skip scrolling"),
105 BOOL (Rs_pastableTabs, "pastableTabs", "ptab", Opt_pastableTabs, 0, "tab characters are pastable"), 107 BOOL (Rs_pastableTabs, "pastableTabs", "ptab", Opt_pastableTabs, 0, "tab characters are pastable"),
106 RSTRG (Rs_scrollstyle, "scrollstyle", "mode"), 108 RSTRG (Rs_scrollstyle, "scrollstyle", "mode"),
107 BOOL (Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, 0, "scrollbar"), 109 BOOL (Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, 0, "scrollbar"),
705 { "4", 1, Mod4Mask }, 707 { "4", 1, Mod4Mask },
706 { "5", 1, Mod5Mask }, 708 { "5", 1, Mod5Mask },
707}; 709};
708 710
709int 711int
710rxvt_term::bind_action (const char *str, const char *arg) 712rxvt_term::parse_keysym (const char *str, unsigned int &state)
711{ 713{
712 int sym; 714 int sym;
713 unsigned int state = 0;
714 const char *key = strrchr (str, '-'); 715 const char *key = strrchr (str, '-');
716
717 state = 0;
715 718
716 if (!key) 719 if (!key)
717 key = str; 720 key = str;
718 else 721 else
719 key++; 722 key++;
720 723
721 // string or key is empty 724 // string or key is empty
722 if (*arg == '\0' || *key == '\0') 725 if (*key == '\0')
723 return -1; 726 return -1;
724 727
725 // parse modifiers 728 // parse modifiers
726 while (str < key) 729 while (str < key)
727 { 730 {
752 sym = strtol (str, &end, 16); 755 sym = strtol (str, &end, 16);
753 if (*end) 756 if (*end)
754 return -1; 757 return -1;
755 } 758 }
756 759
760 return sym;
761}
762
763int
764rxvt_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
757 wchar_t *ws = rxvt_mbstowcs (arg); 772 wchar_t *ws = rxvt_mbstowcs (arg);
758 if (!HOOK_INVOKE ((this, HOOK_REGISTER_COMMAND, DT_INT, sym, DT_INT, state, DT_WCS_LEN, ws, wcslen (ws), DT_END)))
759 keyboard->register_action (sym, state, ws); 773 keyboard->register_action (sym, state, ws);
760 774
761 free (ws); 775 free (ws);
762 return 1; 776 return 1;
763} 777}
764 778

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines