comparison src/video/fbcon/SDL_fbevents.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents be736c197ceb
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
79 return; 79 return;
80 } 80 }
81 81
82 /* Load all the keysym mappings */ 82 /* Load all the keysym mappings */
83 for ( map=0; map<NUM_VGAKEYMAPS; ++map ) { 83 for ( map=0; map<NUM_VGAKEYMAPS; ++map ) {
84 memset(vga_keymap[map], 0, NR_KEYS*sizeof(Uint16)); 84 SDL_memset(vga_keymap[map], 0, NR_KEYS*sizeof(Uint16));
85 for ( i=0; i<NR_KEYS; ++i ) { 85 for ( i=0; i<NR_KEYS; ++i ) {
86 entry.kb_table = map; 86 entry.kb_table = map;
87 entry.kb_index = i; 87 entry.kb_index = i;
88 if ( ioctl(fd, KDGKBENT, &entry) == 0 ) { 88 if ( ioctl(fd, KDGKBENT, &entry) == 0 ) {
89 /* fill keytemp. This replaces SDL_fbkeys.h */ 89 /* fill keytemp. This replaces SDL_fbkeys.h */
348 sprintf(path, "/proc/%s/status", entry->d_name); 348 sprintf(path, "/proc/%s/status", entry->d_name);
349 status=fopen(path, "r"); 349 status=fopen(path, "r");
350 if ( status ) { 350 if ( status ) {
351 name[0] = '\0'; 351 name[0] = '\0';
352 fscanf(status, "Name: %s", name); 352 fscanf(status, "Name: %s", name);
353 if ( strcmp(name, wanted_name) == 0 ) { 353 if ( SDL_strcmp(name, wanted_name) == 0 ) {
354 pid = atoi(entry->d_name); 354 pid = atoi(entry->d_name);
355 } 355 }
356 fclose(status); 356 fclose(status);
357 } 357 }
358 } 358 }
383 cmdline = open(path, O_RDONLY, 0); 383 cmdline = open(path, O_RDONLY, 0);
384 if ( cmdline >= 0 ) { 384 if ( cmdline >= 0 ) {
385 len = read(cmdline, args, sizeof(args)); 385 len = read(cmdline, args, sizeof(args));
386 arg = args; 386 arg = args;
387 while ( len > 0 ) { 387 while ( len > 0 ) {
388 if ( strcmp(arg, "-R") == 0 ) { 388 if ( SDL_strcmp(arg, "-R") == 0 ) {
389 available = 1; 389 available = 1;
390 } 390 }
391 arglen = strlen(arg)+1; 391 arglen = SDL_strlen(arg)+1;
392 len -= arglen; 392 len -= arglen;
393 arg += arglen; 393 arg += arglen;
394 } 394 }
395 close(cmdline); 395 close(cmdline);
396 } 396 }
445 { 445 {
446 int imps2; 446 int imps2;
447 447
448 imps2 = 0; 448 imps2 = 0;
449 449
450 if ( getenv("SDL_MOUSEDEV_IMPS2") ) { 450 if ( SDL_getenv("SDL_MOUSEDEV_IMPS2") ) {
451 imps2 = 1; 451 imps2 = 1;
452 } 452 }
453 if ( ! imps2 ) { 453 if ( ! imps2 ) {
454 Uint8 query_ps2 = 0xF2; 454 Uint8 query_ps2 = 0xF2;
455 fd_set fdset; 455 fd_set fdset;
497 { 497 {
498 int i; 498 int i;
499 const char *mousedev; 499 const char *mousedev;
500 const char *mousedrv; 500 const char *mousedrv;
501 501
502 mousedrv = getenv("SDL_MOUSEDRV"); 502 mousedrv = SDL_getenv("SDL_MOUSEDRV");
503 mousedev = getenv("SDL_MOUSEDEV"); 503 mousedev = SDL_getenv("SDL_MOUSEDEV");
504 mouse_fd = -1; 504 mouse_fd = -1;
505 505
506 #ifdef HAVE_TSLIB 506 #ifdef HAVE_TSLIB
507 if ((mousedrv != NULL) && (strcmp(mousedrv, "TSLIB") == 0)) { 507 if ((mousedrv != NULL) && (SDL_strcmp(mousedrv, "TSLIB") == 0)) {
508 if (mousedev == NULL) mousedev = getenv("TSLIB_TSDEVICE"); 508 if (mousedev == NULL) mousedev = SDL_getenv("TSLIB_TSDEVICE");
509 if (mousedev != NULL) { 509 if (mousedev != NULL) {
510 ts_dev = ts_open(mousedev, 1); 510 ts_dev = ts_open(mousedev, 1);
511 if ((ts_dev != NULL) && (ts_config(ts_dev) >= 0)) { 511 if ((ts_dev != NULL) && (ts_config(ts_dev) >= 0)) {
512 #ifdef DEBUG_MOUSE 512 #ifdef DEBUG_MOUSE
513 fprintf(stderr, "Using tslib touchscreen\n"); 513 fprintf(stderr, "Using tslib touchscreen\n");
522 } 522 }
523 #endif /* HAVE_TSLIB */ 523 #endif /* HAVE_TSLIB */
524 524
525 /* ELO TOUCHSCREEN SUPPORT */ 525 /* ELO TOUCHSCREEN SUPPORT */
526 526
527 if( (mousedrv != NULL) && (strcmp(mousedrv, "ELO") == 0) ) { 527 if( (mousedrv != NULL) && (SDL_strcmp(mousedrv, "ELO") == 0) ) {
528 mouse_fd = open(mousedev, O_RDWR); 528 mouse_fd = open(mousedev, O_RDWR);
529 if ( mouse_fd >= 0 ) { 529 if ( mouse_fd >= 0 ) {
530 if(eloInitController(mouse_fd)) { 530 if(eloInitController(mouse_fd)) {
531 #ifdef DEBUG_MOUSE 531 #ifdef DEBUG_MOUSE
532 fprintf(stderr, "Using ELO touchscreen\n"); 532 fprintf(stderr, "Using ELO touchscreen\n");
837 break; 837 break;
838 } 838 }
839 FB_vgamousecallback(button, relative, dx, dy); 839 FB_vgamousecallback(button, relative, dx, dy);
840 } 840 }
841 if ( i < nread ) { 841 if ( i < nread ) {
842 memcpy(mousebuf, &mousebuf[i], (nread-i)); 842 SDL_memcpy(mousebuf, &mousebuf[i], (nread-i));
843 start = (nread-i); 843 start = (nread-i);
844 } else { 844 } else {
845 start = 0; 845 start = 0;
846 } 846 }
847 return; 847 return;
872 /* Save the contents of the screen, and go to text mode */ 872 /* Save the contents of the screen, and go to text mode */
873 SDL_mutexP(hw_lock); 873 SDL_mutexP(hw_lock);
874 wait_idle(this); 874 wait_idle(this);
875 screen = SDL_VideoSurface; 875 screen = SDL_VideoSurface;
876 screen_arealen = (screen->h*screen->pitch); 876 screen_arealen = (screen->h*screen->pitch);
877 screen_contents = (Uint8 *)malloc(screen_arealen); 877 screen_contents = (Uint8 *)SDL_malloc(screen_arealen);
878 if ( screen_contents ) { 878 if ( screen_contents ) {
879 memcpy(screen_contents, screen->pixels, screen_arealen); 879 SDL_memcpy(screen_contents, screen->pixels, screen_arealen);
880 } 880 }
881 FB_SavePaletteTo(this, 256, saved_pal); 881 FB_SavePaletteTo(this, 256, saved_pal);
882 ioctl(console_fd, FBIOGET_VSCREENINFO, &vinfo); 882 ioctl(console_fd, FBIOGET_VSCREENINFO, &vinfo);
883 ioctl(keyboard_fd, KDSETMODE, KD_TEXT); 883 ioctl(keyboard_fd, KDSETMODE, KD_TEXT);
884 884
898 /* Restore graphics mode and the contents of the screen */ 898 /* Restore graphics mode and the contents of the screen */
899 ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS); 899 ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS);
900 ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo); 900 ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo);
901 FB_RestorePaletteFrom(this, 256, saved_pal); 901 FB_RestorePaletteFrom(this, 256, saved_pal);
902 if ( screen_contents ) { 902 if ( screen_contents ) {
903 memcpy(screen->pixels, screen_contents, screen_arealen); 903 SDL_memcpy(screen->pixels, screen_contents, screen_arealen);
904 free(screen_contents); 904 SDL_free(screen_contents);
905 } 905 }
906 SDL_mutexV(hw_lock); 906 SDL_mutexV(hw_lock);
907 } 907 }
908 908
909 static void handle_keyboard(_THIS) 909 static void handle_keyboard(_THIS)