annotate src/video/directfb/SDL_DirectFB_events.c @ 382:74bdcae44bf5

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.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 29 May 2002 20:47:19 +0000
parents f6ffac90895c
children 276d0d7ba96c
rev   line source
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
297
f6ffac90895c Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents: 286
diff changeset
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Library General Public License for more details.
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 167
diff changeset
20 slouken@libsdl.org
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #ifdef SAVE_RCSID
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 static char rcsid =
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 "@(#) $Id$";
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #endif
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 /* Handle the event stream, converting DirectFB input events into SDL events */
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include <sys/types.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include <sys/time.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include <stdlib.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include <stdio.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include <unistd.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <fcntl.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #include <termios.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 #include <directfb.h>
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 #include "SDL.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 #include "SDL_sysevents.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 #include "SDL_sysvideo.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #include "SDL_events_c.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 #include "SDL_DirectFB_video.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #include "SDL_DirectFB_events.h"
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 /* The translation tables from a DirectFB keycode to a SDL keysym */
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 static SDLKey keymap[256];
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 static SDL_keysym *DirectFB_TranslateKey (DFBInputEvent *ev, SDL_keysym *keysym);
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 static int DirectFB_TranslateButton (DFBInputEvent *ev);
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 static int posted = 0;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 void DirectFB_PumpEvents (_THIS)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 DFBInputEvent evt;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
286
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
59 while (HIDDEN->eventbuffer->GetEvent (HIDDEN->eventbuffer,
3ea69fd0b095 Updated for DirectFB 0.9.9
Sam Lantinga <slouken@libsdl.org>
parents: 252
diff changeset
60 DFB_EVENT (&evt)) == DFB_OK)
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 SDL_keysym keysym;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 switch (evt.type)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 case DIET_BUTTONPRESS:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 posted += SDL_PrivateMouseButton(SDL_PRESSED,
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 DirectFB_TranslateButton (&evt), 0, 0);
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 break;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 case DIET_BUTTONRELEASE:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 posted += SDL_PrivateMouseButton(SDL_RELEASED,
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 DirectFB_TranslateButton (&evt), 0, 0);
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 break;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 case DIET_KEYPRESS:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 posted += SDL_PrivateKeyboard(SDL_PRESSED, DirectFB_TranslateKey(&evt, &keysym));
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 break;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 case DIET_KEYRELEASE:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 posted += SDL_PrivateKeyboard(SDL_RELEASED, DirectFB_TranslateKey(&evt, &keysym));
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 break;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 case DIET_AXISMOTION:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 if (evt.flags & DIEF_AXISREL)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 if (evt.axis == DIAI_X)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 posted += SDL_PrivateMouseMotion(0, 1, evt.axisrel, 0);
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 else if (evt.axis == DIAI_Y)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 posted += SDL_PrivateMouseMotion(0, 1, 0, evt.axisrel);
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 break;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 default:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 ;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 void DirectFB_InitOSKeymap (_THIS)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 int i;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 /* Initialize the DirectFB key translation table */
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 for (i=0; i<SDL_TABLESIZE(keymap); ++i)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 keymap[i] = SDLK_UNKNOWN;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
382
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
103 keymap[DIKI_A] = SDLK_a;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
104 keymap[DIKI_B] = SDLK_b;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
105 keymap[DIKI_C] = SDLK_c;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
106 keymap[DIKI_D] = SDLK_d;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
107 keymap[DIKI_E] = SDLK_e;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
108 keymap[DIKI_F] = SDLK_f;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
109 keymap[DIKI_G] = SDLK_g;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
110 keymap[DIKI_H] = SDLK_h;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
111 keymap[DIKI_I] = SDLK_i;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
112 keymap[DIKI_J] = SDLK_j;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
113 keymap[DIKI_K] = SDLK_k;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
114 keymap[DIKI_L] = SDLK_l;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
115 keymap[DIKI_M] = SDLK_m;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
116 keymap[DIKI_N] = SDLK_n;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
117 keymap[DIKI_O] = SDLK_o;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
118 keymap[DIKI_P] = SDLK_p;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
119 keymap[DIKI_Q] = SDLK_q;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
120 keymap[DIKI_R] = SDLK_r;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
121 keymap[DIKI_S] = SDLK_s;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
122 keymap[DIKI_T] = SDLK_t;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
123 keymap[DIKI_U] = SDLK_u;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
124 keymap[DIKI_V] = SDLK_v;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
125 keymap[DIKI_W] = SDLK_w;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
126 keymap[DIKI_X] = SDLK_x;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
127 keymap[DIKI_Y] = SDLK_y;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
128 keymap[DIKI_Z] = SDLK_z;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
382
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
130 keymap[DIKI_0] = SDLK_0;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
131 keymap[DIKI_1] = SDLK_1;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
132 keymap[DIKI_2] = SDLK_2;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
133 keymap[DIKI_3] = SDLK_3;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
134 keymap[DIKI_4] = SDLK_4;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
135 keymap[DIKI_5] = SDLK_5;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
136 keymap[DIKI_6] = SDLK_6;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
137 keymap[DIKI_7] = SDLK_7;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
138 keymap[DIKI_8] = SDLK_8;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
139 keymap[DIKI_9] = SDLK_9;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140
382
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
141 keymap[DIKI_F1] = SDLK_F1;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
142 keymap[DIKI_F2] = SDLK_F2;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
143 keymap[DIKI_F3] = SDLK_F3;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
144 keymap[DIKI_F4] = SDLK_F4;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
145 keymap[DIKI_F5] = SDLK_F5;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
146 keymap[DIKI_F6] = SDLK_F6;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
147 keymap[DIKI_F7] = SDLK_F7;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
148 keymap[DIKI_F8] = SDLK_F8;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
149 keymap[DIKI_F9] = SDLK_F9;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
150 keymap[DIKI_F10] = SDLK_F10;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
151 keymap[DIKI_F11] = SDLK_F11;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
152 keymap[DIKI_F12] = SDLK_F12;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153
382
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
154 keymap[DIKI_ESCAPE] = SDLK_ESCAPE;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
155 keymap[DIKI_LEFT] = SDLK_LEFT;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
156 keymap[DIKI_RIGHT] = SDLK_RIGHT;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
157 keymap[DIKI_UP] = SDLK_UP;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
158 keymap[DIKI_DOWN] = SDLK_DOWN;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
159 keymap[DIKI_CTRL] = SDLK_LCTRL;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
160 keymap[DIKI_SHIFT] = SDLK_LSHIFT;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
161 keymap[DIKI_ALT] = SDLK_LALT;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
162 keymap[DIKI_ALTGR] = SDLK_RALT;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
163 keymap[DIKI_TAB] = SDLK_TAB;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
164 keymap[DIKI_ENTER] = SDLK_RETURN;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
165 keymap[DIKI_SPACE] = SDLK_SPACE;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
166 keymap[DIKI_BACKSPACE] = SDLK_BACKSPACE;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
167 keymap[DIKI_INSERT] = SDLK_INSERT;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
168 keymap[DIKI_DELETE] = SDLK_DELETE;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
169 keymap[DIKI_HOME] = SDLK_HOME;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
170 keymap[DIKI_END] = SDLK_END;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
171 keymap[DIKI_PAGE_UP] = SDLK_PAGEUP;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
172 keymap[DIKI_PAGE_DOWN] = SDLK_PAGEDOWN;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
173 keymap[DIKI_CAPSLOCK] = SDLK_CAPSLOCK;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
174 keymap[DIKI_NUMLOCK] = SDLK_NUMLOCK;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
175 keymap[DIKI_SCRLOCK] = SDLK_SCROLLOCK;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
176 keymap[DIKI_PRINT] = SDLK_PRINT;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
177 keymap[DIKI_PAUSE] = SDLK_PAUSE;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
178 keymap[DIKI_KP_DIV] = SDLK_KP_DIVIDE;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
179 keymap[DIKI_KP_MULT] = SDLK_KP_MULTIPLY;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
180 keymap[DIKI_KP_MINUS] = SDLK_KP_MINUS;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
181 keymap[DIKI_KP_PLUS] = SDLK_KP_PLUS;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
182 keymap[DIKI_KP_ENTER] = SDLK_KP_ENTER;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 static SDL_keysym *DirectFB_TranslateKey (DFBInputEvent *ev, SDL_keysym *keysym)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 /* Set the keysym information */
382
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
189 keysym->scancode = ev->key_id;
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
190 keysym->mod = KMOD_NONE; /* FIXME */
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
191 keysym->unicode = (DFB_KEY_TYPE (ev->key_symbol) == DIKT_UNICODE) ? ev->key_symbol : 0;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192
382
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
193 if (ev->key_symbol > 0 && ev->key_symbol < 128)
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
194 keysym->sym = ev->key_symbol;
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 else
382
74bdcae44bf5 Date: Wed, 29 May 2002 17:37:19 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
196 keysym->sym = keymap[ev->key_id];
167
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 return keysym;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 static int DirectFB_TranslateButton (DFBInputEvent *ev)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 switch (ev->button)
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 {
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 case DIBI_LEFT:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 return 1;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 case DIBI_MIDDLE:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 return 2;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 case DIBI_RIGHT:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 return 3;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 default:
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 return 0;
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 }
cb384ef627f6 Added support for DirectFB video on Linux (thanks Denis!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 }