Workaround of issue 167: Unicode only enabled while entering text, so at all other moments there's no SDL crash when pressing ^ key (French or German keyboard) on Windows 98

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@812 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-05-22 18:14:13 +00:00
parent 4f157197e8
commit e8dd8588d0
3 changed files with 7 additions and 1 deletions

View File

@ -543,6 +543,9 @@ word Keysym_to_ANSI(SDL_keysym keysym)
#if !(defined(__macosx__) || defined(__FreeBSD__)) #if !(defined(__macosx__) || defined(__FreeBSD__))
if ( keysym.unicode == 0) if ( keysym.unicode == 0)
{ {
// Converty lowercase to uppercase if SHIFT is on.
if (keysym.sym >= 'a' && keysym.sym <= 'z' && (SDL_GetModState() & (KMOD_SHIFT|KMOD_CAPS)))
return ('A' - 'a') + keysym.sym;
return keysym.sym; return keysym.sym;
} }
#endif #endif

1
main.c
View File

@ -404,7 +404,6 @@ int Init_program(int argc,char * argv[])
} }
Joystick = SDL_JoystickOpen(0); Joystick = SDL_JoystickOpen(0);
SDL_EnableKeyRepeat(250, 32); SDL_EnableKeyRepeat(250, 32);
SDL_EnableUNICODE(SDL_ENABLE);
if(ALPHA_BETA[0]=='ß') if(ALPHA_BETA[0]=='ß')
SDL_WM_SetCaption("GrafX2 beta "PERCENTAGE_VERSION,"GrafX2"); SDL_WM_SetCaption("GrafX2 beta "PERCENTAGE_VERSION,"GrafX2");
else else

View File

@ -142,6 +142,8 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
byte offset=0; // index du premier caractère affiché byte offset=0; // index du premier caractère affiché
SDL_EnableUNICODE(SDL_ENABLE);
Hide_cursor(); Hide_cursor();
// Effacement de la chaîne // Effacement de la chaîne
Block(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y), Block(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y),
@ -346,5 +348,7 @@ affichage:
Update_rect(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y), Update_rect(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3)); visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3));
SDL_EnableUNICODE(SDL_DISABLE);
return (input_key==SDLK_RETURN); return (input_key==SDLK_RETURN);
} }