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.55 by sf-exg, Sat Dec 3 11:47:19 2011 UTC vs.
Revision 1.59 by root, Fri May 18 00:10:47 2012 UTC

24#include "../config.h" 24#include "../config.h"
25#include "rxvt.h" 25#include "rxvt.h"
26 26
27#ifdef KEYSYM_RESOURCE 27#ifdef KEYSYM_RESOURCE
28 28
29#include <cstring> 29#include <string.h>
30 30
31#include "rxvtperl.h" 31#include "rxvtperl.h"
32#include "keyboard.h" 32#include "keyboard.h"
33#include "command.h"
34 33
35/* an intro to the data structure: 34/* an intro to the data structure:
36 * 35 *
37 * vector keymap[] is grouped. 36 * vector keymap[] is grouped.
38 * 37 *
112{ 111{
113 char *translation = rxvt_wcstoutf8 (ws); 112 char *translation = rxvt_wcstoutf8 (ws);
114 113
115 keysym_t *key = new keysym_t; 114 keysym_t *key = new keysym_t;
116 115
117 if (!key)
118 rxvt_fatal ("memory allocation failure. aborting.\n");
119
120 key->keysym = keysym; 116 key->keysym = keysym;
121 key->state = state; 117 key->state = state;
122 key->str = translation; 118 key->str = translation;
123 key->type = keysym_t::STRING; 119 key->type = keysym_t::STRING;
124 120
172 168
173void 169void
174keyboard_manager::register_done () 170keyboard_manager::register_done ()
175{ 171{
176 unsigned int i, index, hashkey; 172 unsigned int i, index, hashkey;
177 vector <keysym_t *> sorted_keymap;
178 uint16_t hash_bucket_size[KEYSYM_HASH_BUCKETS]; // size of each bucket 173 uint16_t hash_bucket_size[KEYSYM_HASH_BUCKETS]; // size of each bucket
179 174
180 memset (hash_bucket_size, 0, sizeof (hash_bucket_size)); 175 memset (hash_bucket_size, 0, sizeof (hash_bucket_size));
181 176
182 // determine hash bucket size 177 // determine hash bucket size
194 index += hash_bucket_size [i - 1]; 189 index += hash_bucket_size [i - 1];
195 hash [i] = index; 190 hash [i] = index;
196 } 191 }
197 192
198 // and allocate just enough space 193 // and allocate just enough space
199 sorted_keymap.insert (sorted_keymap.begin (), index + hash_bucket_size [i - 1], 0); 194 simplevec <keysym_t *> sorted_keymap (index + hash_bucket_size [i - 1], 0);
200 195
201 memset (hash_bucket_size, 0, sizeof (hash_bucket_size)); 196 memset (hash_bucket_size, 0, sizeof (hash_bucket_size));
202 197
203 // fill in sorted_keymap 198 // fill in sorted_keymap
204 // it is sorted in each bucket 199 // it is sorted in each bucket

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines