ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/SDL/video_sdl.cpp
(Generate patch)

Comparing BasiliskII/src/SDL/video_sdl.cpp (file contents):
Revision 1.13 by gbeauche, 2004-11-28T19:31:11Z vs.
Revision 1.14 by gbeauche, 2005-01-22T17:41:33Z

# Line 806 | Line 806 | static void keycode_init(void)
806                  SDL_VideoDriverName(video_driver, sizeof(video_driver));
807                  bool video_driver_found = false;
808                  char line[256];
809 +                int n_keys = 0;
810                  while (fgets(line, sizeof(line) - 1, f)) {
811                          // Read line
812                          int len = strlen(line);
# Line 818 | Line 819 | static void keycode_init(void)
819                                  continue;
820  
821                          if (video_driver_found) {
822 <                                // Skip aliases
822 >                                // Skip aliases as long as we have read keycodes yet
823 >                                // Otherwise, it's another mapping and we have to stop
824                                  static const char sdl_str[] = "sdl";
825 <                                if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0)
825 >                                if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0 && n_keys == 0)
826                                          continue;
827  
828                                  // Read keycode
829                                  int x_code, mac_code;
830                                  if (sscanf(line, "%d %d", &x_code, &mac_code) == 2)
831 <                                        keycode_table[x_code & 0xff] = mac_code;
831 >                                        keycode_table[x_code & 0xff] = mac_code, n_keys++;
832                                  else
833                                          break;
834                          } else {
# Line 851 | Line 853 | static void keycode_init(void)
853                          WarningAlert(str);
854                          return;
855                  }
856 +
857 +                D(bug("Using SDL/%s keycodes table, %d key mappings\n", video_driver, n_keys));
858          }
859   }
860  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines