Lines 395-400
static int X11_DispatchEvent(_THIS)
Link Here
|
395 |
{ |
395 |
{ |
396 |
int posted; |
396 |
int posted; |
397 |
XEvent xevent; |
397 |
XEvent xevent; |
|
|
398 |
int orig_event_type; |
399 |
KeyCode orig_keycode; |
398 |
|
400 |
|
399 |
SDL_memset(&xevent, '\0', sizeof (XEvent)); /* valgrind fix. --ryan. */ |
401 |
SDL_memset(&xevent, '\0', sizeof (XEvent)); /* valgrind fix. --ryan. */ |
400 |
XNextEvent(SDL_Display, &xevent); |
402 |
XNextEvent(SDL_Display, &xevent); |
Lines 410-418
static int X11_DispatchEvent(_THIS)
Link Here
|
410 |
#ifdef X_HAVE_UTF8_STRING |
412 |
#ifdef X_HAVE_UTF8_STRING |
411 |
/* If we are translating with IM, we need to pass all events |
413 |
/* If we are translating with IM, we need to pass all events |
412 |
to XFilterEvent, and discard those filtered events immediately. */ |
414 |
to XFilterEvent, and discard those filtered events immediately. */ |
|
|
415 |
orig_event_type = xevent.type; |
416 |
if (orig_event_type == KeyPress || orig_event_type == KeyRelease) { |
417 |
orig_keycode = xevent.xkey.keycode; |
418 |
} else { |
419 |
orig_keycode = 0; |
420 |
} |
413 |
if ( SDL_TranslateUNICODE |
421 |
if ( SDL_TranslateUNICODE |
414 |
&& SDL_IM != NULL |
422 |
&& SDL_IM != NULL |
415 |
&& XFilterEvent(&xevent, None) ) { |
423 |
&& XFilterEvent(&xevent, None) ) { |
|
|
424 |
if (orig_keycode) { |
425 |
SDL_keysym keysym; |
426 |
static XComposeStatus state; |
427 |
char keybuf[32]; |
428 |
|
429 |
keysym.scancode = xevent.xkey.keycode; |
430 |
keysym.sym = X11_TranslateKeycode(SDL_Display, xevent.xkey.keycode); |
431 |
keysym.mod = KMOD_NONE; |
432 |
keysym.unicode = 0; |
433 |
if (orig_event_type == KeyPress && XLookupString(&xevent.xkey, keybuf, sizeof(keybuf), NULL, &state)) |
434 |
keysym.unicode = (Uint8)keybuf[0]; |
435 |
|
436 |
SDL_PrivateKeyboard(orig_event_type == KeyPress ? SDL_PRESSED : SDL_RELEASED, &keysym); |
437 |
} |
416 |
return 0; |
438 |
return 0; |
417 |
} |
439 |
} |
418 |
#endif |
440 |
#endif |