| Re: [hatari-devel] Apple keyboard + SDL2 |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
Hi, I took time to polish up my answer! Characters , ; # have role in mapping files. Their name cannot be used directly. 44,50 # comma 59,51 # semicolon In keymap.c, I modified the routine "void Keymap_LoadRemapFile(char *pszFileName)" so that we can use directly their name. ,,50 ;,51 It remains that "Left Alt" is never parsed. I think that problem comes from SDL2.05 To parse one character, its key is obtained with: int Keymap_GetKeyFromName(const char *name) { return SDL_GetKeyFromName(name); } Results of the made tests with SDL_GetKeyFromName name = Left Ctrl key = 0x400000e0 name = Left Shift key = 0x400000e1 name = Left Alt key = 0x00000000 Do yon think I've to report that on SDL site ? Below KeymapDiff.txt and AppleAzertyFr.txt
Apple does not intercept Left Alt. if I do not remap left Alt, this key is actif in Hatari.
Ok I'lll have a look to that Miguel |
# This file must be UTF-8 coded # Mai 2017, Cocoa Pod. # FRENCH ------------------------------------------------ # Mappage du clavier AZERTY-fr d'un Macbook Pro # # Tests sur Macbook Pro (MacBookPro5,3), MacOS 10.12 fr # Tests sur Macbook Air, MacOS 10.11 fr # Tests sur émulateur Hatari 2.0 _ ST, MegaST, STE, MegaSTE, tout TOS fr # Apple: Dans "Préférences Système / clavier", Valider l'option : # "Utiliser les touches F1,F2,.... Comme des touches de fonction standard" # F1-F8 presser la touche F, F9-F12 presser les touches cmd et F. # # Les commentaires commencent par un # ou un ; # Chaque ligne active commence par deux chiffres séparés par une virgule. # le premier est la valeur du symbole de la touche de votre clavier et le # deuxième est le scancode de la touche équivalente du clavier Atari. # Le premier chiffre peut être remplacé par un symbol. # ENGLISH ------------------------------------------------ # Mapping for Macbook Pro keyboard AZERTY-fr # # Tested on Macbook Pro (MacBookPro5,3), MacOS 10.12 fr # Tested on Macbook Air, MacOS 10.11 fr # Tested on emulator Hatari 2.0 _ ST, MegaST, STE, MegaSTE, all TOS Fr # On Apple: in "System Preferences / Keyboard", Validate the option : # "Use all F1,F2,.... as standard function keys " # F1-F8 press F key, F9-F12 press cmd and F keys # # Comments start with # or ; # Every active line begins with two numbers separated by a comma # First number is the symbolic Mac key code (see the SDL_keysym.h file # from the SDL library header files usually in /usr/include/SDL/). # Second number is the scancode of equivalent key of the keyboard Atari. # first number can be replaced by a symbol # # # function keys line # Escape,1 F1,59 F2,60 F3,61 F4,62 F5,63 F6,64 F7,65 F8,66 F9,67 # hit cmd-F9 F10,68 # hit cmd-F10 # F11, # cmd-F11 Does not exist in ATARI # F12, # cmd-F12 Does not exist in ATARI # first line: @ é " ' ( § è ! ç à ) - # <,43 &,2 é,3 ",4 ',5 (,6 §,7 è,8 !,9 ç,10 à ,11 ),12 -,13 Backspace,14 # second line: a z e r t y u i o p ^ $ # Tab,15 a,16 z,17 e,18 r,19 t,20 y,21 u,22 i,23 o,24 p,25 ^,26 $,27 # third line: q s d f g h j k l m ù ` # q,30 s,31 d,32 f,33 g,34 h,35 j,36 k,37 l,38 m,39 ù,40 `,41 # forth line: < w x c v b n , ; : = # @,96 w,44 x,45 c,46 v,47 b,48 n,49 ,,50 # comma 44,50 ;,51 # semicolon 59,51 :,52 =,53 Space,57 Return,28 CapsLock,58 Right,77 Left,75 Down,80 Up,72 Left Ctrl,29 Left Shift,42 # Left Alt,56 # fail !!!!! Right Shift,54
--- /Users/msaro/Library/Application Support/whatari/hatari/src/keymap.c 2017-05-19 09:21:34.000000000 +0200
+++ /Users/msaro/Desktop/hatariobjc/keymap.c 2017-05-27 23:10:18.000000000 +0200
@@ -606,7 +606,7 @@
char szString[1024];
int STScanCode, PCKeyCode;
FILE *in;
- int idx = 0;
+ int h, k, idx = 0;
/* Initialize table with default values */
memset(LoadedKeymap, 0, sizeof(LoadedKeymap));
@@ -635,18 +635,23 @@
break;
/* Remove white-space from start of line */
Str_Trim(szString);
- if (strlen(szString)>0)
+ if (strlen(szString)>2)
{
- char *p;
+ char *p ;
+ h = 0 ;
+ k = szString[0] ;
/* Is a comment? */
- if (szString[0] == ';' || szString[0] == '#')
+ if ((k == ';' || k == '#') && (szString[1] != ','))
continue;
/* Cut out the values */
- p = strtok(szString, ",");
+ if ((k == ';' || k == '#' || k == ',') && (szString[1] == ','))
+ { p = szString ; p[1] = 0 ; h = 2 ;}
+ else
+ p = strtok(szString, ",");
if (!p)
continue;
- Str_Trim(szString);
- PCKeyCode = atoi(szString); /* Direct key code? */
+ Str_Trim(szString); // remove spaces
+ PCKeyCode = atoi(szString); // Direct key code?
if (PCKeyCode < 10)
{
/* If it's not a valid number >= 10, then
@@ -658,7 +663,10 @@
offset = 1;
PCKeyCode = Keymap_GetKeyFromName(szString+offset);
}
- p = strtok(NULL, "\n");
+ if (h!=0)
+ { p += h ; Str_Trim(szString); }
+ else
+ p = strtok(NULL, "\n");
if (!p)
continue;
STScanCode = atoi(p);
| Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |