Mercurial > sdl-ios-xcode
diff src/video/x11/SDL_x11events.c @ 2300:c97ad1abe05b
Minimal implementation of textinput events for x11. It only works for latin-1.
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Tue, 15 Jan 2008 22:37:17 +0000 |
parents | a7cbc25071b6 |
children | fbe8ff44c519 |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c Sat Jan 12 18:07:06 2008 +0000 +++ b/src/video/x11/SDL_x11events.c Tue Jan 15 22:37:17 2008 +0000 @@ -167,6 +167,9 @@ /* Key press? */ case KeyPress:{ KeyCode keycode = xevent.xkey.keycode; + KeySym keysym = NoSymbol; + char text[sizeof(SDL_TEXTINPUTEVENT_TEXT_SIZE)]; + Uint32 ucs4 = 0; #ifdef DEBUG_XEVENTS printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); @@ -183,6 +186,13 @@ keycode, 0)); } #endif + /* works for Latin-1 */ + SDL_memset(&text[0], 0, SDL_TEXTINPUTEVENT_TEXT_SIZE); + /* Xutf8LookupString() */ + XLookupString(&xevent, text, sizeof(text), &keysym, NULL); + if (0 != SDL_strlen(text)) { + SDL_SendKeyboardText(videodata->keyboard, text); + } } break;