Tux Paint, again - Bill Kendrick - Linux Users' Group of Davis - June 18, 2007


Input Method Support

Snippet of Japanese Romanized Hiragana from "ja.im":
3064	tu	-
3064	tsu	-
3065	du	-
3066	te	-
3067	de	-

Complete Input Method files (from May 2007):

  • ja.im (Japanese Romanized Hiragana & Romanized Katakana)
  • ko.im (Korean Hangul 2-Bul)

Snippet of Korean Hangul 2-Bul Event Handler from "im.c":
static int im_event_ko(IM_DATA* im, SDL_keysym ks)
{
  static const char* lang_file = IMDIR "ko.im";
  enum { SEC_ENGLISH, SEC_HANGUL, SEC_TOTAL };

  /* Handle event requests */
  switch(im->request) {

... handlers for:

  • 'IM_REQ_INIT' (load character-map from ".im" file),
  • 'IM_REQ_RESET_FULL' (back to default language/method (English), then do a soft reset),
  • 'IM_REQ_RESET_SOFT' (reset input buffer and all language-specific variables), and
  • 'IM_REQ_FREE' (free loaded character-map)

  }
  
  /* Handle keys */
  switch(ks.sym) {

... handlers for 'IM_REQ_TRANSLATE':

  • character processing (depends on the section language/method; i.e., 'SEC_ENGLISH' or 'SEC_HANGUL', etc.)
  • [Backspace] ('SDLK_BACKSPACE'), and
  • language/method-cycling keys (e.g., 'SDLK_LALT' and 'SDLK_RALT' (left- and right-[Alt] keys)),

  }

  return im->redraw;
}

Full source (as of May 2007) of Input Method code:


Next