comparison 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
comparison
equal deleted inserted replaced
2299:a7cbc25071b6 2300:c97ad1abe05b
165 break; 165 break;
166 166
167 /* Key press? */ 167 /* Key press? */
168 case KeyPress:{ 168 case KeyPress:{
169 KeyCode keycode = xevent.xkey.keycode; 169 KeyCode keycode = xevent.xkey.keycode;
170 KeySym keysym = NoSymbol;
171 char text[sizeof(SDL_TEXTINPUTEVENT_TEXT_SIZE)];
172 Uint32 ucs4 = 0;
170 173
171 #ifdef DEBUG_XEVENTS 174 #ifdef DEBUG_XEVENTS
172 printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); 175 printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
173 #endif 176 #endif
174 SDLKey physicalKey = videodata->keyCodeToSDLKTable[keycode]; 177 SDLKey physicalKey = videodata->keyCodeToSDLKTable[keycode];
181 (int) keycode, 184 (int) keycode,
182 (unsigned int) XKeycodeToKeysym(videodata->display, 185 (unsigned int) XKeycodeToKeysym(videodata->display,
183 keycode, 0)); 186 keycode, 0));
184 } 187 }
185 #endif 188 #endif
189 /* works for Latin-1 */
190 SDL_memset(&text[0], 0, SDL_TEXTINPUTEVENT_TEXT_SIZE);
191 /* Xutf8LookupString() */
192 XLookupString(&xevent, text, sizeof(text), &keysym, NULL);
193 if (0 != SDL_strlen(text)) {
194 SDL_SendKeyboardText(videodata->keyboard, text);
195 }
186 } 196 }
187 break; 197 break;
188 198
189 /* Key release? */ 199 /* Key release? */
190 case KeyRelease:{ 200 case KeyRelease:{