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.42 by sf-exg, Sat May 7 18:29:18 2011 UTC vs.
Revision 1.46 by sf-exg, Sun Nov 27 10:14:51 2011 UTC

78// return: priority_of_a - priority_of_b 78// return: priority_of_a - priority_of_b
79static int 79static int
80compare_priority (keysym_t *a, keysym_t *b) 80compare_priority (keysym_t *a, keysym_t *b)
81{ 81{
82 // (the more '1's in state; the less range): the greater priority 82 // (the more '1's in state; the less range): the greater priority
83 int ca = rxvt_popcount (a->state /* & OtherModMask */); 83 int ca = ecb_popcount32 (a->state /* & OtherModMask */);
84 int cb = rxvt_popcount (b->state /* & OtherModMask */); 84 int cb = ecb_popcount32 (b->state /* & OtherModMask */);
85 85
86 if (ca != cb) 86 if (ca != cb)
87 return ca - cb; 87 return ca - cb;
88//else if (a->state != b->state) // this behavior is to be discussed 88//else if (a->state != b->state) // this behavior is to be discussed
89// return b->state - a->state; 89// return b->state - a->state;
108{ 108{
109 hash [0] = 2; 109 hash [0] = 2;
110 110
111 for (unsigned int i = 0; i < keymap.size (); ++i) 111 for (unsigned int i = 0; i < keymap.size (); ++i)
112 { 112 {
113 free ((void *)keymap [i]->str); 113 free (keymap [i]->str);
114 delete keymap [i]; 114 delete keymap [i];
115 keymap [i] = 0; 115 keymap [i] = 0;
116 } 116 }
117 117
118 keymap.clear (); 118 keymap.clear ();
151 151
152 free (translation); 152 free (translation);
153 return; 153 return;
154 } 154 }
155 else 155 else
156 rxvt_warn ("cannot parse list-type keysym '%s', processing as normal keysym.\n", translation); 156 rxvt_warn ("unable to parse list-type keysym '%s', processing as normal keysym.\n", translation);
157 } 157 }
158 158
159 register_translation (keysym, state, translation); 159 register_translation (keysym, state, translation);
160} 160}
161 161
177 register_keymap (key); 177 register_keymap (key);
178 } 178 }
179 else 179 else
180 { 180 {
181 delete key; 181 delete key;
182 free ((void *)translation); 182 free (translation);
183 rxvt_fatal ("out of memory, aborting.\n"); 183 rxvt_fatal ("memory allocation failure. aborting.\n");
184 } 184 }
185} 185}
186 186
187void 187void
188keyboard_manager::register_keymap (keysym_t *key) 188keyboard_manager::register_keymap (keysym_t *key)
201} 201}
202 202
203bool 203bool
204keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state) 204keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state)
205{ 205{
206 assert (hash[0] == 0 && "register_done() need to be called"); 206 assert (("register_done() need to be called", hash[0] == 0));
207 207
208 state &= OtherModMask; // mask out uninteresting modifiers 208 state &= OtherModMask; // mask out uninteresting modifiers
209 209
210 if (state & term->ModMetaMask) state |= MetaMask; 210 if (state & term->ModMetaMask) state |= MetaMask;
211 if (state & term->ModNumLockMask) state |= NumLockMask; 211 if (state & term->ModNumLockMask) state |= NumLockMask;
225 wchar_t *wc = rxvt_utf8towcs (key.str); 225 wchar_t *wc = rxvt_utf8towcs (key.str);
226 char *str = rxvt_wcstombs (wc); 226 char *str = rxvt_wcstombs (wc);
227 // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.) 227 // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.)
228 free (wc); 228 free (wc);
229 229
230 switch (key.type)
231 {
232 case keysym_t::STRING:
233 output_string (term, str); 230 output_string (term, str);
234 break;
235 }
236 231
237 free (str); 232 free (str);
238 233
239 return true; 234 return true;
240 } 235 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines