Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
749 lines (670 loc) · 27.8 KB

SDL_DirectFB_events.c

File metadata and controls

749 lines (670 loc) · 27.8 KB
 
Feb 1, 2006
Feb 1, 2006
2
SDL - Simple DirectMedia Layer
Feb 12, 2011
Feb 12, 2011
3
Copyright (C) 1997-2011 Sam Lantinga
Feb 1, 2006
Feb 1, 2006
5
6
7
8
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Feb 1, 2006
Feb 1, 2006
10
11
12
13
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
Feb 1, 2006
Feb 1, 2006
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Feb 1, 2006
Feb 1, 2006
19
20
Sam Lantinga
slouken@libsdl.org
Feb 6, 2011
Feb 6, 2011
21
22
23
SDL1.3 DirectFB driver by couriersud@arcor.de
24
25
26
27
*/
/* Handle the event stream, converting DirectFB input events into SDL events */
Feb 6, 2011
Feb 6, 2011
28
29
30
#include "SDL_DirectFB_video.h"
#include "SDL_DirectFB_window.h"
#include "SDL_DirectFB_modes.h"
Feb 6, 2011
Feb 6, 2011
32
33
34
#include "SDL_syswm.h"
#include "../../events/SDL_mouse_c.h"
Aug 26, 2008
Aug 26, 2008
35
#include "../../events/SDL_keyboard_c.h"
Feb 6, 2011
Feb 6, 2011
36
37
#include "../../events/SDL_windowevents_c.h"
#include "../../events/SDL_events_c.h"
Aug 26, 2008
Aug 26, 2008
38
#include "../../events/scancodes_linux.h"
Feb 6, 2011
Feb 6, 2011
39
40
#include "../../events/scancodes_xfree86.h"
41
42
#include "SDL_DirectFB_events.h"
Jul 24, 2010
Jul 24, 2010
43
#if USE_MULTI_API
Aug 16, 2010
Aug 16, 2010
44
45
#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(id, relative, x, y, p)
#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(id, state, button)
Jul 24, 2010
Jul 24, 2010
46
47
48
#define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(id, state, scancode)
#define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(id, text)
#else
Aug 16, 2010
Aug 16, 2010
49
50
#define SDL_SendMouseMotion_ex(w, id, relative, x, y, p) SDL_SendMouseMotion(w, relative, x, y)
#define SDL_SendMouseButton_ex(w, id, state, button) SDL_SendMouseButton(w, state, button)
Jul 24, 2010
Jul 24, 2010
51
52
53
54
#define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(state, scancode)
#define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(text)
#endif
Aug 16, 2010
Aug 16, 2010
55
56
57
58
59
60
61
typedef struct _cb_data cb_data;
struct _cb_data
{
DFB_DeviceData *devdata;
int sys_ids;
int sys_kbd;
};
Jul 24, 2010
Jul 24, 2010
62
63
/* The translation tables from a DirectFB keycode to a SDL keysym */
Feb 7, 2011
Feb 7, 2011
64
static SDL_Scancode oskeymap[256];
Aug 16, 2010
Aug 16, 2010
65
Feb 7, 2011
Feb 7, 2011
67
68
69
70
static SDL_Keysym *DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt,
SDL_Keysym * keysym);
static SDL_Keysym *DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt,
SDL_Keysym * keysym);
Feb 7, 2011
Feb 7, 2011
72
static void DirectFB_InitOSKeymap(_THIS, SDL_Scancode * keypmap, int numkeys);
Aug 11, 2007
Aug 11, 2007
73
static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
Feb 6, 2011
Feb 6, 2011
75
static void UnicodeToUtf8( Uint16 w , char *utf8buf)
Aug 26, 2008
Aug 26, 2008
76
{
Feb 6, 2011
Feb 6, 2011
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
unsigned char *utf8s = (unsigned char *) utf8buf;
if ( w < 0x0080 ) {
utf8s[0] = ( unsigned char ) w;
utf8s[1] = 0;
}
else if ( w < 0x0800 ) {
utf8s[0] = 0xc0 | (( w ) >> 6 );
utf8s[1] = 0x80 | (( w ) & 0x3f );
utf8s[2] = 0;
}
else {
utf8s[0] = 0xe0 | (( w ) >> 12 );
utf8s[1] = 0x80 | (( ( w ) >> 6 ) & 0x3f );
utf8s[2] = 0x80 | (( w ) & 0x3f );
utf8s[3] = 0;
}
Aug 26, 2008
Aug 26, 2008
94
95
}
Dec 8, 2008
Dec 8, 2008
96
static void
Jan 21, 2010
Jan 21, 2010
97
FocusAllMice(_THIS, SDL_Window *window)
Dec 8, 2008
Dec 8, 2008
98
{
Jul 24, 2010
Jul 24, 2010
99
#if USE_MULTI_API
Dec 8, 2008
Dec 8, 2008
100
101
102
103
104
SDL_DFB_DEVICEDATA(_this);
int index;
for (index = 0; index < devdata->num_mice; index++)
SDL_SetMouseFocus(devdata->mouse_id[index], id);
Jul 24, 2010
Jul 24, 2010
105
106
107
#else
SDL_SetMouseFocus(window);
#endif
Dec 8, 2008
Dec 8, 2008
108
109
110
111
}
static void
Jan 21, 2010
Jan 21, 2010
112
FocusAllKeyboards(_THIS, SDL_Window *window)
Dec 8, 2008
Dec 8, 2008
113
{
Jul 24, 2010
Jul 24, 2010
114
#if USE_MULTI_API
Dec 8, 2008
Dec 8, 2008
115
116
117
118
119
SDL_DFB_DEVICEDATA(_this);
int index;
for (index = 0; index < devdata->num_keyboard; index++)
SDL_SetKeyboardFocus(index, id);
Jul 24, 2010
Jul 24, 2010
120
121
122
#else
SDL_SetKeyboardFocus(window);
#endif
Dec 8, 2008
Dec 8, 2008
123
124
125
126
127
}
static void
MotionAllMice(_THIS, int x, int y)
{
Jul 24, 2010
Jul 24, 2010
128
#if USE_MULTI_API
Dec 8, 2008
Dec 8, 2008
129
130
131
132
133
134
135
136
137
SDL_DFB_DEVICEDATA(_this);
int index;
for (index = 0; index < devdata->num_mice; index++) {
SDL_Mouse *mouse = SDL_GetMouse(index);
mouse->x = mouse->last_x = x;
mouse->y = mouse->last_y = y;
//SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0);
}
Jul 24, 2010
Jul 24, 2010
138
#endif
Dec 8, 2008
Dec 8, 2008
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
}
static int
KbdIndex(_THIS, int id)
{
SDL_DFB_DEVICEDATA(_this);
int index;
for (index = 0; index < devdata->num_keyboard; index++) {
if (devdata->keyboard[index].id == id)
return index;
}
return -1;
}
Jan 11, 2009
Jan 11, 2009
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
static int
ClientXY(DFB_WindowData * p, int *x, int *y)
{
int cx, cy;
cx = *x;
cy = *y;
cx -= p->client.x;
cy -= p->client.y;
if (cx < 0 || cy < 0)
return 0;
if (cx >= p->client.w || cy >= p->client.h)
return 0;
*x = cx;
*y = cy;
return 1;
}
static void
Feb 6, 2011
Feb 6, 2011
175
ProcessWindowEvent(_THIS, SDL_Window *sdlwin, DFBWindowEvent * evt)
Jan 11, 2009
Jan 11, 2009
176
177
{
SDL_DFB_DEVICEDATA(_this);
Feb 6, 2011
Feb 6, 2011
178
SDL_DFB_WINDOWDATA(sdlwin);
Feb 7, 2011
Feb 7, 2011
179
SDL_Keysym keysym;
Feb 6, 2011
Feb 6, 2011
180
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
Jan 11, 2009
Jan 11, 2009
181
182
183
184
if (evt->clazz == DFEC_WINDOW) {
switch (evt->type) {
case DWET_BUTTONDOWN:
Feb 6, 2011
Feb 6, 2011
185
if (ClientXY(windata, &evt->x, &evt->y)) {
Jan 11, 2009
Jan 11, 2009
186
if (!devdata->use_linux_input) {
Feb 6, 2011
Feb 6, 2011
187
SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0, evt->x,
Jan 11, 2009
Jan 11, 2009
188
evt->y, 0);
Feb 6, 2011
Feb 6, 2011
189
SDL_SendMouseButton_ex(sdlwin, devdata->mouse_id[0],
Jan 11, 2009
Jan 11, 2009
190
191
192
193
194
195
196
197
198
SDL_PRESSED,
DirectFB_TranslateButton
(evt->button));
} else {
MotionAllMice(_this, evt->x, evt->y);
}
}
break;
case DWET_BUTTONUP:
Feb 6, 2011
Feb 6, 2011
199
if (ClientXY(windata, &evt->x, &evt->y)) {
Jan 11, 2009
Jan 11, 2009
200
if (!devdata->use_linux_input) {
Feb 6, 2011
Feb 6, 2011
201
SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0, evt->x,
Jan 11, 2009
Jan 11, 2009
202
evt->y, 0);
Feb 6, 2011
Feb 6, 2011
203
SDL_SendMouseButton_ex(sdlwin, devdata->mouse_id[0],
Jan 11, 2009
Jan 11, 2009
204
205
206
207
208
209
210
211
212
SDL_RELEASED,
DirectFB_TranslateButton
(evt->button));
} else {
MotionAllMice(_this, evt->x, evt->y);
}
}
break;
case DWET_MOTION:
Feb 6, 2011
Feb 6, 2011
213
if (ClientXY(windata, &evt->x, &evt->y)) {
Jan 11, 2009
Jan 11, 2009
214
if (!devdata->use_linux_input) {
Feb 6, 2011
Feb 6, 2011
215
216
if (!(sdlwin->flags & SDL_WINDOW_INPUT_GRABBED))
SDL_SendMouseMotion_ex(sdlwin, devdata->mouse_id[0], 0,
Jan 11, 2009
Jan 11, 2009
217
218
219
220
221
222
223
224
225
226
227
evt->x, evt->y, 0);
} else {
/* relative movements are not exact!
* This code should limit the number of events sent.
* However it kills MAME axis recognition ... */
static int cnt = 0;
if (1 && ++cnt > 20) {
MotionAllMice(_this, evt->x, evt->y);
cnt = 0;
}
}
Feb 6, 2011
Feb 6, 2011
228
229
if (!(sdlwin->flags & SDL_WINDOW_MOUSE_FOCUS))
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_ENTER, 0,
Jan 14, 2009
Jan 14, 2009
230
0);
Jan 11, 2009
Jan 11, 2009
231
232
233
234
235
}
break;
case DWET_KEYDOWN:
if (!devdata->use_linux_input) {
DirectFB_TranslateKey(_this, evt, &keysym);
Feb 6, 2011
Feb 6, 2011
236
//printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id);
Jul 24, 2010
Jul 24, 2010
237
SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode);
Jan 11, 2009
Jan 11, 2009
238
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
Feb 6, 2011
Feb 6, 2011
239
240
SDL_zero(text);
UnicodeToUtf8(keysym.unicode, text);
Jan 11, 2009
Jan 11, 2009
241
if (*text) {
Jul 24, 2010
Jul 24, 2010
242
SDL_SendKeyboardText_ex(0, text);
Jan 11, 2009
Jan 11, 2009
243
244
245
246
247
248
249
}
}
}
break;
case DWET_KEYUP:
if (!devdata->use_linux_input) {
DirectFB_TranslateKey(_this, evt, &keysym);
Jul 24, 2010
Jul 24, 2010
250
SDL_SendKeyboardKey_ex(0, SDL_RELEASED, keysym.scancode);
Jan 11, 2009
Jan 11, 2009
251
252
253
}
break;
case DWET_POSITION:
Feb 6, 2011
Feb 6, 2011
254
255
if (ClientXY(windata, &evt->x, &evt->y)) {
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_MOVED,
Jan 11, 2009
Jan 11, 2009
256
257
258
259
evt->x, evt->y);
}
break;
case DWET_POSITION_SIZE:
Feb 6, 2011
Feb 6, 2011
260
261
if (ClientXY(windata, &evt->x, &evt->y)) {
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_MOVED,
Jan 11, 2009
Jan 11, 2009
262
263
264
265
266
evt->x, evt->y);
}
/* fall throught */
case DWET_SIZE:
// FIXME: what about < 0
Feb 6, 2011
Feb 6, 2011
267
evt->w -= (windata->theme.right_size + windata->theme.left_size);
Jan 11, 2009
Jan 11, 2009
268
evt->h -=
Feb 6, 2011
Feb 6, 2011
269
270
271
(windata->theme.top_size + windata->theme.bottom_size +
windata->theme.caption_size);
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_RESIZED,
Jan 11, 2009
Jan 11, 2009
272
273
274
evt->w, evt->h);
break;
case DWET_CLOSE:
Feb 6, 2011
Feb 6, 2011
275
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_CLOSE, 0, 0);
Jan 11, 2009
Jan 11, 2009
276
277
break;
case DWET_GOTFOCUS:
Feb 6, 2011
Feb 6, 2011
278
279
280
DirectFB_SetContext(_this, sdlwin);
FocusAllKeyboards(_this, sdlwin);
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_FOCUS_GAINED,
Jan 11, 2009
Jan 11, 2009
281
282
283
0, 0);
break;
case DWET_LOSTFOCUS:
Feb 6, 2011
Feb 6, 2011
284
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
Jan 11, 2009
Jan 11, 2009
285
286
287
288
FocusAllKeyboards(_this, 0);
break;
case DWET_ENTER:
/* SDL_DirectFB_ReshowCursor(_this, 0); */
Feb 6, 2011
Feb 6, 2011
289
FocusAllMice(_this, sdlwin);
Jan 11, 2009
Jan 11, 2009
290
// FIXME: when do we really enter ?
Feb 6, 2011
Feb 6, 2011
291
if (ClientXY(windata, &evt->x, &evt->y))
Jan 11, 2009
Jan 11, 2009
292
MotionAllMice(_this, evt->x, evt->y);
Feb 6, 2011
Feb 6, 2011
293
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_ENTER, 0, 0);
Jan 11, 2009
Jan 11, 2009
294
295
break;
case DWET_LEAVE:
Feb 6, 2011
Feb 6, 2011
296
SDL_SendWindowEvent(sdlwin, SDL_WINDOWEVENT_LEAVE, 0, 0);
Jan 11, 2009
Jan 11, 2009
297
298
299
300
301
302
303
304
305
306
307
FocusAllMice(_this, 0);
/* SDL_DirectFB_ReshowCursor(_this, 1); */
break;
default:
;
}
} else
printf("Event Clazz %d\n", evt->clazz);
}
static void
Aug 16, 2010
Aug 16, 2010
308
ProcessInputEvent(_THIS, DFBInputEvent * ievt)
Jan 11, 2009
Jan 11, 2009
309
310
{
SDL_DFB_DEVICEDATA(_this);
Feb 7, 2011
Feb 7, 2011
311
SDL_Keysym keysym;
Jan 11, 2009
Jan 11, 2009
312
int kbd_idx;
Feb 6, 2011
Feb 6, 2011
313
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
Jan 11, 2009
Jan 11, 2009
314
315
316
if (!devdata->use_linux_input) {
if (ievt->type == DIET_AXISMOTION) {
Aug 16, 2010
Aug 16, 2010
317
if ((devdata->grabbed_window != NULL) && (ievt->flags & DIEF_AXISREL)) {
Jan 11, 2009
Jan 11, 2009
318
if (ievt->axis == DIAI_X)
Aug 16, 2010
Aug 16, 2010
319
SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1,
Jan 11, 2009
Jan 11, 2009
320
321
ievt->axisrel, 0, 0);
else if (ievt->axis == DIAI_Y)
Aug 16, 2010
Aug 16, 2010
322
SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1, 0,
Jan 11, 2009
Jan 11, 2009
323
324
325
326
327
328
329
330
331
332
333
334
335
336
ievt->axisrel, 0);
}
}
} else {
static int last_x, last_y;
switch (ievt->type) {
case DIET_AXISMOTION:
if (ievt->flags & DIEF_AXISABS) {
if (ievt->axis == DIAI_X)
last_x = ievt->axisabs;
else if (ievt->axis == DIAI_Y)
last_y = ievt->axisabs;
if (!(ievt->flags & DIEF_FOLLOW)) {
Aug 16, 2010
Aug 16, 2010
337
#if USE_MULTI_API
Jan 11, 2009
Jan 11, 2009
338
339
SDL_Mouse *mouse = SDL_GetMouse(ievt->device_id);
SDL_Window *window = SDL_GetWindowFromID(mouse->focus);
Aug 16, 2010
Aug 16, 2010
340
341
342
#else
SDL_Window *window = devdata->grabbed_window;
#endif
Jan 11, 2009
Jan 11, 2009
343
344
345
346
347
if (window) {
DFB_WindowData *windata =
(DFB_WindowData *) window->driverdata;
int x, y;
Feb 6, 2011
Feb 6, 2011
348
windata->dfbwin->GetPosition(windata->dfbwin, &x, &y);
Aug 16, 2010
Aug 16, 2010
349
SDL_SendMouseMotion_ex(window, ievt->device_id, 0,
Jan 11, 2009
Jan 11, 2009
350
351
352
353
354
last_x - (x +
windata->client.x),
last_y - (y +
windata->client.y), 0);
} else {
Aug 16, 2010
Aug 16, 2010
355
SDL_SendMouseMotion_ex(window, ievt->device_id, 0, last_x,
Jan 11, 2009
Jan 11, 2009
356
357
358
359
360
last_y, 0);
}
}
} else if (ievt->flags & DIEF_AXISREL) {
if (ievt->axis == DIAI_X)
Aug 16, 2010
Aug 16, 2010
361
SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1,
Jan 11, 2009
Jan 11, 2009
362
363
ievt->axisrel, 0, 0);
else if (ievt->axis == DIAI_Y)
Aug 16, 2010
Aug 16, 2010
364
SDL_SendMouseMotion_ex(devdata->grabbed_window, ievt->device_id, 1, 0,
Jan 11, 2009
Jan 11, 2009
365
366
367
368
369
ievt->axisrel, 0);
}
break;
case DIET_KEYPRESS:
kbd_idx = KbdIndex(_this, ievt->device_id);
Feb 6, 2011
Feb 6, 2011
370
371
DirectFB_TranslateKeyInputEvent(_this, ievt, &keysym);
//printf("Scancode %d %d %d\n", keysym.scancode, evt->key_code, evt->key_id);
Jul 24, 2010
Jul 24, 2010
372
SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode);
Jan 11, 2009
Jan 11, 2009
373
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
Feb 6, 2011
Feb 6, 2011
374
375
SDL_zero(text);
UnicodeToUtf8(keysym.unicode, text);
Jan 11, 2009
Jan 11, 2009
376
if (*text) {
Jul 24, 2010
Jul 24, 2010
377
SDL_SendKeyboardText_ex(kbd_idx, text);
Jan 11, 2009
Jan 11, 2009
378
379
380
381
382
}
}
break;
case DIET_KEYRELEASE:
kbd_idx = KbdIndex(_this, ievt->device_id);
Feb 6, 2011
Feb 6, 2011
383
DirectFB_TranslateKeyInputEvent(_this, ievt, &keysym);
Aug 16, 2010
Aug 16, 2010
384
SDL_SendKeyboardKey_ex(kbd_idx, SDL_RELEASED, keysym.scancode);
Jan 11, 2009
Jan 11, 2009
385
386
387
break;
case DIET_BUTTONPRESS:
if (ievt->buttons & DIBM_LEFT)
Aug 16, 2010
Aug 16, 2010
388
SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 1);
Jan 11, 2009
Jan 11, 2009
389
if (ievt->buttons & DIBM_MIDDLE)
Aug 16, 2010
Aug 16, 2010
390
SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 2);
Jan 11, 2009
Jan 11, 2009
391
if (ievt->buttons & DIBM_RIGHT)
Aug 16, 2010
Aug 16, 2010
392
SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_PRESSED, 3);
Jan 11, 2009
Jan 11, 2009
393
394
395
break;
case DIET_BUTTONRELEASE:
if (!(ievt->buttons & DIBM_LEFT))
Aug 16, 2010
Aug 16, 2010
396
SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 1);
Jan 11, 2009
Jan 11, 2009
397
if (!(ievt->buttons & DIBM_MIDDLE))
Aug 16, 2010
Aug 16, 2010
398
SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 2);
Jan 11, 2009
Jan 11, 2009
399
if (!(ievt->buttons & DIBM_RIGHT))
Aug 16, 2010
Aug 16, 2010
400
SDL_SendMouseButton_ex(devdata->grabbed_window, ievt->device_id, SDL_RELEASED, 3);
Jan 11, 2009
Jan 11, 2009
401
402
403
404
405
406
407
break;
default:
break; /* please gcc */
}
}
}
Jul 10, 2006
Jul 10, 2006
408
void
Aug 11, 2007
Aug 11, 2007
409
DirectFB_PumpEventsWindow(_THIS)
Aug 11, 2007
Aug 11, 2007
411
SDL_DFB_DEVICEDATA(_this);
Aug 31, 2008
Aug 31, 2008
412
DFBInputEvent ievt;
Feb 6, 2011
Feb 6, 2011
413
SDL_Window *w;
Aug 31, 2008
Aug 31, 2008
414
Feb 6, 2011
Feb 6, 2011
415
416
for (w = devdata->firstwin; w != NULL; w = w->next) {
SDL_DFB_WINDOWDATA(w);
Dec 8, 2008
Dec 8, 2008
417
DFBWindowEvent evt;
Aug 31, 2008
Aug 31, 2008
418
Feb 6, 2011
Feb 6, 2011
419
while (windata->eventbuffer->GetEvent(windata->eventbuffer,
Aug 11, 2007
Aug 11, 2007
420
DFB_EVENT(&evt)) == DFB_OK) {
Feb 6, 2011
Feb 6, 2011
421
422
423
424
425
426
427
428
429
430
431
if (!DirectFB_WM_ProcessEvent(_this, w, &evt)) {
/* Send a SDL_SYSWMEVENT if the application wants them */
if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;
SDL_VERSION(&wmmsg.version);
wmmsg.subsystem = SDL_SYSWM_DIRECTFB;
wmmsg.msg.dfb.event.window = evt;
SDL_SendSysWMEvent(&wmmsg);
}
ProcessWindowEvent(_this, w, &evt);
}
Aug 31, 2008
Aug 31, 2008
432
433
434
435
436
437
}
}
/* Now get relative events in case we need them */
while (devdata->events->GetEvent(devdata->events,
DFB_EVENT(&ievt)) == DFB_OK) {
Feb 6, 2011
Feb 6, 2011
438
439
440
441
442
443
444
445
if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;
SDL_VERSION(&wmmsg.version);
wmmsg.subsystem = SDL_SYSWM_DIRECTFB;
wmmsg.msg.dfb.event.input = ievt;
SDL_SendSysWMEvent(&wmmsg);
}
Aug 16, 2010
Aug 16, 2010
446
ProcessInputEvent(_this, &ievt);
Jul 10, 2006
Jul 10, 2006
450
void
Feb 7, 2011
Feb 7, 2011
451
DirectFB_InitOSKeymap(_THIS, SDL_Scancode * keymap, int numkeys)
Jul 10, 2006
Jul 10, 2006
453
454
455
int i;
/* Initialize the DirectFB key translation table */
Dec 8, 2008
Dec 8, 2008
456
for (i = 0; i < numkeys; ++i)
Aug 26, 2008
Aug 26, 2008
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
keymap[i] = SDL_SCANCODE_UNKNOWN;
keymap[DIKI_A - DIKI_UNKNOWN] = SDL_SCANCODE_A;
keymap[DIKI_B - DIKI_UNKNOWN] = SDL_SCANCODE_B;
keymap[DIKI_C - DIKI_UNKNOWN] = SDL_SCANCODE_C;
keymap[DIKI_D - DIKI_UNKNOWN] = SDL_SCANCODE_D;
keymap[DIKI_E - DIKI_UNKNOWN] = SDL_SCANCODE_E;
keymap[DIKI_F - DIKI_UNKNOWN] = SDL_SCANCODE_F;
keymap[DIKI_G - DIKI_UNKNOWN] = SDL_SCANCODE_G;
keymap[DIKI_H - DIKI_UNKNOWN] = SDL_SCANCODE_H;
keymap[DIKI_I - DIKI_UNKNOWN] = SDL_SCANCODE_I;
keymap[DIKI_J - DIKI_UNKNOWN] = SDL_SCANCODE_J;
keymap[DIKI_K - DIKI_UNKNOWN] = SDL_SCANCODE_K;
keymap[DIKI_L - DIKI_UNKNOWN] = SDL_SCANCODE_L;
keymap[DIKI_M - DIKI_UNKNOWN] = SDL_SCANCODE_M;
keymap[DIKI_N - DIKI_UNKNOWN] = SDL_SCANCODE_N;
keymap[DIKI_O - DIKI_UNKNOWN] = SDL_SCANCODE_O;
keymap[DIKI_P - DIKI_UNKNOWN] = SDL_SCANCODE_P;
keymap[DIKI_Q - DIKI_UNKNOWN] = SDL_SCANCODE_Q;
keymap[DIKI_R - DIKI_UNKNOWN] = SDL_SCANCODE_R;
keymap[DIKI_S - DIKI_UNKNOWN] = SDL_SCANCODE_S;
keymap[DIKI_T - DIKI_UNKNOWN] = SDL_SCANCODE_T;
keymap[DIKI_U - DIKI_UNKNOWN] = SDL_SCANCODE_U;
keymap[DIKI_V - DIKI_UNKNOWN] = SDL_SCANCODE_V;
keymap[DIKI_W - DIKI_UNKNOWN] = SDL_SCANCODE_W;
keymap[DIKI_X - DIKI_UNKNOWN] = SDL_SCANCODE_X;
keymap[DIKI_Y - DIKI_UNKNOWN] = SDL_SCANCODE_Y;
keymap[DIKI_Z - DIKI_UNKNOWN] = SDL_SCANCODE_Z;
keymap[DIKI_0 - DIKI_UNKNOWN] = SDL_SCANCODE_0;
keymap[DIKI_1 - DIKI_UNKNOWN] = SDL_SCANCODE_1;
keymap[DIKI_2 - DIKI_UNKNOWN] = SDL_SCANCODE_2;
keymap[DIKI_3 - DIKI_UNKNOWN] = SDL_SCANCODE_3;
keymap[DIKI_4 - DIKI_UNKNOWN] = SDL_SCANCODE_4;
keymap[DIKI_5 - DIKI_UNKNOWN] = SDL_SCANCODE_5;
keymap[DIKI_6 - DIKI_UNKNOWN] = SDL_SCANCODE_6;
keymap[DIKI_7 - DIKI_UNKNOWN] = SDL_SCANCODE_7;
keymap[DIKI_8 - DIKI_UNKNOWN] = SDL_SCANCODE_8;
keymap[DIKI_9 - DIKI_UNKNOWN] = SDL_SCANCODE_9;
keymap[DIKI_F1 - DIKI_UNKNOWN] = SDL_SCANCODE_F1;
keymap[DIKI_F2 - DIKI_UNKNOWN] = SDL_SCANCODE_F2;
keymap[DIKI_F3 - DIKI_UNKNOWN] = SDL_SCANCODE_F3;
keymap[DIKI_F4 - DIKI_UNKNOWN] = SDL_SCANCODE_F4;
keymap[DIKI_F5 - DIKI_UNKNOWN] = SDL_SCANCODE_F5;
keymap[DIKI_F6 - DIKI_UNKNOWN] = SDL_SCANCODE_F6;
keymap[DIKI_F7 - DIKI_UNKNOWN] = SDL_SCANCODE_F7;
keymap[DIKI_F8 - DIKI_UNKNOWN] = SDL_SCANCODE_F8;
keymap[DIKI_F9 - DIKI_UNKNOWN] = SDL_SCANCODE_F9;
keymap[DIKI_F10 - DIKI_UNKNOWN] = SDL_SCANCODE_F10;
keymap[DIKI_F11 - DIKI_UNKNOWN] = SDL_SCANCODE_F11;
keymap[DIKI_F12 - DIKI_UNKNOWN] = SDL_SCANCODE_F12;
keymap[DIKI_ESCAPE - DIKI_UNKNOWN] = SDL_SCANCODE_ESCAPE;
keymap[DIKI_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_LEFT;
keymap[DIKI_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_RIGHT;
keymap[DIKI_UP - DIKI_UNKNOWN] = SDL_SCANCODE_UP;
keymap[DIKI_DOWN - DIKI_UNKNOWN] = SDL_SCANCODE_DOWN;
keymap[DIKI_CONTROL_L - DIKI_UNKNOWN] = SDL_SCANCODE_LCTRL;
keymap[DIKI_CONTROL_R - DIKI_UNKNOWN] = SDL_SCANCODE_RCTRL;
keymap[DIKI_SHIFT_L - DIKI_UNKNOWN] = SDL_SCANCODE_LSHIFT;
keymap[DIKI_SHIFT_R - DIKI_UNKNOWN] = SDL_SCANCODE_RSHIFT;
keymap[DIKI_ALT_L - DIKI_UNKNOWN] = SDL_SCANCODE_LALT;
keymap[DIKI_ALT_R - DIKI_UNKNOWN] = SDL_SCANCODE_RALT;
keymap[DIKI_META_L - DIKI_UNKNOWN] = SDL_SCANCODE_LGUI;
keymap[DIKI_META_R - DIKI_UNKNOWN] = SDL_SCANCODE_RGUI;
keymap[DIKI_SUPER_L - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
keymap[DIKI_SUPER_R - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
Aug 31, 2008
Aug 31, 2008
525
526
527
528
/* FIXME:Do we read hyper keys ?
* keymap[DIKI_HYPER_L - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
* keymap[DIKI_HYPER_R - DIKI_UNKNOWN] = SDL_SCANCODE_APPLICATION;
*/
Aug 26, 2008
Aug 26, 2008
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
keymap[DIKI_TAB - DIKI_UNKNOWN] = SDL_SCANCODE_TAB;
keymap[DIKI_ENTER - DIKI_UNKNOWN] = SDL_SCANCODE_RETURN;
keymap[DIKI_SPACE - DIKI_UNKNOWN] = SDL_SCANCODE_SPACE;
keymap[DIKI_BACKSPACE - DIKI_UNKNOWN] = SDL_SCANCODE_BACKSPACE;
keymap[DIKI_INSERT - DIKI_UNKNOWN] = SDL_SCANCODE_INSERT;
keymap[DIKI_DELETE - DIKI_UNKNOWN] = SDL_SCANCODE_DELETE;
keymap[DIKI_HOME - DIKI_UNKNOWN] = SDL_SCANCODE_HOME;
keymap[DIKI_END - DIKI_UNKNOWN] = SDL_SCANCODE_END;
keymap[DIKI_PAGE_UP - DIKI_UNKNOWN] = SDL_SCANCODE_PAGEUP;
keymap[DIKI_PAGE_DOWN - DIKI_UNKNOWN] = SDL_SCANCODE_PAGEDOWN;
keymap[DIKI_CAPS_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_CAPSLOCK;
keymap[DIKI_NUM_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_NUMLOCKCLEAR;
keymap[DIKI_SCROLL_LOCK - DIKI_UNKNOWN] = SDL_SCANCODE_SCROLLLOCK;
keymap[DIKI_PRINT - DIKI_UNKNOWN] = SDL_SCANCODE_PRINTSCREEN;
keymap[DIKI_PAUSE - DIKI_UNKNOWN] = SDL_SCANCODE_PAUSE;
keymap[DIKI_KP_EQUAL - DIKI_UNKNOWN] = SDL_SCANCODE_KP_EQUALS;
keymap[DIKI_KP_DECIMAL - DIKI_UNKNOWN] = SDL_SCANCODE_KP_PERIOD;
keymap[DIKI_KP_0 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_0;
keymap[DIKI_KP_1 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_1;
keymap[DIKI_KP_2 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_2;
keymap[DIKI_KP_3 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_3;
keymap[DIKI_KP_4 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_4;
keymap[DIKI_KP_5 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_5;
keymap[DIKI_KP_6 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_6;
keymap[DIKI_KP_7 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_7;
keymap[DIKI_KP_8 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_8;
keymap[DIKI_KP_9 - DIKI_UNKNOWN] = SDL_SCANCODE_KP_9;
keymap[DIKI_KP_DIV - DIKI_UNKNOWN] = SDL_SCANCODE_KP_DIVIDE;
keymap[DIKI_KP_MULT - DIKI_UNKNOWN] = SDL_SCANCODE_KP_MULTIPLY;
keymap[DIKI_KP_MINUS - DIKI_UNKNOWN] = SDL_SCANCODE_KP_MINUS;
keymap[DIKI_KP_PLUS - DIKI_UNKNOWN] = SDL_SCANCODE_KP_PLUS;
keymap[DIKI_KP_ENTER - DIKI_UNKNOWN] = SDL_SCANCODE_KP_ENTER;
keymap[DIKI_QUOTE_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_GRAVE; /* TLDE */
keymap[DIKI_MINUS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_MINUS; /* AE11 */
keymap[DIKI_EQUALS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_EQUALS; /* AE12 */
keymap[DIKI_BRACKET_LEFT - DIKI_UNKNOWN] = SDL_SCANCODE_RIGHTBRACKET; /* AD11 */
keymap[DIKI_BRACKET_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_LEFTBRACKET; /* AD12 */
keymap[DIKI_BACKSLASH - DIKI_UNKNOWN] = SDL_SCANCODE_BACKSLASH; /* BKSL */
keymap[DIKI_SEMICOLON - DIKI_UNKNOWN] = SDL_SCANCODE_SEMICOLON; /* AC10 */
keymap[DIKI_QUOTE_RIGHT - DIKI_UNKNOWN] = SDL_SCANCODE_APOSTROPHE; /* AC11 */
keymap[DIKI_COMMA - DIKI_UNKNOWN] = SDL_SCANCODE_COMMA; /* AB08 */
keymap[DIKI_PERIOD - DIKI_UNKNOWN] = SDL_SCANCODE_PERIOD; /* AB09 */
keymap[DIKI_SLASH - DIKI_UNKNOWN] = SDL_SCANCODE_SLASH; /* AB10 */
keymap[DIKI_LESS_SIGN - DIKI_UNKNOWN] = SDL_SCANCODE_NONUSBACKSLASH; /* 103rd */
Aug 11, 2007
Aug 11, 2007
576
}
Feb 7, 2011
Feb 7, 2011
578
579
static SDL_Keysym *
DirectFB_TranslateKey(_THIS, DFBWindowEvent * evt, SDL_Keysym * keysym)
Aug 26, 2008
Aug 26, 2008
581
SDL_DFB_DEVICEDATA(_this);
Feb 6, 2011
Feb 6, 2011
582
583
int kbd_idx = 0; /* Window events lag the device source KbdIndex(_this, evt->device_id); */
DFB_KeyboardData *kbd = &devdata->keyboard[kbd_idx];
Aug 11, 2007
Aug 11, 2007
584
Feb 6, 2011
Feb 6, 2011
585
586
587
588
589
keysym->scancode = SDL_SCANCODE_UNKNOWN;
if (kbd->map && evt->key_code >= kbd->map_adjust &&
evt->key_code < kbd->map_size + kbd->map_adjust)
keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
Aug 11, 2007
Aug 11, 2007
590
Jan 11, 2009
Jan 11, 2009
591
if (keysym->scancode == SDL_SCANCODE_UNKNOWN ||
Feb 6, 2011
Feb 6, 2011
592
devdata->keyboard[kbd_idx].is_generic) {
Dec 8, 2008
Dec 8, 2008
593
594
if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
Aug 26, 2008
Aug 26, 2008
595
596
597
else
keysym->scancode = SDL_SCANCODE_UNKNOWN;
}
Jul 10, 2006
Jul 10, 2006
598
Aug 26, 2008
Aug 26, 2008
599
600
keysym->unicode =
(DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
Jan 11, 2009
Jan 11, 2009
601
602
if (keysym->unicode == 0 &&
(evt->key_symbol > 0 && evt->key_symbol < 255))
Aug 26, 2008
Aug 26, 2008
603
keysym->unicode = evt->key_symbol;
Jul 10, 2006
Jul 10, 2006
604
605
return keysym;
Feb 7, 2011
Feb 7, 2011
608
static SDL_Keysym *
Feb 6, 2011
Feb 6, 2011
609
DirectFB_TranslateKeyInputEvent(_THIS, DFBInputEvent * evt,
Feb 7, 2011
Feb 7, 2011
610
SDL_Keysym * keysym)
Dec 8, 2008
Dec 8, 2008
611
612
{
SDL_DFB_DEVICEDATA(_this);
Feb 6, 2011
Feb 6, 2011
613
614
int kbd_idx = KbdIndex(_this, evt->device_id);
DFB_KeyboardData *kbd = &devdata->keyboard[kbd_idx];
Dec 8, 2008
Dec 8, 2008
615
Feb 6, 2011
Feb 6, 2011
616
keysym->scancode = SDL_SCANCODE_UNKNOWN;
Dec 8, 2008
Dec 8, 2008
617
Feb 6, 2011
Feb 6, 2011
618
619
620
621
622
if (kbd->map && evt->key_code >= kbd->map_adjust &&
evt->key_code < kbd->map_size + kbd->map_adjust)
keysym->scancode = kbd->map[evt->key_code - kbd->map_adjust];
if (keysym->scancode == SDL_SCANCODE_UNKNOWN || devdata->keyboard[kbd_idx].is_generic) {
Dec 8, 2008
Dec 8, 2008
623
624
625
626
627
628
629
630
if (evt->key_id - DIKI_UNKNOWN < SDL_arraysize(oskeymap))
keysym->scancode = oskeymap[evt->key_id - DIKI_UNKNOWN];
else
keysym->scancode = SDL_SCANCODE_UNKNOWN;
}
keysym->unicode =
(DFB_KEY_TYPE(evt->key_symbol) == DIKT_UNICODE) ? evt->key_symbol : 0;
Jan 11, 2009
Jan 11, 2009
631
632
if (keysym->unicode == 0 &&
(evt->key_symbol > 0 && evt->key_symbol < 255))
Dec 8, 2008
Dec 8, 2008
633
634
635
636
keysym->unicode = evt->key_symbol;
return keysym;
}
Jan 11, 2009
Jan 11, 2009
637
Jul 10, 2006
Jul 10, 2006
638
static int
Aug 11, 2007
Aug 11, 2007
639
DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button)
Aug 11, 2007
Aug 11, 2007
641
switch (button) {
642
case DIBI_LEFT:
Jul 10, 2006
Jul 10, 2006
643
return 1;
644
case DIBI_MIDDLE:
Jul 10, 2006
Jul 10, 2006
645
return 2;
646
case DIBI_RIGHT:
Jul 10, 2006
Jul 10, 2006
647
return 3;
Jul 10, 2006
Jul 10, 2006
649
return 0;
Jul 10, 2006
Jul 10, 2006
652
Aug 26, 2008
Aug 26, 2008
653
static DFBEnumerationResult
Aug 16, 2010
Aug 16, 2010
654
EnumKeyboards(DFBInputDeviceID device_id,
Jan 11, 2009
Jan 11, 2009
655
DFBInputDeviceDescription desc, void *callbackdata)
Aug 26, 2008
Aug 26, 2008
656
{
Aug 16, 2010
Aug 16, 2010
657
658
cb_data *cb = callbackdata;
DFB_DeviceData *devdata = cb->devdata;
Jul 24, 2010
Jul 24, 2010
659
#if USE_MULTI_API
Aug 26, 2008
Aug 26, 2008
660
SDL_Keyboard keyboard;
Jul 24, 2010
Jul 24, 2010
661
#endif
Feb 7, 2011
Feb 7, 2011
662
SDL_Keycode keymap[SDL_NUM_SCANCODES];
Aug 26, 2008
Aug 26, 2008
663
Aug 16, 2010
Aug 16, 2010
664
665
666
667
668
669
670
671
672
673
674
675
676
677
if (!cb->sys_kbd) {
if (cb->sys_ids) {
if (device_id >= 0x10)
return DFENUM_OK;
} else {
if (device_id < 0x10)
return DFENUM_OK;
}
} else {
if (device_id != DIDID_KEYBOARD)
return DFENUM_OK;
}
if ((desc.caps & DIDTF_KEYBOARD)) {
Jul 24, 2010
Jul 24, 2010
678
#if USE_MULTI_API
Aug 26, 2008
Aug 26, 2008
679
SDL_zero(keyboard);
Aug 16, 2010
Aug 16, 2010
680
SDL_AddKeyboard(&keyboard, devdata->num_keyboard);
Jul 24, 2010
Jul 24, 2010
681
#endif
Aug 16, 2010
Aug 16, 2010
682
683
devdata->keyboard[devdata->num_keyboard].id = device_id;
devdata->keyboard[devdata->num_keyboard].is_generic = 0;
Aug 26, 2008
Aug 26, 2008
684
if (!strncmp("X11", desc.name, 3))
Feb 6, 2011
Feb 6, 2011
685
686
687
688
689
690
691
692
693
{
devdata->keyboard[devdata->num_keyboard].map = xfree86_scancode_table2;
devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(xfree86_scancode_table2);
devdata->keyboard[devdata->num_keyboard].map_adjust = 8;
} else {
devdata->keyboard[devdata->num_keyboard].map = linux_scancode_table;
devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(linux_scancode_table);
devdata->keyboard[devdata->num_keyboard].map_adjust = 0;
}
Aug 26, 2008
Aug 26, 2008
694
Feb 6, 2011
Feb 6, 2011
695
696
SDL_DFB_LOG("Keyboard %d - %s\n", device_id, desc.name);
Aug 26, 2008
Aug 26, 2008
697
SDL_GetDefaultKeymap(keymap);
Jul 24, 2010
Jul 24, 2010
698
#if USE_MULTI_API
Aug 16, 2010
Aug 16, 2010
699
SDL_SetKeymap(devdata->num_keyboard, 0, keymap, SDL_NUM_SCANCODES);
Jul 24, 2010
Jul 24, 2010
700
701
702
#else
SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
#endif
Dec 8, 2008
Dec 8, 2008
703
704
devdata->num_keyboard++;
Aug 16, 2010
Aug 16, 2010
705
706
if (cb->sys_kbd)
return DFENUM_CANCEL;
Dec 8, 2008
Dec 8, 2008
707
708
}
return DFENUM_OK;
Aug 26, 2008
Aug 26, 2008
709
710
711
712
713
714
}
void
DirectFB_InitKeyboard(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
Aug 16, 2010
Aug 16, 2010
715
716
cb_data cb;
Dec 8, 2008
Dec 8, 2008
717
718
719
DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap));
devdata->num_keyboard = 0;
Aug 16, 2010
Aug 16, 2010
720
721
cb.devdata = devdata;
Jan 4, 2009
Jan 4, 2009
722
if (devdata->use_linux_input) {
Aug 16, 2010
Aug 16, 2010
723
724
cb.sys_kbd = 0;
cb.sys_ids = 0;
Jan 10, 2009
Jan 10, 2009
725
SDL_DFB_CHECK(devdata->dfb->
Aug 16, 2010
Aug 16, 2010
726
EnumInputDevices(devdata->dfb, EnumKeyboards, &cb));
Dec 8, 2008
Dec 8, 2008
727
if (devdata->num_keyboard == 0) {
Aug 16, 2010
Aug 16, 2010
728
cb.sys_ids = 1;
Jan 11, 2009
Jan 11, 2009
729
730
SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
EnumKeyboards,
Aug 16, 2010
Aug 16, 2010
731
&cb));
Dec 8, 2008
Dec 8, 2008
732
}
Aug 16, 2010
Aug 16, 2010
733
734
} else {
cb.sys_kbd = 1;
Jan 11, 2009
Jan 11, 2009
735
SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
Aug 16, 2010
Aug 16, 2010
736
737
EnumKeyboards,
&cb));
Dec 8, 2008
Dec 8, 2008
738
}
Aug 26, 2008
Aug 26, 2008
739
740
}
Aug 31, 2008
Aug 31, 2008
741
742
743
void
DirectFB_QuitKeyboard(_THIS)
{
Aug 16, 2010
Aug 16, 2010
744
//SDL_DFB_DEVICEDATA(_this);
Aug 31, 2008
Aug 31, 2008
745
Dec 8, 2008
Dec 8, 2008
746
SDL_KeyboardQuit();
Aug 31, 2008
Aug 31, 2008
747
748
}