comparison src/video/x11/SDL_x11events.c @ 14:c3e9d4a623c1

Fixed stuck keys when changing the video mode
author Sam Lantinga <slouken@lokigames.com>
date Tue, 01 May 2001 21:12:57 +0000
parents 34d956b20f75
children b0ae59d0f3ee
comparison
equal deleted inserted replaced
13:e30a8ce27c22 14:c3e9d4a623c1
51 #include "SDL_x11gamma_c.h" 51 #include "SDL_x11gamma_c.h"
52 #include "SDL_x11wm_c.h" 52 #include "SDL_x11wm_c.h"
53 #include "SDL_x11mouse_c.h" 53 #include "SDL_x11mouse_c.h"
54 #include "SDL_x11events_c.h" 54 #include "SDL_x11events_c.h"
55 55
56
57 /* Define this if you want to debug X11 events */
58 /*#define DEBUG_XEVENTS*/
56 59
57 /* The translation tables from an X11 keysym to a SDL keysym */ 60 /* The translation tables from an X11 keysym to a SDL keysym */
58 static SDLKey ODD_keymap[256]; 61 static SDLKey ODD_keymap[256];
59 static SDLKey MISC_keymap[256]; 62 static SDLKey MISC_keymap[256];
60 SDL_keysym *X11_TranslateKey(Display *display, XKeyEvent *xkey, KeyCode kc, 63 SDL_keysym *X11_TranslateKey(Display *display, XKeyEvent *xkey, KeyCode kc,
217 } 220 }
218 break; 221 break;
219 222
220 /* Generated upon EnterWindow and FocusIn */ 223 /* Generated upon EnterWindow and FocusIn */
221 case KeymapNotify: { 224 case KeymapNotify: {
225 #ifdef DEBUG_XEVENTS
226 printf("KeymapNotify!\n");
227 #endif
222 X11_SetKeyboardState(SDL_Display, xevent.xkeymap.key_vector); 228 X11_SetKeyboardState(SDL_Display, xevent.xkeymap.key_vector);
223 } 229 }
224 break; 230 break;
225 231
226 /* Mouse motion? */ 232 /* Mouse motion? */
261 break; 267 break;
262 268
263 /* Key press? */ 269 /* Key press? */
264 case KeyPress: { 270 case KeyPress: {
265 SDL_keysym keysym; 271 SDL_keysym keysym;
272
273 #ifdef DEBUG_XEVENTS
274 printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
275 #endif
266 posted = SDL_PrivateKeyboard(SDL_PRESSED, 276 posted = SDL_PrivateKeyboard(SDL_PRESSED,
267 X11_TranslateKey(SDL_Display, &xevent.xkey, 277 X11_TranslateKey(SDL_Display, &xevent.xkey,
268 xevent.xkey.keycode, 278 xevent.xkey.keycode,
269 &keysym)); 279 &keysym));
270 } 280 }
272 282
273 /* Key release? */ 283 /* Key release? */
274 case KeyRelease: { 284 case KeyRelease: {
275 SDL_keysym keysym; 285 SDL_keysym keysym;
276 286
287 #ifdef DEBUG_XEVENTS
288 printf("KeyRelease (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
289 #endif
277 /* Check to see if this is a repeated key */ 290 /* Check to see if this is a repeated key */
278 if ( ! X11_KeyRepeat(SDL_Display, &xevent) ) { 291 if ( ! X11_KeyRepeat(SDL_Display, &xevent) ) {
279 posted = SDL_PrivateKeyboard(SDL_RELEASED, 292 posted = SDL_PrivateKeyboard(SDL_RELEASED,
280 X11_TranslateKey(SDL_Display, &xevent.xkey, 293 X11_TranslateKey(SDL_Display, &xevent.xkey,
281 xevent.xkey.keycode, 294 xevent.xkey.keycode,