Mercurial > sdl-ios-xcode
comparison src/video/fbcon/SDL_fbevents.c @ 1778:e28233f37f8c
Fixed detection of current vt when not running as root.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 08 May 2006 05:17:10 +0000 |
parents | ed39aa7383ea |
children | 7a36f01acf71 |
comparison
equal
deleted
inserted
replaced
1777:402d5ff1cf88 | 1778:e28233f37f8c |
---|---|
53 | 53 |
54 #ifndef GPM_NODE_FIFO | 54 #ifndef GPM_NODE_FIFO |
55 #define GPM_NODE_FIFO "/dev/gpmdata" | 55 #define GPM_NODE_FIFO "/dev/gpmdata" |
56 #endif | 56 #endif |
57 | 57 |
58 /*#define DEBUG_KEYBOARD*/ | |
58 /*#define DEBUG_MOUSE*/ | 59 /*#define DEBUG_MOUSE*/ |
59 | 60 |
60 /* The translation tables from a console scancode to a SDL keysym */ | 61 /* The translation tables from a console scancode to a SDL keysym */ |
61 #define NUM_VGAKEYMAPS (1<<KG_CAPSSHIFT) | 62 #define NUM_VGAKEYMAPS (1<<KG_CAPSSHIFT) |
62 static Uint16 vga_keymap[NUM_VGAKEYMAPS][NR_KEYS]; | 63 static Uint16 vga_keymap[NUM_VGAKEYMAPS][NR_KEYS]; |
279 } | 280 } |
280 } | 281 } |
281 } | 282 } |
282 if ( keyboard_fd < 0 ) { | 283 if ( keyboard_fd < 0 ) { |
283 /* Last resort, maybe our tty is a usable VT */ | 284 /* Last resort, maybe our tty is a usable VT */ |
284 current_vt = 0; | 285 struct vt_stat vtstate; |
286 | |
285 keyboard_fd = open("/dev/tty", O_RDWR); | 287 keyboard_fd = open("/dev/tty", O_RDWR); |
288 | |
289 if ( ioctl(keyboard_fd, VT_GETSTATE, &vtstate) == 0 ) { | |
290 current_vt = vtstate.v_active; | |
291 } else { | |
292 current_vt = 0; | |
293 } | |
286 } | 294 } |
287 #ifdef DEBUG_KEYBOARD | 295 #ifdef DEBUG_KEYBOARD |
288 fprintf(stderr, "Current VT: %d\n", current_vt); | 296 fprintf(stderr, "Current VT: %d\n", current_vt); |
289 #endif | 297 #endif |
290 saved_kbd_mode = -1; | 298 saved_kbd_mode = -1; |