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.25 by root, Mon Feb 20 22:40:35 2006 UTC vs.
Revision 1.27 by ayin, Sun Jul 29 09:37:01 2007 UTC

138 } 138 }
139 139
140 return len; 140 return len;
141} 141}
142 142
143////////////////////////////////////////////////////////////////////////////////
144// return: #bits of '1'
145#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
146# define bitcount(n) (__extension__ ({ uint32_t n__ = (n); __builtin_popcount (n__); }))
147#else
148static int
149bitcount (uint16_t n)
150{
151 int i;
152
153 for (i = 0; n; ++i, n &= n - 1)
154 ;
155
156 return i;
157}
158#endif
159
160// return: priority_of_a - priority_of_b 143// return: priority_of_a - priority_of_b
161static int 144static int
162compare_priority (keysym_t *a, keysym_t *b) 145compare_priority (keysym_t *a, keysym_t *b)
163{ 146{
164 // (the more '1's in state; the less range): the greater priority 147 // (the more '1's in state; the less range): the greater priority
165 int ca = bitcount (a->state /* & OtherModMask */); 148 int ca = popcount (a->state /* & OtherModMask */);
166 int cb = bitcount (b->state /* & OtherModMask */); 149 int cb = popcount (b->state /* & OtherModMask */);
167 150
168 if (ca != cb) 151 if (ca != cb)
169 return ca - cb; 152 return ca - cb;
170//else if (a->state != b->state) // this behavior is to be disscussed 153//else if (a->state != b->state) // this behavior is to be disscussed
171// return b->state - a->state; 154// return b->state - a->state;
236 if (suffix && middle && suffix > middle + 1) 219 if (suffix && middle && suffix > middle + 1)
237 { 220 {
238 key->type = keysym_t::LIST; 221 key->type = keysym_t::LIST;
239 key->range = suffix - middle - 1; 222 key->range = suffix - middle - 1;
240 223
241 strcpy (translation, translation + 4); 224 memmove (translation, translation + 4, strlen (translation + 4) + 1);
242 } 225 }
243 else 226 else
244 rxvt_warn ("cannot parse list-type keysym '%s', treating as normal keysym.\n", translation); 227 rxvt_warn ("cannot parse list-type keysym '%s', treating as normal keysym.\n", translation);
245 } 228 }
246 else if (strncmp (translation, "builtin:", 8) == 0) 229 else if (strncmp (translation, "builtin:", 8) == 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines