comparison src/video/directfb/SDL_DirectFB_events.c @ 2860:6ce28e5287e9

Date: Sun, 07 Dec 2008 13:35:23 +0100 From: Couriersud Subject: SDL: Mouse last_x, last_y into SDL_Mouse the attached diff moves the static vars last_x and last_y into SDL_Mouse. These, as far as I understand it, should be tied to the individual mouse. The patch also makes the code check for out of window conditions of mouse->x,y when relative movements are passed to MouseSendMotion. Also attached is the latest DirectFB code (dfb20081208) supporting multiple mice and keyboards. This works quite well with sdlmame now. It however needs more testing with different directfb configurations.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 08 Dec 2008 00:52:12 +0000
parents 99210400e8b9
children d364ee9b9c15
comparison
equal deleted inserted replaced
2859:99210400e8b9 2860:6ce28e5287e9
31 #include "../../events/SDL_keyboard_c.h" 31 #include "../../events/SDL_keyboard_c.h"
32 #include "../../events/scancodes_linux.h" 32 #include "../../events/scancodes_linux.h"
33 #include "SDL_DirectFB_events.h" 33 #include "SDL_DirectFB_events.h"
34 34
35 /* The translation tables from a DirectFB keycode to a SDL keysym */ 35 /* The translation tables from a DirectFB keycode to a SDL keysym */
36 static SDLKey keymap[256]; 36 static SDLKey oskeymap[256];
37 static int sys_ids;
37 38
38 static SDL_keysym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, 39 static SDL_keysym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt,
39 SDL_keysym * keysym); 40 SDL_keysym * keysym);
40 41 static SDL_keysym *DirectFB_TranslateKeyInputEvent(_THIS, int index,
41 static void DirectFB_InitOSKeymap(_THIS); 42 DFBInputEvent * evt,
43 SDL_keysym * keysym);
44
45 static void DirectFB_InitOSKeymap(_THIS, SDLKey * keypmap, int numkeys);
42 static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button); 46 static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
43 47
44 static void 48 static void
45 DirectFB_SetContext(_THIS, SDL_WindowID id) 49 DirectFB_SetContext(_THIS, SDL_WindowID id)
46 { 50 {
63 return; 67 return;
64 #endif 68 #endif
65 69
66 } 70 }
67 71
72 static void
73 FocusAllMice(_THIS, SDL_WindowID id)
74 {
75 SDL_DFB_DEVICEDATA(_this);
76 int index;
77
78 for (index = 0; index < devdata->num_mice; index++)
79 SDL_SetMouseFocus(devdata->mouse_id[index], id);
80 }
81
82
83 static void
84 FocusAllKeyboards(_THIS, SDL_WindowID id)
85 {
86 SDL_DFB_DEVICEDATA(_this);
87 int index;
88
89 for (index = 0; index < devdata->num_keyboard; index++)
90 SDL_SetKeyboardFocus(index, id);
91 }
92
93 static void
94 MotionAllMice(_THIS, int x, int y)
95 {
96 SDL_DFB_DEVICEDATA(_this);
97 int index;
98
99 for (index = 0; index < devdata->num_mice; index++) {
100 SDL_Mouse *mouse = SDL_GetMouse(index);
101 mouse->x = mouse->last_x = x;
102 mouse->y = mouse->last_y = y;
103 //SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0);
104 }
105 }
106
107 static int
108 KbdIndex(_THIS, int id)
109 {
110 SDL_DFB_DEVICEDATA(_this);
111 int index;
112
113 for (index = 0; index < devdata->num_keyboard; index++) {
114 if (devdata->keyboard[index].id == id)
115 return index;
116 }
117 return -1;
118 }
119
68 void 120 void
69 DirectFB_PumpEventsWindow(_THIS) 121 DirectFB_PumpEventsWindow(_THIS)
70 { 122 {
71 SDL_DFB_DEVICEDATA(_this); 123 SDL_DFB_DEVICEDATA(_this);
72 DFB_WindowData *p; 124 DFB_WindowData *p;
73 DFBWindowEvent evt;
74 DFBInputEvent ievt; 125 DFBInputEvent ievt;
75 SDL_WindowID grabbed_window; 126 Sint32 /* SDL_WindowID */ grabbed_window;
76 char text[5]; 127 char text[5];
128 int kbd_idx;
77 129
78 grabbed_window = -1; 130 grabbed_window = -1;
79 131
80 for (p = devdata->firstwin; p != NULL; p = p->next) { 132 for (p = devdata->firstwin; p != NULL; p = p->next) {
133 DFBWindowEvent evt;
81 SDL_Window *w = SDL_GetWindowFromID(p->id); 134 SDL_Window *w = SDL_GetWindowFromID(p->id);
82 135
83 if (w->flags & SDL_WINDOW_INPUT_GRABBED) { 136 if (w->flags & SDL_WINDOW_INPUT_GRABBED) {
84 grabbed_window = p->id; 137 grabbed_window = p->id;
85 } 138 }
89 SDL_keysym keysym; 142 SDL_keysym keysym;
90 143
91 if (evt.clazz == DFEC_WINDOW) { 144 if (evt.clazz == DFEC_WINDOW) {
92 switch (evt.type) { 145 switch (evt.type) {
93 case DWET_BUTTONDOWN: 146 case DWET_BUTTONDOWN:
94 SDL_SendMouseButton(devdata->mouse, SDL_PRESSED, 147 if (!LINUX_INPUT_SUPPORT) {
95 DirectFB_TranslateButton(evt.button)); 148 SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt.cx,
149 evt.cy, 0);
150 SDL_SendMouseButton(devdata->mouse_id[0], SDL_PRESSED,
151 DirectFB_TranslateButton(evt.
152 button));
153 } else {
154 MotionAllMice(_this, evt.x, evt.y);
155 }
96 break; 156 break;
97 case DWET_BUTTONUP: 157 case DWET_BUTTONUP:
98 SDL_SendMouseButton(devdata->mouse, SDL_RELEASED, 158 if (!LINUX_INPUT_SUPPORT) {
99 DirectFB_TranslateButton(evt.button)); 159 SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt.cx,
160 evt.cy, 0);
161 SDL_SendMouseButton(devdata->mouse_id[0],
162 SDL_RELEASED,
163 DirectFB_TranslateButton(evt.
164 button));
165 } else {
166 MotionAllMice(_this, evt.x, evt.y);
167 }
100 break; 168 break;
101 case DWET_MOTION: 169 case DWET_MOTION:
102 if (!(w->flags & SDL_WINDOW_INPUT_GRABBED)) 170 if (!LINUX_INPUT_SUPPORT) {
103 SDL_SendMouseMotion(devdata->mouse, 0, evt.cx, evt.cy, 171 if (!(w->flags & SDL_WINDOW_INPUT_GRABBED))
104 0); 172 SDL_SendMouseMotion(devdata->mouse_id[0], 0,
105 break; 173 evt.cx, evt.cy, 0);
106 case DWET_KEYDOWN: 174 } else {
107 DirectFB_TranslateKey(_this, &evt, &keysym); 175 /* relative movements are not exact!
108 SDL_SendKeyboardKey(devdata->keyboard, SDL_PRESSED, 176 * This code should limit the number of events sent.
109 keysym.scancode); 177 * However it kills MAME axis recognition ... */
110 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { 178 static int cnt = 0;
111 SDL_memcpy(text, &keysym.unicode, 4); 179 if (1 && ++cnt > 20) {
112 text[4] = 0; 180 MotionAllMice(_this, evt.x, evt.y);
113 if (*text) { 181 cnt = 0;
114 SDL_SendKeyboardText(devdata->keyboard, text);
115 } 182 }
116 } 183 }
117 break; 184 break;
185 case DWET_KEYDOWN:
186 if (!LINUX_INPUT_SUPPORT) {
187 DirectFB_TranslateKey(_this, &evt, &keysym);
188 SDL_SendKeyboardKey(0, SDL_PRESSED, keysym.scancode);
189 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
190 SDL_memcpy(text, &keysym.unicode, 4);
191 text[4] = 0;
192 if (*text) {
193 SDL_SendKeyboardText(0, text);
194 }
195 }
196 }
197 break;
118 case DWET_KEYUP: 198 case DWET_KEYUP:
119 DirectFB_TranslateKey(_this, &evt, &keysym); 199 if (!LINUX_INPUT_SUPPORT) {
120 SDL_SendKeyboardKey(devdata->keyboard, SDL_RELEASED, 200 DirectFB_TranslateKey(_this, &evt, &keysym);
121 keysym.scancode); 201 SDL_SendKeyboardKey(0, SDL_RELEASED, keysym.scancode);
202 }
122 break; 203 break;
123 case DWET_POSITION_SIZE: 204 case DWET_POSITION_SIZE:
124 if (evt.x != w->x || evt.y != w->y) 205 if (evt.x != w->x || evt.y != w->y)
125 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_MOVED, 206 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_MOVED,
126 evt.x, evt.y); 207 evt.x, evt.y);
141 case DWET_CLOSE: 222 case DWET_CLOSE:
142 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_CLOSE, 0, 0); 223 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_CLOSE, 0, 0);
143 break; 224 break;
144 case DWET_GOTFOCUS: 225 case DWET_GOTFOCUS:
145 DirectFB_SetContext(_this, p->id); 226 DirectFB_SetContext(_this, p->id);
146 SDL_SetKeyboardFocus(devdata->keyboard, p->id); 227 FocusAllKeyboards(_this, p->id);
147 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_FOCUS_GAINED, 228 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_FOCUS_GAINED,
148 0, 0); 229 0, 0);
149 break; 230 break;
150 case DWET_LOSTFOCUS: 231 case DWET_LOSTFOCUS:
151 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_FOCUS_LOST, 0, 232 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_FOCUS_LOST, 0,
152 0); 233 0);
153 SDL_SetKeyboardFocus(devdata->keyboard, 0); 234 FocusAllKeyboards(_this, 0);
154 break; 235 break;
155 case DWET_ENTER: 236 case DWET_ENTER:
156 /* SDL_DirectFB_ReshowCursor(_this, 0); */ 237 /* SDL_DirectFB_ReshowCursor(_this, 0); */
157 SDL_SetMouseFocus(devdata->mouse, p->id); 238 FocusAllMice(_this, p->id);
239 MotionAllMice(_this, evt.x, evt.y);
158 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_ENTER, 0, 0); 240 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_ENTER, 0, 0);
159 break; 241 break;
160 case DWET_LEAVE: 242 case DWET_LEAVE:
161 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_LEAVE, 0, 0); 243 SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_LEAVE, 0, 0);
162 SDL_SetMouseFocus(devdata->mouse, 0); 244 FocusAllMice(_this, 0);
163 /* SDL_DirectFB_ReshowCursor(_this, 1); */ 245 /* SDL_DirectFB_ReshowCursor(_this, 1); */
164 break; 246 break;
165 default: 247 default:
166 ; 248 ;
167 } 249 }
172 } 254 }
173 255
174 /* Now get relative events in case we need them */ 256 /* Now get relative events in case we need them */
175 while (devdata->events->GetEvent(devdata->events, 257 while (devdata->events->GetEvent(devdata->events,
176 DFB_EVENT(&ievt)) == DFB_OK) { 258 DFB_EVENT(&ievt)) == DFB_OK) {
177 if (grabbed_window >= 0) { 259 SDL_keysym keysym;
260
261 switch (ievt.type) {
262 case DIET_AXISMOTION:
263 if (!LINUX_INPUT_SUPPORT) {
264 if ((grabbed_window >= 0) && (ievt.flags & DIEF_AXISREL)) {
265 printf("rel devid %d\n", ievt.device_id);
266 if (ievt.axis == DIAI_X)
267 SDL_SendMouseMotion(ievt.device_id, 1, ievt.axisrel,
268 0, 0);
269 else if (ievt.axis == DIAI_Y)
270 SDL_SendMouseMotion(ievt.device_id, 1, 0,
271 ievt.axisrel, 0);
272 }
273 }
274 break;
275 }
276 if (LINUX_INPUT_SUPPORT) {
277 IDirectFBInputDevice *idev;
278 static int last_x, last_y;
279
178 switch (ievt.type) { 280 switch (ievt.type) {
179 case DIET_AXISMOTION: 281 case DIET_AXISMOTION:
180 if (ievt.flags & DIEF_AXISREL) { 282 if (ievt.flags & DIEF_AXISABS) {
181 if (ievt.axis == DIAI_X) 283 if (ievt.axis == DIAI_X)
182 SDL_SendMouseMotion(devdata->mouse, 1, ievt.axisrel, 284 last_x = ievt.axisabs;
285 else if (ievt.axis == DIAI_Y)
286 last_y = ievt.axisabs;
287 if (!(ievt.flags & DIEF_FOLLOW))
288 SDL_SendMouseMotion(ievt.device_id, 0, last_x, last_y,
289 0);
290 } else if (ievt.flags & DIEF_AXISREL) {
291 //printf("rel %d %d\n", ievt.device_id, ievt.axisrel);
292 if (ievt.axis == DIAI_X)
293 SDL_SendMouseMotion(ievt.device_id, 1, ievt.axisrel,
183 0, 0); 294 0, 0);
184 else if (ievt.axis == DIAI_Y) 295 else if (ievt.axis == DIAI_Y)
185 SDL_SendMouseMotion(devdata->mouse, 1, 0, 296 SDL_SendMouseMotion(ievt.device_id, 1, 0,
186 ievt.axisrel, 0); 297 ievt.axisrel, 0);
187 } 298 }
188 break; 299 break;
189 default: 300 case DIET_KEYPRESS:
190 ; 301 kbd_idx = KbdIndex(_this, ievt.device_id);
302 DirectFB_TranslateKeyInputEvent(_this, kbd_idx, &ievt,
303 &keysym);
304 SDL_SendKeyboardKey(kbd_idx, SDL_PRESSED, keysym.scancode);
305 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
306 SDL_memcpy(text, &keysym.unicode, 4);
307 text[4] = 0;
308 if (*text) {
309 SDL_SendKeyboardText(kbd_idx, text);
310 }
311 }
312 break;
313 case DIET_KEYRELEASE:
314 kbd_idx = KbdIndex(_this, ievt.device_id);
315 DirectFB_TranslateKeyInputEvent(_this, kbd_idx, &ievt,
316 &keysym);
317 SDL_SendKeyboardKey(kbd_idx, SDL_RELEASED, keysym.scancode);
318 break;
319 case DIET_BUTTONPRESS:
320 if (ievt.buttons & DIBM_LEFT)
321 SDL_SendMouseButton(ievt.device_id, SDL_PRESSED, 1);
322 if (ievt.buttons & DIBM_MIDDLE)
323 SDL_SendMouseButton(ievt.device_id, SDL_PRESSED, 2);
324 if (ievt.buttons & DIBM_RIGHT)
325 SDL_SendMouseButton(ievt.device_id, SDL_PRESSED, 3);
326 break;
327 case DIET_BUTTONRELEASE:
328 if (!(ievt.buttons & DIBM_LEFT))
329 SDL_SendMouseButton(ievt.device_id, SDL_RELEASED, 1);
330 if (!(ievt.buttons & DIBM_MIDDLE))
331 SDL_SendMouseButton(ievt.device_id, SDL_RELEASED, 2);
332 if (!(ievt.buttons & DIBM_RIGHT))
333 SDL_SendMouseButton(ievt.device_id, SDL_RELEASED, 3);
334 break;
191 } 335 }
192 } 336 }
193 } 337 }
194 } 338 }
195 339
196 void 340 void
197 DirectFB_InitOSKeymap(_THIS) 341 DirectFB_InitOSKeymap(_THIS, SDLKey * keymap, int numkeys)
198 { 342 {
199 int i; 343 int i;
200 344
201 /* Initialize the DirectFB key translation table */ 345 /* Initialize the DirectFB key translation table */
202 for (i = 0; i < SDL_arraysize(keymap); ++i) 346 for (i = 0; i < numkeys; ++i)
203 keymap[i] = SDL_SCANCODE_UNKNOWN; 347 keymap[i] = SDL_SCANCODE_UNKNOWN;
204 348
205 keymap[DIKI_A - DIKI_UNKNOWN] = SDL_SCANCODE_A; 349 keymap[DIKI_A - DIKI_UNKNOWN] = SDL_SCANCODE_A;
206 keymap[DIKI_B - DIKI_UNKNOWN] = SDL_SCANCODE_B; 350 keymap[DIKI_B - DIKI_UNKNOWN] = SDL_SCANCODE_B;
207 keymap[DIKI_C - DIKI_UNKNOWN] = SDL_SCANCODE_C; 351 keymap[DIKI_C - DIKI_UNKNOWN] = SDL_SCANCODE_C;
330 && evt->key_code < SDL_arraysize(linux_scancode_table)) 474 && evt->key_code < SDL_arraysize(linux_scancode_table))
331 keysym->scancode = linux_scancode_table[evt->key_code]; 475 keysym->scancode = linux_scancode_table[evt->key_code];
332 else 476 else
333 keysym->scancode = SDL_SCANCODE_UNKNOWN; 477 keysym->scancode = SDL_SCANCODE_UNKNOWN;
334 478
335 if (keysym->scancode == SDL_SCANCODE_UNKNOWN || devdata->kbdgeneric) { 479 if (keysym->scancode == SDL_SCANCODE_UNKNOWN
336 if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(keymap)) 480 || devdata->keyboard[0].is_generic) {
337 keysym->scancode = keymap[evt->key_id - DIKI_UNKNOWN]; 481 if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
482 keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
338 else 483 else
339 keysym->scancode = SDL_SCANCODE_UNKNOWN; 484 keysym->scancode = SDL_SCANCODE_UNKNOWN;
340 } 485 }
341 486
342 keysym->unicode = 487 keysym->unicode =
346 keysym->unicode = evt->key_symbol; 491 keysym->unicode = evt->key_symbol;
347 492
348 return keysym; 493 return keysym;
349 } 494 }
350 495
496 static SDL_keysym *
497 DirectFB_TranslateKeyInputEvent(_THIS, int index, DFBInputEvent * evt,
498 SDL_keysym * keysym)
499 {
500 SDL_DFB_DEVICEDATA(_this);
501
502 if (evt->key_code >= 0
503 && evt->key_code < SDL_arraysize(linux_scancode_table))
504 keysym->scancode = linux_scancode_table[evt->key_code];
505 else
506 keysym->scancode = SDL_SCANCODE_UNKNOWN;
507
508 if (keysym->scancode == SDL_SCANCODE_UNKNOWN
509 || devdata->keyboard[index].is_generic) {
510 if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
511 keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
512 else
513 keysym->scancode = SDL_SCANCODE_UNKNOWN;
514 }
515
516 keysym->unicode =
517 (DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
518 if (keysym->unicode == 0
519 && (evt->key_symbol > 0 && evt->key_symbol < 255))
520 keysym->unicode = evt->key_symbol;
521
522 return keysym;
523 }
351 static int 524 static int
352 DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button) 525 DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button)
353 { 526 {
354 switch (button) { 527 switch (button) {
355 case DIBI_LEFT: 528 case DIBI_LEFT:
371 SDL_Keyboard keyboard; 544 SDL_Keyboard keyboard;
372 SDLKey keymap[SDL_NUM_SCANCODES]; 545 SDLKey keymap[SDL_NUM_SCANCODES];
373 546
374 if ((desc.caps & DIDTF_KEYBOARD) && device_id == DIDID_KEYBOARD) { 547 if ((desc.caps & DIDTF_KEYBOARD) && device_id == DIDID_KEYBOARD) {
375 SDL_zero(keyboard); 548 SDL_zero(keyboard);
376 devdata->keyboard = SDL_AddKeyboard(&keyboard, -1); 549 SDL_AddKeyboard(&keyboard, 0);
550 devdata->keyboard[0].id = device_id;
551 devdata->keyboard[0].is_generic = 0;
377 if (!strncmp("X11", desc.name, 3)) 552 if (!strncmp("X11", desc.name, 3))
378 devdata->kbdgeneric = 1; 553 devdata->keyboard[0].is_generic = 1;
379 554
380 SDL_GetDefaultKeymap(keymap); 555 SDL_GetDefaultKeymap(keymap);
381 SDL_SetKeymap(devdata->keyboard, 0, keymap, SDL_NUM_SCANCODES); 556 SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
382 } 557 devdata->num_keyboard++;
383 return DFB_OK; 558
559 return DFENUM_CANCEL;
560 }
561 return DFENUM_OK;
562 }
563
564 static DFBEnumerationResult
565 EnumKeyboards(DFBInputDeviceID device_id, DFBInputDeviceDescription desc,
566 void *callbackdata)
567 {
568 DFB_DeviceData *devdata = callbackdata;
569 SDL_Keyboard keyboard;
570 SDLKey keymap[SDL_NUM_SCANCODES];
571
572 if (sys_ids) {
573 if (device_id >= 0x10)
574 return DFENUM_OK;
575 } else {
576 if (device_id < 0x10)
577 return DFENUM_OK;
578 }
579 if ((desc.caps & DIDTF_KEYBOARD)) {
580 SDL_zero(keyboard);
581 SDL_AddKeyboard(&keyboard, devdata->num_keyboard);
582 devdata->keyboard[devdata->num_keyboard].id = device_id;
583 devdata->keyboard[devdata->num_keyboard].is_generic = 0;
584 if (!strncmp("X11", desc.name, 3))
585 devdata->keyboard[devdata->num_keyboard].is_generic = 1;
586
587 SDL_GetDefaultKeymap(keymap);
588 SDL_SetKeymap(devdata->num_keyboard, 0, keymap, SDL_NUM_SCANCODES);
589 devdata->num_keyboard++;
590 }
591 return DFENUM_OK;
384 } 592 }
385 593
386 void 594 void
387 DirectFB_InitKeyboard(_THIS) 595 DirectFB_InitKeyboard(_THIS)
388 { 596 {
389 SDL_DFB_DEVICEDATA(_this); 597 SDL_DFB_DEVICEDATA(_this);
390 int ret; 598 int ret;
391 599
392 DirectFB_InitOSKeymap(_this); 600 DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap));
393 601
394 devdata->kbdgeneric = 0; 602 devdata->num_keyboard = 0;
395 603 if (LINUX_INPUT_SUPPORT) {
396 SDL_DFB_CHECK(devdata->dfb-> 604 sys_ids = 0;
397 EnumInputDevices(devdata->dfb, input_device_cb, devdata)); 605 SDL_DFB_CHECK(devdata->dfb->
606 EnumInputDevices(devdata->dfb, EnumKeyboards, devdata));
607 if (devdata->num_keyboard == 0) {
608 sys_ids = 1;
609 SDL_DFB_CHECK(devdata->dfb->
610 EnumInputDevices(devdata->dfb, EnumKeyboards,
611 devdata));
612 }
613 } else {
614 SDL_DFB_CHECK(devdata->dfb->
615 EnumInputDevices(devdata->dfb, input_device_cb,
616 devdata));
617 }
398 } 618 }
399 619
400 void 620 void
401 DirectFB_QuitKeyboard(_THIS) 621 DirectFB_QuitKeyboard(_THIS)
402 { 622 {
403 SDL_DFB_DEVICEDATA(_this); 623 SDL_DFB_DEVICEDATA(_this);
404 int ret; 624 int ret;
405 625
406 SDL_DelKeyboard(devdata->keyboard); 626 SDL_KeyboardQuit();
407 627
408 } 628 }
409 629
410 #if 0 630 #if 0
411 /* FIXME: Remove once determined this is not needed in fullscreen mode */ 631 /* FIXME: Remove once determined this is not needed in fullscreen mode */