Changeset 6863 in vbox
- Timestamp:
- Feb 8, 2008 11:14:05 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/linux
- Files:
-
- 2 edited
-
keyboard-new.c (modified) (8 diffs)
-
keyboard.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/linux/keyboard-new.c
r6503 r6863 60 60 #include <stdarg.h> 61 61 #include <string.h> 62 #include <stdlib.h> 63 #include <stdio.h> 62 64 63 65 static unsigned keyc2scan[256]; 66 static int log_kb_1 = 0; 67 static int log_kb_2 = 0; 68 69 #define LOG_KB_1(a) \ 70 do { \ 71 if (log_kb_1) { \ 72 printf a; \ 73 } \ 74 } while (0) 75 76 #define LOG_KB_2(a) \ 77 do { \ 78 if (log_kb_2) { \ 79 printf a; \ 80 } \ 81 } while (0) 64 82 65 83 /* Keyboard layout tables for guessing the current keyboard layout. */ … … 145 163 determine the direction that the keycodes are running in. */ 146 164 int pkey = -1; 147 TRACE("Attempting to match against \"%s\"\n", main_key_tab[current].comment);165 LOG_KB_2(("Attempting to match against \"%s\"\n", main_key_tab[current].comment)); 148 166 for (keyc = min_keycode; keyc <= max_keycode; keyc++) { 149 167 if (0 != ckey[keyc][0]) { … … 189 207 str[0] = ckey[keyc][0]; 190 208 } 191 TRACE_(key)("mismatch for keycode %d, keysym \"%s\" (0x%.2hx 0x%.2hx)\n",192 keyc, str, ckey[keyc][0], ckey[keyc][1]) ;209 LOG_KB_2(("Mismatch for keycode %d, keysym \"%s\" (0x%.2hx 0x%.2hx)\n", 210 keyc, str, ckey[keyc][0], ckey[keyc][1])); 193 211 #endif /* DEBUG defined */ 194 212 } 195 213 } 196 214 } 197 TRACE("matches=%d, seq=%d\n", 198 match, seq); 215 LOG_KB_2(("Matches=%d, seq=%d\n", match, seq)); 199 216 if ( (match > max_score) 200 217 || ((match == max_score) && (seq > max_seq)) … … 207 224 } 208 225 /* we're done, report results if necessary */ 209 TRACE("detected layout is \"%s\", matches=%d, seq=%d\n",210 main_key_tab[kbd_layout].comment, max_score, max_seq) ;226 LOG_KB_1(("Detected layout is \"%s\", matches=%d, seq=%d\n", 227 main_key_tab[kbd_layout].comment, max_score, max_seq)); 211 228 return kbd_layout; 212 229 } … … 232 249 unsigned matches = 0, entries = 0; 233 250 251 /* Should we log to standard output? */ 252 if (NULL != getenv("LOG_KB_PRIMARY")) { 253 log_kb_1 = 1; 254 } 255 if (NULL != getenv("LOG_KB_SECONDARY")) { 256 log_kb_1 = 1; 257 log_kb_2 = 1; 258 } 234 259 XDisplayKeycodes(display, &min_keycode, &max_keycode); 235 260 … … 279 304 ++matches; 280 305 } 281 #ifdef DEBUG282 306 if (0 == scan) { 283 307 /* print spaces instead of \0's */ … … 289 313 str[1] = shifted; 290 314 } 291 TRACE_(key)("No match found for keycode %d, keysym \"%s\" (0x%x 0x%x)\n", 292 keyc, str, unshifted, shifted); 293 } 294 #endif /* DEBUG defined */ 315 LOG_KB_1(("No match found for keycode %d, keysym \"%s\" (0x%x 0x%x)\n", 316 keyc, str, unshifted, shifted)); 317 } else if ((keyc > 8) && (keyc < 97) && (keyc - scan != 8)) { 318 /* print spaces instead of \0's */ 319 char str[3] = " "; 320 if ((unshifted > 32) && (unshifted < 127)) { 321 str[0] = unshifted; 322 } 323 if ((shifted > 32) && (shifted < 127)) { 324 str[1] = shifted; 325 } 326 LOG_KB_1(("Warning - keycode %d, keysym \"%s\" (0x%x 0x%x) was matched to scancode %d\n", 327 keyc, str, unshifted, shifted, scan)); 328 } 295 329 } 296 330 } … … 305 339 } 306 340 } 307 TRACE("Finished mapping keyboard, matches=%d, entries=%d\n", matches, entries);341 LOG_KB_1(("Finished mapping keyboard, matches=%d, entries=%d\n", matches, entries)); 308 342 if (matches != entries) 309 343 { -
trunk/src/VBox/Frontends/VirtualBox/src/linux/keyboard.h
r6509 r6863 22 22 */ 23 23 24 #ifndef __H_KEYBOARD _OUTOFWINE25 #define __H_KEYBOARD _OUTOFWINE24 #ifndef __H_KEYBOARD 25 #define __H_KEYBOARD 26 26 27 27 #include <X11/Xlib.h> … … 42 42 #endif 43 43 44 /* debug macros */ 45 #if 0 && defined(DEBUG) 46 # include <stdio.h> 47 # define noop printf 48 #else 49 #ifdef __cplusplus 50 inline static void noop(char *, ...) 51 #else 52 inline static void noop(char *arg, ...) 53 #endif 54 { 55 } 56 #endif 57 58 #define TRACE noop 59 /* #define TRACE printf */ 60 #define TRACE_(a) noop 61 /* #define TRACE_(ch) printf */ 62 #define TRACE_ON(a) 0 63 #define WARN noop 64 #define ERR noop 65 66 #endif /* __H_KEYBOARD_OUTOFWINE */ 44 #endif /* __H_KEYBOARD */
Note:
See TracChangeset
for help on using the changeset viewer.

