src/video/directfb/SDL_DirectFB_events.c
changeset 5199 164f20ba08eb
parent 5123 dc0dfdd58f27
child 5218 572a73d71b5f
     1.1 --- a/src/video/directfb/SDL_DirectFB_events.c	Sat Feb 05 16:02:30 2011 -0800
     1.2 +++ b/src/video/directfb/SDL_DirectFB_events.c	Sat Feb 05 16:07:10 2011 -0800
     1.3 @@ -18,17 +18,26 @@
     1.4  
     1.5      Sam Lantinga
     1.6      slouken@libsdl.org
     1.7 +
     1.8 +    SDL1.3 DirectFB driver by couriersud@arcor.de
     1.9 +	
    1.10  */
    1.11 -#include "SDL_config.h"
    1.12  
    1.13  /* Handle the event stream, converting DirectFB input events into SDL events */
    1.14  
    1.15 -#include <directfb.h>
    1.16 +#include "SDL_DirectFB_video.h"
    1.17 +#include "SDL_DirectFB_window.h"
    1.18 +#include "SDL_DirectFB_modes.h"
    1.19  
    1.20 -#include "../SDL_sysvideo.h"
    1.21 +#include "SDL_syswm.h"
    1.22 +
    1.23 +#include "../../events/SDL_mouse_c.h"
    1.24 +#include "../../events/SDL_keyboard_c.h"
    1.25 +#include "../../events/SDL_windowevents_c.h"
    1.26  #include "../../events/SDL_events_c.h"
    1.27 -#include "../../events/SDL_keyboard_c.h"
    1.28  #include "../../events/scancodes_linux.h"
    1.29 +#include "../../events/scancodes_xfree86.h"
    1.30 +
    1.31  #include "SDL_DirectFB_events.h"
    1.32  
    1.33  #if USE_MULTI_API
    1.34 @@ -52,36 +61,36 @@
    1.35  };
    1.36  
    1.37  /* The translation tables from a DirectFB keycode to a SDL keysym */
    1.38 -static SDLKey oskeymap[256];
    1.39 +static SDL_ScanCode oskeymap[256];
    1.40  
    1.41  
    1.42  static SDL_KeySym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt,
    1.43                                           SDL_KeySym * keysym);
    1.44 -static SDL_KeySym *DirectFB_TranslateKeyInputEvent(_THIS, int index,
    1.45 -                                                   DFBInputEvent * evt,
    1.46 +static SDL_KeySym *DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt,
    1.47                                                     SDL_KeySym * keysym);
    1.48  
    1.49 -static void DirectFB_InitOSKeymap(_THIS, SDLKey * keypmap, int numkeys);
    1.50 +static void DirectFB_InitOSKeymap(_THIS, SDL_ScanCode * keypmap, int numkeys);
    1.51  static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
    1.52  
    1.53 -static void
    1.54 -DirectFB_SetContext(_THIS, SDL_Window *window)
    1.55 +static void UnicodeToUtf8( Uint16 w , char *utf8buf)
    1.56  {
    1.57 -#if (DFB_VERSION_ATLEAST(1,0,0))
    1.58 -    /* FIXME: does not work on 1.0/1.2 with radeon driver
    1.59 -     *        the approach did work with the matrox driver
    1.60 -     *        This has simply no effect.
    1.61 -     */
    1.62 -
    1.63 -    SDL_VideoDisplay *display = window->display;
    1.64 -    DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
    1.65 -
    1.66 -	/* FIXME: should we handle the error */
    1.67 -    if (dispdata->vidIDinuse)
    1.68 -        SDL_DFB_CHECK(dispdata->vidlayer->SwitchContext(dispdata->vidlayer,
    1.69 -                                                           DFB_TRUE));
    1.70 -#endif
    1.71 -
    1.72 +        unsigned char *utf8s = (unsigned char *) utf8buf;
    1.73 +        
    1.74 +    if ( w < 0x0080 ) {
    1.75 +        utf8s[0] = ( unsigned char ) w;
    1.76 +        utf8s[1] = 0;
    1.77 +    }
    1.78 +    else if ( w < 0x0800 ) {
    1.79 +        utf8s[0] = 0xc0 | (( w ) >> 6 );
    1.80 +        utf8s[1] = 0x80 | (( w ) & 0x3f );
    1.81 +        utf8s[2] = 0;  
    1.82 +    }
    1.83 +    else {
    1.84 +        utf8s[0] = 0xe0 | (( w ) >> 12 );
    1.85 +        utf8s[1] = 0x80 | (( ( w ) >> 6 ) & 0x3f );
    1.86 +        utf8s[2] = 0x80 | (( w ) & 0x3f );
    1.87 +        utf8s[3] = 0;
    1.88 +    }    
    1.89  }
    1.90  
    1.91  static void
    1.92 @@ -163,21 +172,21 @@
    1.93  }
    1.94  
    1.95  static void
    1.96 -ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
    1.97 -                   DFBWindowEvent * evt)
    1.98 +ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
    1.99  {
   1.100      SDL_DFB_DEVICEDATA(_this);
   1.101 +    SDL_DFB_WINDOWDATA(sdlwin);
   1.102      SDL_KeySym keysym;
   1.103 -    char text[5];
   1.104 +    char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
   1.105  
   1.106      if (evt->clazz == DFEC_WINDOW) {
   1.107          switch (evt->type) {
   1.108          case DWET_BUTTONDOWN:
   1.109 -            if (ClientXY(p, &evt->x, &evt->y)) {
   1.110 +            if (ClientXY(windata, &evt->x, &evt->y)) {
   1.111                  if (!devdata->use_linux_input) {
   1.112 -                    SDL_SendMouseMotion_ex(p->sdl_window, devdata->mouse_id[0], 0, evt->x,
   1.113 +                    SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0, evt->x,
   1.114                                          evt->y, 0);
   1.115 -                    SDL_SendMouseButton_ex(p->sdl_window, devdata->mouse_id[0],
   1.116 +                    SDL_SendMouseButton_ex(sdlwin, devdata->mouse_id[0],
   1.117                                          SDL_PRESSED,
   1.118                                          DirectFB_TranslateButton
   1.119                                          (evt->button));
   1.120 @@ -187,11 +196,11 @@
   1.121              }
   1.122              break;
   1.123          case DWET_BUTTONUP:
   1.124 -            if (ClientXY(p, &evt->x, &evt->y)) {
   1.125 +            if (ClientXY(windata, &evt->x, &evt->y)) {
   1.126                  if (!devdata->use_linux_input) {
   1.127 -                    SDL_SendMouseMotion_ex(p->sdl_window, devdata->mouse_id[0], 0, evt->x,
   1.128 +                    SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0, evt->x,
   1.129                                          evt->y, 0);
   1.130 -                    SDL_SendMouseButton_ex(p->sdl_window, devdata->mouse_id[0],
   1.131 +                    SDL_SendMouseButton_ex(sdlwin, devdata->mouse_id[0],
   1.132                                          SDL_RELEASED,
   1.133                                          DirectFB_TranslateButton
   1.134                                          (evt->button));
   1.135 @@ -201,11 +210,10 @@
   1.136              }
   1.137              break;
   1.138          case DWET_MOTION:
   1.139 -            if (ClientXY(p, &evt->x, &evt->y)) {
   1.140 -                SDL_Window *window = p->sdl_window;
   1.141 +            if (ClientXY(windata, &evt->x, &evt->y)) {
   1.142                  if (!devdata->use_linux_input) {
   1.143 -                    if (!(flags & SDL_WINDOW_INPUT_GRABBED))
   1.144 -                        SDL_SendMouseMotion_ex(p->sdl_window, devdata->mouse_id[0], 0,
   1.145 +                    if (!(sdlwin->flags & SDL_WINDOW_INPUT_GRABBED))
   1.146 +                        SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0,
   1.147                                              evt->x, evt->y, 0);
   1.148                  } else {
   1.149                      /* relative movements are not exact! 
   1.150 @@ -217,18 +225,19 @@
   1.151                          cnt = 0;
   1.152                      }
   1.153                  }
   1.154 -                if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS))
   1.155 -                    SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_ENTER, 0,
   1.156 +                if (!(sdlwin->flags & SDL_WINDOW_MOUSE_FOCUS))
   1.157 +                    SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_ENTER, 0,
   1.158                                          0);
   1.159              }
   1.160              break;
   1.161          case DWET_KEYDOWN:
   1.162              if (!devdata->use_linux_input) {
   1.163                  DirectFB_TranslateKey(_this, evt, &keysym);
   1.164 +                //printf("Scancode %d  %d %d\n", keysym.scancode, evt->key_code, evt->key_id);
   1.165                  SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode);
   1.166                  if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
   1.167 -                    SDL_memcpy(text, &keysym.unicode, 4);
   1.168 -                    text[4] = 0;
   1.169 +	                SDL_zero(text);
   1.170 +                    UnicodeToUtf8(keysym.unicode, text);
   1.171                      if (*text) {
   1.172                          SDL_SendKeyboardText_ex(0, text);
   1.173                      }
   1.174 @@ -242,49 +251,49 @@
   1.175              }
   1.176              break;
   1.177          case DWET_POSITION:
   1.178 -            if (ClientXY(p, &evt->x, &evt->y)) {
   1.179 -                SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_MOVED,
   1.180 +            if (ClientXY(windata, &evt->x, &evt->y)) {
   1.181 +                SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_MOVED,
   1.182                                      evt->x, evt->y);
   1.183              }
   1.184              break;
   1.185          case DWET_POSITION_SIZE:
   1.186 -            if (ClientXY(p, &evt->x, &evt->y)) {
   1.187 -                SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_MOVED,
   1.188 +            if (ClientXY(windata, &evt->x, &evt->y)) {
   1.189 +                SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_MOVED,
   1.190                                      evt->x, evt->y);
   1.191              }
   1.192              /* fall throught */
   1.193          case DWET_SIZE:
   1.194              // FIXME: what about < 0
   1.195 -            evt->w -= (p->theme.right_size + p->theme.left_size);
   1.196 +            evt->w -= (windata->theme.right_size + windata->theme.left_size);
   1.197              evt->h -=
   1.198 -                (p->theme.top_size + p->theme.bottom_size +
   1.199 -                 p->theme.caption_size);
   1.200 -            SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_RESIZED,
   1.201 +                (windata->theme.top_size + windata->theme.bottom_size +
   1.202 +                 windata->theme.caption_size);
   1.203 +            SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_RESIZED,
   1.204                                  evt->w, evt->h);
   1.205              break;
   1.206          case DWET_CLOSE:
   1.207 -            SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_CLOSE, 0, 0);
   1.208 +            SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_CLOSE, 0, 0);
   1.209              break;
   1.210          case DWET_GOTFOCUS:
   1.211 -            DirectFB_SetContext(_this, p->sdl_window);
   1.212 -            FocusAllKeyboards(_this, p->sdl_window);
   1.213 -            SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_FOCUS_GAINED,
   1.214 +            DirectFB_SetContext(_this, sdlwin);
   1.215 +            FocusAllKeyboards(_this, sdlwin);
   1.216 +            SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_FOCUS_GAINED,
   1.217                                  0, 0);
   1.218              break;
   1.219          case DWET_LOSTFOCUS:
   1.220 -            SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
   1.221 +            SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
   1.222              FocusAllKeyboards(_this, 0);
   1.223              break;
   1.224          case DWET_ENTER:
   1.225              /* SDL_DirectFB_ReshowCursor(_this, 0); */
   1.226 -            FocusAllMice(_this, p->sdl_window);
   1.227 +            FocusAllMice(_this, sdlwin);
   1.228              // FIXME: when do we really enter ?
   1.229 -            if (ClientXY(p, &evt->x, &evt->y))
   1.230 +            if (ClientXY(windata, &evt->x, &evt->y))
   1.231                  MotionAllMice(_this, evt->x, evt->y);
   1.232 -            SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_ENTER, 0, 0);
   1.233 +            SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_ENTER, 0, 0);
   1.234              break;
   1.235          case DWET_LEAVE:
   1.236 -            SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_LEAVE, 0, 0);
   1.237 +            SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_LEAVE, 0, 0);
   1.238              FocusAllMice(_this, 0);
   1.239              /* SDL_DirectFB_ReshowCursor(_this, 1); */
   1.240              break;
   1.241 @@ -301,7 +310,7 @@
   1.242      SDL_DFB_DEVICEDATA(_this);
   1.243      SDL_KeySym keysym;
   1.244      int kbd_idx;
   1.245 -    char text[5];
   1.246 +    char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
   1.247  
   1.248      if (!devdata->use_linux_input) {
   1.249          if (ievt->type == DIET_AXISMOTION) {
   1.250 @@ -336,7 +345,7 @@
   1.251                              (DFB_WindowData *) window->driverdata;
   1.252                          int x, y;
   1.253  
   1.254 -                        windata->window->GetPosition(windata->window, &x, &y);
   1.255 +                        windata->dfbwin->GetPosition(windata->dfbwin, &x, &y);
   1.256                          SDL_SendMouseMotion_ex(window, ievt->device_id, 0,
   1.257                                              last_x - (x +
   1.258                                                        windata->client.x),
   1.259 @@ -358,11 +367,12 @@
   1.260              break;
   1.261          case DIET_KEYPRESS:
   1.262              kbd_idx = KbdIndex(_this, ievt->device_id);
   1.263 -            DirectFB_TranslateKeyInputEvent(_this, kbd_idx, ievt, &keysym);
   1.264 +            DirectFB_TranslateKeyInputEvent(_this, ievt, &keysym);
   1.265 +            //printf("Scancode %d  %d %d\n", keysym.scancode, evt->key_code, evt->key_id);
   1.266              SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode);
   1.267              if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
   1.268 -                SDL_memcpy(text, &keysym.unicode, 4);
   1.269 -                text[4] = 0;
   1.270 +                SDL_zero(text);
   1.271 +                UnicodeToUtf8(keysym.unicode, text);
   1.272                  if (*text) {
   1.273                      SDL_SendKeyboardText_ex(kbd_idx, text);
   1.274                  }
   1.275 @@ -370,7 +380,7 @@
   1.276              break;
   1.277          case DIET_KEYRELEASE:
   1.278              kbd_idx = KbdIndex(_this, ievt->device_id);
   1.279 -            DirectFB_TranslateKeyInputEvent(_this, kbd_idx, ievt, &keysym);
   1.280 +            DirectFB_TranslateKeyInputEvent(_this, ievt, &keysym);
   1.281              SDL_SendKeyboardKey_ex(kbd_idx, SDL_RELEASED, keysym.scancode);
   1.282              break;
   1.283          case DIET_BUTTONPRESS:
   1.284 @@ -399,29 +409,46 @@
   1.285  DirectFB_PumpEventsWindow(_THIS)
   1.286  {
   1.287      SDL_DFB_DEVICEDATA(_this);
   1.288 -    DFB_WindowData *p;
   1.289      DFBInputEvent ievt;
   1.290 +    SDL_Window *w;
   1.291  
   1.292 -    for (p = devdata->firstwin; p != NULL; p = p->next) {
   1.293 +    for (w = devdata->firstwin; w != NULL; w = w->next) {
   1.294 +        SDL_DFB_WINDOWDATA(w);
   1.295          DFBWindowEvent evt;
   1.296 -        SDL_Window *w = p->sdl_window;
   1.297  
   1.298 -        while (p->eventbuffer->GetEvent(p->eventbuffer,
   1.299 +        while (windata->eventbuffer->GetEvent(windata->eventbuffer,
   1.300                                          DFB_EVENT(&evt)) == DFB_OK) {
   1.301 -            if (!DirectFB_WM_ProcessEvent(_this, w, &evt))
   1.302 -                ProcessWindowEvent(_this, p, w->flags, &evt);
   1.303 +            if (!DirectFB_WM_ProcessEvent(_this, w, &evt)) {
   1.304 +                /* Send a SDL_SYSWMEVENT if the application wants them */
   1.305 +                if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
   1.306 +                    SDL_SysWMmsg wmmsg;
   1.307 +                    SDL_VERSION(&wmmsg.version);
   1.308 +                    wmmsg.subsystem = SDL_SYSWM_DIRECTFB;
   1.309 +                    wmmsg.msg.dfb.event.window = evt;
   1.310 +                    SDL_SendSysWMEvent(&wmmsg);
   1.311 +                }
   1.312 +                ProcessWindowEvent(_this, w, &evt);
   1.313 +            }
   1.314          }
   1.315      }
   1.316  
   1.317      /* Now get relative events in case we need them */
   1.318      while (devdata->events->GetEvent(devdata->events,
   1.319                                       DFB_EVENT(&ievt)) == DFB_OK) {
   1.320 +
   1.321 +    	if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
   1.322 +            SDL_SysWMmsg wmmsg;
   1.323 +            SDL_VERSION(&wmmsg.version);
   1.324 +            wmmsg.subsystem = SDL_SYSWM_DIRECTFB;
   1.325 +            wmmsg.msg.dfb.event.input = ievt;
   1.326 +            SDL_SendSysWMEvent(&wmmsg);
   1.327 +        }
   1.328          ProcessInputEvent(_this, &ievt);
   1.329      }
   1.330  }
   1.331  
   1.332  void
   1.333 -DirectFB_InitOSKeymap(_THIS, SDLKey * keymap, int numkeys)
   1.334 +DirectFB_InitOSKeymap(_THIS, SDL_ScanCode * keymap, int numkeys)
   1.335  {
   1.336      int i;
   1.337  
   1.338 @@ -552,15 +579,17 @@
   1.339  DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_KeySym * keysym)
   1.340  {
   1.341      SDL_DFB_DEVICEDATA(_this);
   1.342 +    int kbd_idx = 0; /* Window events lag the device source KbdIndex(_this, evt->device_id); */
   1.343 +    DFB_KeyboardData *kbd = &devdata->keyboard[kbd_idx];
   1.344  
   1.345 -    if (evt->key_code >= 0 &&
   1.346 -        evt->key_code < SDL_arraysize(linux_scancode_table))
   1.347 -        keysym->scancode = linux_scancode_table[evt->key_code];
   1.348 -    else
   1.349 -        keysym->scancode = SDL_SCANCODE_UNKNOWN;
   1.350 +    keysym->scancode = SDL_SCANCODE_UNKNOWN;
   1.351 +
   1.352 +    if (kbd->map && evt->key_code >= kbd->map_adjust &&
   1.353 +	    evt->key_code < kbd->map_size + kbd->map_adjust)
   1.354 +	    keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
   1.355  
   1.356      if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
   1.357 -        devdata->keyboard[0].is_generic) {
   1.358 +        devdata->keyboard[kbd_idx].is_generic) {
   1.359          if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
   1.360              keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
   1.361          else
   1.362 @@ -577,19 +606,20 @@
   1.363  }
   1.364  
   1.365  static SDL_KeySym *
   1.366 -DirectFB_TranslateKeyInputEvent(_THIS, int index, DFBInputEvent * evt,
   1.367 +DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt,
   1.368                                  SDL_KeySym * keysym)
   1.369  {
   1.370      SDL_DFB_DEVICEDATA(_this);
   1.371 +    int kbd_idx = KbdIndex(_this, evt->device_id);
   1.372 +    DFB_KeyboardData *kbd = &devdata->keyboard[kbd_idx];
   1.373  
   1.374 -    if (evt->key_code >= 0 &&
   1.375 -        evt->key_code < SDL_arraysize(linux_scancode_table))
   1.376 -        keysym->scancode = linux_scancode_table[evt->key_code];
   1.377 -    else
   1.378 -        keysym->scancode = SDL_SCANCODE_UNKNOWN;
   1.379 +    keysym->scancode = SDL_SCANCODE_UNKNOWN;
   1.380  
   1.381 -    if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
   1.382 -        devdata->keyboard[index].is_generic) {
   1.383 +    if (kbd->map && evt->key_code >= kbd->map_adjust &&
   1.384 +	    evt->key_code < kbd->map_size + kbd->map_adjust)
   1.385 +	    keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
   1.386 +
   1.387 +    if (keysym->scancode == SDL_SCANCODE_UNKNOWN || devdata->keyboard[kbd_idx].is_generic) {
   1.388          if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
   1.389              keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
   1.390          else
   1.391 @@ -652,8 +682,18 @@
   1.392          devdata->keyboard[devdata->num_keyboard].id = device_id;
   1.393          devdata->keyboard[devdata->num_keyboard].is_generic = 0;
   1.394          if (!strncmp("X11", desc.name, 3))
   1.395 -            devdata->keyboard[devdata->num_keyboard].is_generic = 1;
   1.396 +        {
   1.397 +        	devdata->keyboard[devdata->num_keyboard].map = xfree86_scancode_table2;
   1.398 +        	devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(xfree86_scancode_table2);
   1.399 +			devdata->keyboard[devdata->num_keyboard].map_adjust = 8;
   1.400 +        } else {
   1.401 +        	devdata->keyboard[devdata->num_keyboard].map = linux_scancode_table;
   1.402 +        	devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(linux_scancode_table);
   1.403 +			devdata->keyboard[devdata->num_keyboard].map_adjust = 0;
   1.404 +        }
   1.405  
   1.406 +		SDL_DFB_LOG("Keyboard %d - %s\n", device_id, desc.name);
   1.407 +		
   1.408          SDL_GetDefaultKeymap(keymap);
   1.409  #if USE_MULTI_API
   1.410          SDL_SetKeymap(devdata->num_keyboard, 0, keymap, SDL_NUM_SCANCODES);
   1.411 @@ -707,74 +747,3 @@
   1.412  
   1.413  }
   1.414  
   1.415 -#if 0
   1.416 -/* FIXME: Remove once determined this is not needed in fullscreen mode */
   1.417 -void
   1.418 -DirectFB_PumpEvents(_THIS)
   1.419 -{
   1.420 -    SDL_DFB_DEVICEDATA(_this);
   1.421 -    DFBInputEvent evt;
   1.422 -    static last_x = 0, last_y = 0;
   1.423 -
   1.424 -    while (devdata->eventbuffer->GetEvent(devdata->eventbuffer,
   1.425 -                                          DFB_EVENT(&evt)) == DFB_OK) {
   1.426 -        SDL_KeySym keysym;
   1.427 -        DFBInputDeviceModifierMask mod;
   1.428 -
   1.429 -        if (evt.clazz = DFEC_INPUT) {
   1.430 -            if (evt.flags & DIEF_MODIFIERS)
   1.431 -                mod = evt.modifiers;
   1.432 -            else
   1.433 -                mod = 0;
   1.434 -
   1.435 -            switch (evt.type) {
   1.436 -            case DIET_BUTTONPRESS:
   1.437 -                posted +=
   1.438 -                    SDL_PrivateMouseButton(SDL_PRESSED,
   1.439 -                                           DirectFB_TranslateButton
   1.440 -                                           (evt.button), 0, 0);
   1.441 -                break;
   1.442 -            case DIET_BUTTONRELEASE:
   1.443 -                posted +=
   1.444 -                    SDL_PrivateMouseButton(SDL_RELEASED,
   1.445 -                                           DirectFB_TranslateButton
   1.446 -                                           (evt.button), 0, 0);
   1.447 -                break;
   1.448 -            case DIET_KEYPRESS:
   1.449 -                posted +=
   1.450 -                    SDL_PrivateKeyboard(SDL_PRESSED,
   1.451 -                                        DirectFB_TranslateKey
   1.452 -                                        (evt.key_id, evt.key_symbol,
   1.453 -                                         mod, &keysym));
   1.454 -                break;
   1.455 -            case DIET_KEYRELEASE:
   1.456 -                posted +=
   1.457 -                    SDL_PrivateKeyboard(SDL_RELEASED,
   1.458 -                                        DirectFB_TranslateKey
   1.459 -                                        (evt.key_id, evt.key_symbol,
   1.460 -                                         mod, &keysym));
   1.461 -                break;
   1.462 -            case DIET_AXISMOTION:
   1.463 -                if (evt.flags & DIEF_AXISREL) {
   1.464 -                    if (evt.axis == DIAI_X)
   1.465 -                        posted +=
   1.466 -                            SDL_PrivateMouseMotion(0, 1, evt.axisrel, 0);
   1.467 -                    else if (evt.axis == DIAI_Y)
   1.468 -                        posted +=
   1.469 -                            SDL_PrivateMouseMotion(0, 1, 0, evt.axisrel);
   1.470 -                } else if (evt.flags & DIEF_AXISABS) {
   1.471 -                    if (evt.axis == DIAI_X)
   1.472 -                        last_x = evt.axisabs;
   1.473 -                    else if (evt.axis == DIAI_Y)
   1.474 -                        last_y = evt.axisabs;
   1.475 -                    posted += SDL_PrivateMouseMotion(0, 0, last_x, last_y);
   1.476 -                }
   1.477 -                break;
   1.478 -            default:
   1.479 -                ;
   1.480 -            }
   1.481 -        }
   1.482 -    }
   1.483 -}
   1.484 -#endif
   1.485 -