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

Comparing rxvt-unicode/src/keyboard.C (file contents):
Revision 1.52 by sf-exg, Fri Dec 2 09:02:05 2011 UTC vs.
Revision 1.53 by sf-exg, Fri Dec 2 09:13:50 2011 UTC

112void 112void
113keyboard_manager::register_user_translation (KeySym keysym, unsigned int state, const wchar_t *ws) 113keyboard_manager::register_user_translation (KeySym keysym, unsigned int state, const wchar_t *ws)
114{ 114{
115 char *translation = rxvt_wcstoutf8 (ws); 115 char *translation = rxvt_wcstoutf8 (ws);
116 116
117 if (strncmp (translation, "list", 4) == 0 && translation [4]
118 && strlen (translation) < STRING_MAX)
119 {
120 char *prefix = translation + 4;
121 char *middle = strchr (prefix + 1, translation [4]);
122 char *suffix = strrchr (prefix + 1, translation [4]);
123
124 if (suffix && middle && suffix > middle + 1)
125 {
126 int range = suffix - middle - 1;
127 int prefix_len = middle - prefix - 1;
128 char buf[STRING_MAX];
129
130 memcpy (buf, prefix + 1, prefix_len);
131 strcpy (buf + prefix_len + 1, suffix + 1);
132
133 for (int i = 0; i < range; i++)
134 {
135 buf [prefix_len] = middle [i + 1];
136 register_translation (keysym + i, state, strdup (buf));
137 }
138
139 free (translation);
140 return;
141 }
142 else
143 rxvt_warn ("unable to parse list-type keysym '%s', processing as normal keysym.\n", translation);
144 }
145
146 register_translation (keysym, state, translation); 117 register_translation (keysym, state, translation);
147} 118}
148 119
149void 120void
150keyboard_manager::register_translation (KeySym keysym, unsigned int state, char *translation) 121keyboard_manager::register_translation (KeySym keysym, unsigned int state, char *translation)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines