Added preliminary missingtranslation from Atari to Unicode charset
authorPatrice Mandin <patmandin@gmail.com>
Sun, 01 Jan 2006 19:14:11 +0000
changeset 1209a55ac374271c
parent 1208 d90b362628ea
child 1210 8609567ea02f
Added preliminary missingtranslation from Atari to Unicode charset
src/video/ataricommon/SDL_atarievents.c
src/video/ataricommon/SDL_atarievents_c.h
src/video/ataricommon/SDL_biosevents.c
src/video/ataricommon/SDL_gemdosevents.c
src/video/ataricommon/SDL_ikbdevents.c
src/video/gem/SDL_gemevents.c
     1.1 --- a/src/video/ataricommon/SDL_atarievents.c	Fri Dec 23 09:40:15 2005 +0000
     1.2 +++ b/src/video/ataricommon/SDL_atarievents.c	Sun Jan 01 19:14:11 2006 +0000
     1.3 @@ -127,3 +127,13 @@
     1.4  	/* Call choosen routine */
     1.5  	this->PumpEvents(this);
     1.6  }
     1.7 +
     1.8 +Uint16 SDL_AtariToUnicode(Uint8 caracter)
     1.9 +{
    1.10 +	/* Translate from Atari charset to Unicode */
    1.11 +	if ((caracter>=32) && (caracter<=127)) {
    1.12 +		return (Uint16) caracter;
    1.13 +	}
    1.14 +
    1.15 +	return 0;
    1.16 +}
     2.1 --- a/src/video/ataricommon/SDL_atarievents_c.h	Fri Dec 23 09:40:15 2005 +0000
     2.2 +++ b/src/video/ataricommon/SDL_atarievents_c.h	Sun Jan 01 19:14:11 2006 +0000
     2.3 @@ -44,4 +44,6 @@
     2.4  extern void Atari_InitOSKeymap(_THIS);
     2.5  extern void Atari_PumpEvents(_THIS);
     2.6  
     2.7 +extern Uint16 SDL_AtariToUnicode(Uint8 caracter);
     2.8 +
     2.9  #endif /* _SDL_ATARI_EVENTS_H_ */
     3.1 --- a/src/video/ataricommon/SDL_biosevents.c	Fri Dec 23 09:40:15 2005 +0000
     3.2 +++ b/src/video/ataricommon/SDL_biosevents.c	Sun Jan 01 19:14:11 2006 +0000
     3.3 @@ -41,6 +41,7 @@
     3.4  #include "SDL_events_c.h"
     3.5  
     3.6  #include "SDL_atarikeys.h"
     3.7 +#include "SDL_atarievents_c.h"
     3.8  #include "SDL_xbiosevents_c.h"
     3.9  
    3.10  /* To save state of keyboard */
    3.11 @@ -64,7 +65,8 @@
    3.12  /* The translation tables from a console scancode to a SDL keysym */
    3.13  static SDLKey keymap[ATARIBIOS_MAXKEYS];
    3.14  
    3.15 -static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym);
    3.16 +static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
    3.17 +	SDL_bool pressed);
    3.18  static void UpdateSpecialKeys(int special_keys_state);
    3.19  
    3.20  void AtariBios_InitOSKeymap(_THIS)
    3.21 @@ -135,11 +137,13 @@
    3.22  	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
    3.23  		/* Key pressed ? */
    3.24  		if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
    3.25 -			SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, bios_currentascii[i], &keysym));
    3.26 +			SDL_PrivateKeyboard(SDL_PRESSED,
    3.27 +				TranslateKey(i, bios_currentascii[i], &keysym, SDL_TRUE));
    3.28  			
    3.29  		/* Key unpressed ? */
    3.30  		if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
    3.31 -			SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, bios_currentascii[i], &keysym));
    3.32 +			SDL_PrivateKeyboard(SDL_RELEASED,
    3.33 +				TranslateKey(i, bios_currentascii[i], &keysym, SDL_FALSE));
    3.34  	}
    3.35  
    3.36  	SDL_AtariXbios_PostMouseEvents(this);
    3.37 @@ -165,7 +169,8 @@
    3.38  	UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
    3.39  }
    3.40  
    3.41 -static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)
    3.42 +static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
    3.43 +	SDL_bool pressed)
    3.44  {
    3.45  	/* Set the keysym information */
    3.46  	keysym->scancode = scancode;
    3.47 @@ -177,6 +182,9 @@
    3.48  
    3.49  	keysym->mod = KMOD_NONE;
    3.50  	keysym->unicode = 0;
    3.51 +	if (pressed && (asciicode!=0)) {
    3.52 +		keysym->unicode = SDL_AtariToUnicode(asciicode);
    3.53 +	}
    3.54  
    3.55  	return(keysym);
    3.56  }
     4.1 --- a/src/video/ataricommon/SDL_gemdosevents.c	Fri Dec 23 09:40:15 2005 +0000
     4.2 +++ b/src/video/ataricommon/SDL_gemdosevents.c	Sun Jan 01 19:14:11 2006 +0000
     4.3 @@ -41,6 +41,7 @@
     4.4  #include "SDL_events_c.h"
     4.5  
     4.6  #include "SDL_atarikeys.h"
     4.7 +#include "SDL_atarievents_c.h"
     4.8  #include "SDL_xbiosevents_c.h"
     4.9  
    4.10  /* To save state of keyboard */
    4.11 @@ -69,7 +70,8 @@
    4.12  /* The translation tables from a console scancode to a SDL keysym */
    4.13  static SDLKey keymap[ATARIBIOS_MAXKEYS];
    4.14  
    4.15 -static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym);
    4.16 +static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
    4.17 +	SDL_bool pressed);
    4.18  static void UpdateSpecialKeys(int special_keys_state);
    4.19  
    4.20  void AtariGemdos_InitOSKeymap(_THIS)
    4.21 @@ -140,11 +142,13 @@
    4.22  	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
    4.23  		/* Key pressed ? */
    4.24  		if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i])
    4.25 -			SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, gemdos_currentascii[i], &keysym));
    4.26 +			SDL_PrivateKeyboard(SDL_PRESSED,
    4.27 +				TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_TRUE));
    4.28  			
    4.29  		/* Key unpressed ? */
    4.30  		if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i])
    4.31 -			SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gemdos_currentascii[i], &keysym));
    4.32 +			SDL_PrivateKeyboard(SDL_RELEASED,
    4.33 +				TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_FALSE));
    4.34  	}
    4.35  
    4.36  	SDL_AtariXbios_PostMouseEvents(this);
    4.37 @@ -170,7 +174,8 @@
    4.38  	UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK);
    4.39  }
    4.40  
    4.41 -static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)
    4.42 +static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
    4.43 +	SDL_bool pressed)
    4.44  {
    4.45  	/* Set the keysym information */
    4.46  	keysym->scancode = scancode;
    4.47 @@ -182,6 +187,9 @@
    4.48  
    4.49  	keysym->mod = KMOD_NONE;
    4.50  	keysym->unicode = 0;
    4.51 +	if (pressed && (asciicode!=0)) {
    4.52 +		keysym->unicode = SDL_AtariToUnicode(asciicode);
    4.53 +	}
    4.54  
    4.55  	return(keysym);
    4.56  }
     5.1 --- a/src/video/ataricommon/SDL_ikbdevents.c	Fri Dec 23 09:40:15 2005 +0000
     5.2 +++ b/src/video/ataricommon/SDL_ikbdevents.c	Sun Jan 01 19:14:11 2006 +0000
     5.3 @@ -41,6 +41,7 @@
     5.4  #include "SDL_events_c.h"
     5.5  
     5.6  #include "SDL_atarikeys.h"
     5.7 +#include "SDL_atarievents_c.h"
     5.8  #include "SDL_ikbdinterrupt_s.h"
     5.9  
    5.10  /* Special keys state */
    5.11 @@ -75,7 +76,8 @@
    5.12  static unsigned char *tab_unshift, *tab_shift, *tab_caps;
    5.13  static SDLKey keymap[ATARIBIOS_MAXKEYS];
    5.14  
    5.15 -static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym);
    5.16 +static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym,
    5.17 +	SDL_bool pressed);
    5.18  
    5.19  void AtariIkbd_InitOSKeymap(_THIS)
    5.20  {
    5.21 @@ -171,13 +173,15 @@
    5.22  	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
    5.23  		/* Key pressed ? */
    5.24  		if (SDL_AtariIkbd_keyboard[i]==KEY_PRESSED) {
    5.25 -			SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, specialkeys, &keysym));
    5.26 +			SDL_PrivateKeyboard(SDL_PRESSED,
    5.27 +				TranslateKey(i, specialkeys, &keysym, SDL_TRUE));
    5.28  			SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED;
    5.29  		}
    5.30  			
    5.31  		/* Key released ? */
    5.32  		if (SDL_AtariIkbd_keyboard[i]==KEY_RELEASED) {
    5.33 -			SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, specialkeys, &keysym));
    5.34 +			SDL_PrivateKeyboard(SDL_RELEASED,
    5.35 +				TranslateKey(i, specialkeys, &keysym, SDL_FALSE));
    5.36  			SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED;
    5.37  		}
    5.38  	}
    5.39 @@ -209,7 +213,8 @@
    5.40  	}
    5.41  }
    5.42  
    5.43 -static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym)
    5.44 +static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym,
    5.45 +	SDL_bool pressed)
    5.46  {
    5.47  	unsigned char asciicode;
    5.48  
    5.49 @@ -236,6 +241,9 @@
    5.50  
    5.51  	keysym->mod = KMOD_NONE;
    5.52  	keysym->unicode = 0;
    5.53 +	if (pressed && (asciicode!=0)) {
    5.54 +		keysym->unicode = SDL_AtariToUnicode(asciicode);
    5.55 +	}
    5.56  
    5.57  	return(keysym);
    5.58  }
     6.1 --- a/src/video/gem/SDL_gemevents.c	Fri Dec 23 09:40:15 2005 +0000
     6.2 +++ b/src/video/gem/SDL_gemevents.c	Sun Jan 01 19:14:11 2006 +0000
     6.3 @@ -44,6 +44,7 @@
     6.4  #include "SDL_gemvideo.h"
     6.5  #include "SDL_gemevents_c.h"
     6.6  #include "SDL_atarikeys.h"	/* for keyboard scancodes */
     6.7 +#include "SDL_atarievents_c.h"
     6.8  #include "SDL_xbiosinterrupt_s.h"
     6.9  
    6.10  /* Defines */
    6.11 @@ -61,14 +62,16 @@
    6.12  
    6.13  /* Functions prototypes */
    6.14  
    6.15 -static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym);
    6.16 +static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
    6.17 +	SDL_bool pressed);
    6.18  static int do_messages(_THIS, short *message);
    6.19  static void do_keyboard(short kc, short ks);
    6.20  static void do_mouse(_THIS, short mx, short my, short mb, short ks);
    6.21  
    6.22  /* Functions */
    6.23  
    6.24 -static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym)
    6.25 +static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym,
    6.26 +	SDL_bool pressed)
    6.27  {
    6.28  	/* Set the keysym information */
    6.29  	keysym->scancode = scancode;
    6.30 @@ -80,6 +83,9 @@
    6.31  
    6.32  	keysym->mod = KMOD_NONE;
    6.33  	keysym->unicode = 0;
    6.34 +	if (pressed && (asciicode!=0)) {
    6.35 +		keysym->unicode = SDL_AtariToUnicode(asciicode);
    6.36 +	}
    6.37  
    6.38  	return(keysym);
    6.39  }
    6.40 @@ -205,11 +211,13 @@
    6.41  	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
    6.42  		/* Key pressed ? */
    6.43  		if (gem_currentkeyboard[i] && !gem_previouskeyboard[i])
    6.44 -			SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, gem_currentascii[i], &keysym));
    6.45 +			SDL_PrivateKeyboard(SDL_PRESSED,
    6.46 +				TranslateKey(i, gem_currentascii[i], &keysym, SDL_TRUE));
    6.47  			
    6.48  		/* Key unpressed ? */
    6.49  		if (gem_previouskeyboard[i] && !gem_currentkeyboard[i])
    6.50 -			SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gem_currentascii[i], &keysym));
    6.51 +			SDL_PrivateKeyboard(SDL_RELEASED,
    6.52 +				TranslateKey(i, gem_currentascii[i], &keysym, SDL_FALSE));
    6.53  	}
    6.54  
    6.55  	memcpy(gem_previouskeyboard,gem_currentkeyboard,sizeof(gem_previouskeyboard));