Unicode keyboard input in fbcon, linux

Hi! I’m new on this list and new to SDL too. I’m planning to use SDL to
port a (Free)DOS application I’ve been working on.

To get a behavior similar to getxkey() in DJGPP, I wrote this little
function:

int vid_parsekey(SDL_Event *ev) {
int k;
k=ev->key.keysym.unicode & 0xff;
if(k && !(ev->key.keysym.mod & KMOD_CTRL)) return k;
k=ev->key.keysym.sym;
if(!(k>=300 && k<=314)) return k; //ignore modifiers
return 0;
}

It works excellent in X11, but not in fbcon. It seems that
key-combinations like AltGr+2 which gives ‘@’ on my fi-lat1 keyboard
does not set the unicode field to ‘@’ as it does in X11… All I get is
an AltGr event and a ‘2’ event, but I don’t want to map all this
myself. There is also other single keys that isn’t represented.

Is this a bug in SDL_fbevents.c or can I do something about it? This
problem makes it impossible to have normal text input when using fbcon.

/Jonatan -=( http://kymatica.com )=-

Is this a bug in SDL_fbevents.c or can I do something about it? This
problem makes it impossible to have normal text input when using
fbcon.

This patch fixes it, for me at least. What do you think?

— SDL_fbevents.c.org 2004-02-18 14:22:06.000000000 -0300
+++ SDL_fbevents.c 2006-04-11 00:36:50.000000000 -0300
@@ -1003,6 +1003,12 @@
case SCANCODE_LEFTWIN:
keymap[i] = SDLK_LSUPER;
break;

  • case SCANCODE_LEFTALT:
    
  •   keymap[i] = SDLK_LALT;
    
  •   break;
    
  • case SCANCODE_RIGHTALT:
    
  •   keymap[i] = SDLK_RALT;
    
  •   break;
    case 127:
      keymap[i] = SDLK_MENU;
      break;
    

@@ -1104,10 +1110,10 @@
if ( modstate & KMOD_CTRL ) {
map |= (1<<KG_CTRL);
}

  •   if ( modstate & KMOD_ALT ) {
    
  •   if ( modstate & KMOD_LALT ) {
      	map |= (1<<KG_ALT);
      }
    
  •   if ( modstate & KMOD_MODE ) {
    
  •   if ( modstate & KMOD_RALT ) {
      	map |= (1<<KG_ALTGR);
      }
      if ( KTYP(vga_keymap[map][scancode]) == KT_LETTER ) {
    

/Jonatan -=( http://kymatica.com )=-On Sun, 9 Apr 2006 22:49:39 -0300 Jonatan Liljedahl <@Jonatan_Liljedahl> wrote: