Date: Wed, 29 May 2002 17:37:19 +0200
authorSam Lantinga <slouken@libsdl.org>
Wed, 29 May 2002 20:47:19 +0000
changeset 38274bdcae44bf5
parent 381 bc1401311390
child 383 5e31d8bfffcf
Date: Wed, 29 May 2002 17:37:19 +0200
From: Denis Oliver Kropp <dok@directfb.org>
Subject: DirectFB 0.9.11

Hi,

we had some API enhancements in keyboard handling.
We support full unicode now and have support for
keyboard mappings. I've attached a patch to have
SDL compile with the upcoming (monday?) DirectFB 0.9.11.
configure.in
src/video/directfb/SDL_DirectFB_events.c
     1.1 --- a/configure.in	Tue May 28 20:01:29 2002 +0000
     1.2 +++ b/configure.in	Wed May 29 20:47:19 2002 +0000
     1.3 @@ -768,7 +768,7 @@
     1.4                  AC_MSG_ERROR([*** pkg-config too old; version 0.5 or better required.])
     1.5              fi
     1.6  
     1.7 -            DIRECTFB_REQUIRED_VERSION=0.9.9
     1.8 +            DIRECTFB_REQUIRED_VERSION=0.9.11
     1.9  
    1.10              if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
    1.11                  DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
     2.1 --- a/src/video/directfb/SDL_DirectFB_events.c	Tue May 28 20:01:29 2002 +0000
     2.2 +++ b/src/video/directfb/SDL_DirectFB_events.c	Wed May 29 20:47:19 2002 +0000
     2.3 @@ -100,109 +100,100 @@
     2.4    for (i=0; i<SDL_TABLESIZE(keymap); ++i)
     2.5      keymap[i] = SDLK_UNKNOWN;
     2.6  
     2.7 -  keymap[DIKC_A] = SDLK_a;
     2.8 -  keymap[DIKC_B] = SDLK_b;
     2.9 -  keymap[DIKC_C] = SDLK_c;
    2.10 -  keymap[DIKC_D] = SDLK_d;
    2.11 -  keymap[DIKC_E] = SDLK_e;
    2.12 -  keymap[DIKC_F] = SDLK_f;
    2.13 -  keymap[DIKC_G] = SDLK_g;
    2.14 -  keymap[DIKC_H] = SDLK_h;
    2.15 -  keymap[DIKC_I] = SDLK_i;
    2.16 -  keymap[DIKC_J] = SDLK_j;
    2.17 -  keymap[DIKC_K] = SDLK_k;
    2.18 -  keymap[DIKC_L] = SDLK_l;
    2.19 -  keymap[DIKC_M] = SDLK_m;
    2.20 -  keymap[DIKC_N] = SDLK_n;
    2.21 -  keymap[DIKC_O] = SDLK_o;
    2.22 -  keymap[DIKC_P] = SDLK_p;
    2.23 -  keymap[DIKC_Q] = SDLK_q;
    2.24 -  keymap[DIKC_R] = SDLK_r;
    2.25 -  keymap[DIKC_S] = SDLK_s;
    2.26 -  keymap[DIKC_T] = SDLK_t;
    2.27 -  keymap[DIKC_U] = SDLK_u;
    2.28 -  keymap[DIKC_V] = SDLK_v;
    2.29 -  keymap[DIKC_W] = SDLK_w;
    2.30 -  keymap[DIKC_X] = SDLK_x;
    2.31 -  keymap[DIKC_Y] = SDLK_y;
    2.32 -  keymap[DIKC_Z] = SDLK_z;
    2.33 +  keymap[DIKI_A] = SDLK_a;
    2.34 +  keymap[DIKI_B] = SDLK_b;
    2.35 +  keymap[DIKI_C] = SDLK_c;
    2.36 +  keymap[DIKI_D] = SDLK_d;
    2.37 +  keymap[DIKI_E] = SDLK_e;
    2.38 +  keymap[DIKI_F] = SDLK_f;
    2.39 +  keymap[DIKI_G] = SDLK_g;
    2.40 +  keymap[DIKI_H] = SDLK_h;
    2.41 +  keymap[DIKI_I] = SDLK_i;
    2.42 +  keymap[DIKI_J] = SDLK_j;
    2.43 +  keymap[DIKI_K] = SDLK_k;
    2.44 +  keymap[DIKI_L] = SDLK_l;
    2.45 +  keymap[DIKI_M] = SDLK_m;
    2.46 +  keymap[DIKI_N] = SDLK_n;
    2.47 +  keymap[DIKI_O] = SDLK_o;
    2.48 +  keymap[DIKI_P] = SDLK_p;
    2.49 +  keymap[DIKI_Q] = SDLK_q;
    2.50 +  keymap[DIKI_R] = SDLK_r;
    2.51 +  keymap[DIKI_S] = SDLK_s;
    2.52 +  keymap[DIKI_T] = SDLK_t;
    2.53 +  keymap[DIKI_U] = SDLK_u;
    2.54 +  keymap[DIKI_V] = SDLK_v;
    2.55 +  keymap[DIKI_W] = SDLK_w;
    2.56 +  keymap[DIKI_X] = SDLK_x;
    2.57 +  keymap[DIKI_Y] = SDLK_y;
    2.58 +  keymap[DIKI_Z] = SDLK_z;
    2.59    
    2.60 -  keymap[DIKC_0] = SDLK_0;
    2.61 -  keymap[DIKC_1] = SDLK_1;
    2.62 -  keymap[DIKC_2] = SDLK_2;
    2.63 -  keymap[DIKC_3] = SDLK_3;
    2.64 -  keymap[DIKC_4] = SDLK_4;
    2.65 -  keymap[DIKC_5] = SDLK_5;
    2.66 -  keymap[DIKC_6] = SDLK_6;
    2.67 -  keymap[DIKC_7] = SDLK_7;
    2.68 -  keymap[DIKC_8] = SDLK_8;
    2.69 -  keymap[DIKC_9] = SDLK_9;
    2.70 +  keymap[DIKI_0] = SDLK_0;
    2.71 +  keymap[DIKI_1] = SDLK_1;
    2.72 +  keymap[DIKI_2] = SDLK_2;
    2.73 +  keymap[DIKI_3] = SDLK_3;
    2.74 +  keymap[DIKI_4] = SDLK_4;
    2.75 +  keymap[DIKI_5] = SDLK_5;
    2.76 +  keymap[DIKI_6] = SDLK_6;
    2.77 +  keymap[DIKI_7] = SDLK_7;
    2.78 +  keymap[DIKI_8] = SDLK_8;
    2.79 +  keymap[DIKI_9] = SDLK_9;
    2.80    
    2.81 -  keymap[DIKC_F1] = SDLK_F1;
    2.82 -  keymap[DIKC_F2] = SDLK_F2;
    2.83 -  keymap[DIKC_F3] = SDLK_F3;
    2.84 -  keymap[DIKC_F4] = SDLK_F4;
    2.85 -  keymap[DIKC_F5] = SDLK_F5;
    2.86 -  keymap[DIKC_F6] = SDLK_F6;
    2.87 -  keymap[DIKC_F7] = SDLK_F7;
    2.88 -  keymap[DIKC_F8] = SDLK_F8;
    2.89 -  keymap[DIKC_F9] = SDLK_F9;
    2.90 -  keymap[DIKC_F10] = SDLK_F10;
    2.91 -  keymap[DIKC_F11] = SDLK_F11;
    2.92 -  keymap[DIKC_F12] = SDLK_F12;
    2.93 +  keymap[DIKI_F1] = SDLK_F1;
    2.94 +  keymap[DIKI_F2] = SDLK_F2;
    2.95 +  keymap[DIKI_F3] = SDLK_F3;
    2.96 +  keymap[DIKI_F4] = SDLK_F4;
    2.97 +  keymap[DIKI_F5] = SDLK_F5;
    2.98 +  keymap[DIKI_F6] = SDLK_F6;
    2.99 +  keymap[DIKI_F7] = SDLK_F7;
   2.100 +  keymap[DIKI_F8] = SDLK_F8;
   2.101 +  keymap[DIKI_F9] = SDLK_F9;
   2.102 +  keymap[DIKI_F10] = SDLK_F10;
   2.103 +  keymap[DIKI_F11] = SDLK_F11;
   2.104 +  keymap[DIKI_F12] = SDLK_F12;
   2.105    
   2.106 -  keymap[DIKC_ESCAPE] = SDLK_ESCAPE;
   2.107 -  keymap[DIKC_LEFT] = SDLK_LEFT;
   2.108 -  keymap[DIKC_RIGHT] = SDLK_RIGHT;
   2.109 -  keymap[DIKC_UP] = SDLK_UP;
   2.110 -  keymap[DIKC_DOWN] = SDLK_DOWN;
   2.111 -  keymap[DIKC_CTRL] = SDLK_LCTRL;
   2.112 -  keymap[DIKC_SHIFT] = SDLK_LSHIFT;
   2.113 -  keymap[DIKC_ALT] = SDLK_LALT;
   2.114 -  keymap[DIKC_ALTGR] = SDLK_RALT;
   2.115 -  keymap[DIKC_TAB] = SDLK_TAB;
   2.116 -  keymap[DIKC_ENTER] = SDLK_RETURN;
   2.117 -  keymap[DIKC_SPACE] = SDLK_SPACE;
   2.118 -  keymap[DIKC_BACKSPACE] = SDLK_BACKSPACE;
   2.119 -  keymap[DIKC_INSERT] = SDLK_INSERT;
   2.120 -  keymap[DIKC_DELETE] = SDLK_DELETE;
   2.121 -  keymap[DIKC_HOME] = SDLK_HOME;
   2.122 -  keymap[DIKC_END] = SDLK_END;
   2.123 -  keymap[DIKC_PAGEUP] = SDLK_PAGEUP;
   2.124 -  keymap[DIKC_PAGEDOWN] = SDLK_PAGEDOWN;
   2.125 -  keymap[DIKC_CAPSLOCK] = SDLK_CAPSLOCK;
   2.126 -  keymap[DIKC_NUMLOCK] = SDLK_NUMLOCK;
   2.127 -  keymap[DIKC_SCRLOCK] = SDLK_SCROLLOCK;
   2.128 -  keymap[DIKC_PRINT] = SDLK_PRINT;
   2.129 -  keymap[DIKC_PAUSE] = SDLK_PAUSE;
   2.130 -  keymap[DIKC_KP_DIV] = SDLK_KP_DIVIDE;
   2.131 -  keymap[DIKC_KP_MULT] = SDLK_KP_MULTIPLY;
   2.132 -  keymap[DIKC_KP_MINUS] = SDLK_KP_MINUS;
   2.133 -  keymap[DIKC_KP_PLUS] = SDLK_KP_PLUS;
   2.134 -  keymap[DIKC_KP_ENTER] = SDLK_KP_ENTER;
   2.135 -  
   2.136 -  keymap[DIKC_OK] = SDLK_RETURN;
   2.137 -  keymap[DIKC_CANCEL] = SDLK_BREAK;
   2.138 -  keymap[DIKC_CLEAR] = SDLK_DELETE;
   2.139 -  keymap[DIKC_POWER] = SDLK_POWER;
   2.140 -  keymap[DIKC_POWER2] = SDLK_POWER;
   2.141 -  keymap[DIKC_MENU] = SDLK_MENU;
   2.142 -  keymap[DIKC_HELP] = SDLK_HELP;
   2.143 -  keymap[DIKC_BACK] = SDLK_ESCAPE;
   2.144 +  keymap[DIKI_ESCAPE] = SDLK_ESCAPE;
   2.145 +  keymap[DIKI_LEFT] = SDLK_LEFT;
   2.146 +  keymap[DIKI_RIGHT] = SDLK_RIGHT;
   2.147 +  keymap[DIKI_UP] = SDLK_UP;
   2.148 +  keymap[DIKI_DOWN] = SDLK_DOWN;
   2.149 +  keymap[DIKI_CTRL] = SDLK_LCTRL;
   2.150 +  keymap[DIKI_SHIFT] = SDLK_LSHIFT;
   2.151 +  keymap[DIKI_ALT] = SDLK_LALT;
   2.152 +  keymap[DIKI_ALTGR] = SDLK_RALT;
   2.153 +  keymap[DIKI_TAB] = SDLK_TAB;
   2.154 +  keymap[DIKI_ENTER] = SDLK_RETURN;
   2.155 +  keymap[DIKI_SPACE] = SDLK_SPACE;
   2.156 +  keymap[DIKI_BACKSPACE] = SDLK_BACKSPACE;
   2.157 +  keymap[DIKI_INSERT] = SDLK_INSERT;
   2.158 +  keymap[DIKI_DELETE] = SDLK_DELETE;
   2.159 +  keymap[DIKI_HOME] = SDLK_HOME;
   2.160 +  keymap[DIKI_END] = SDLK_END;
   2.161 +  keymap[DIKI_PAGE_UP] = SDLK_PAGEUP;
   2.162 +  keymap[DIKI_PAGE_DOWN] = SDLK_PAGEDOWN;
   2.163 +  keymap[DIKI_CAPSLOCK] = SDLK_CAPSLOCK;
   2.164 +  keymap[DIKI_NUMLOCK] = SDLK_NUMLOCK;
   2.165 +  keymap[DIKI_SCRLOCK] = SDLK_SCROLLOCK;
   2.166 +  keymap[DIKI_PRINT] = SDLK_PRINT;
   2.167 +  keymap[DIKI_PAUSE] = SDLK_PAUSE;
   2.168 +  keymap[DIKI_KP_DIV] = SDLK_KP_DIVIDE;
   2.169 +  keymap[DIKI_KP_MULT] = SDLK_KP_MULTIPLY;
   2.170 +  keymap[DIKI_KP_MINUS] = SDLK_KP_MINUS;
   2.171 +  keymap[DIKI_KP_PLUS] = SDLK_KP_PLUS;
   2.172 +  keymap[DIKI_KP_ENTER] = SDLK_KP_ENTER;
   2.173  }
   2.174  
   2.175  
   2.176  static SDL_keysym *DirectFB_TranslateKey (DFBInputEvent *ev, SDL_keysym *keysym)
   2.177  {
   2.178    /* Set the keysym information */
   2.179 -  keysym->scancode = ev->keycode;
   2.180 -  keysym->mod = KMOD_NONE;
   2.181 -  keysym->unicode = 0;
   2.182 +  keysym->scancode = ev->key_id;
   2.183 +  keysym->mod = KMOD_NONE; /* FIXME */
   2.184 +  keysym->unicode = (DFB_KEY_TYPE (ev->key_symbol) == DIKT_UNICODE) ? ev->key_symbol : 0;
   2.185  
   2.186 -  if (ev->key_ascii > 0 && ev->key_ascii < 128)
   2.187 -    keysym->sym = ev->key_ascii;
   2.188 +  if (ev->key_symbol > 0 && ev->key_symbol < 128)
   2.189 +    keysym->sym = ev->key_symbol;
   2.190    else
   2.191 -    keysym->sym = keymap[ev->keycode];
   2.192 +    keysym->sym = keymap[ev->key_id];
   2.193  
   2.194    return keysym;
   2.195  }