Re: [Tuxpaint-devel] SDL_im and tuxpaint-0.9.15b for Windows.
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
|
From: Mark K. K. <mkk...@gm...> - 2006-04-01 01:21:30
|
It's good to see this system work. I only wish we could do this with the standard SDL, without patching. Anyone aware of the status of this patch getting into the main SDL branch? -Mark On Thu, Mar 30, 2006 at 10:11:57AM +0900, Shocky Han wrote: > Hi, >=20 > I and my daughter want to input Korean characters in tuxpaint-0.9.15b f= or > Windows. >=20 > I finally found the SDL_im project which aims to be an Input Method sup= port > in SDL project. > <http://sdl-im.csie.net/> >=20 > I can patch the <http://sdl-im.csie.net/download/SDL_im-1.2.8-20050828.= diff. > gz> files into the current SDL-1.2.9 branch without difficulties. > The major modifications for tuxpaint.c is follows - you will notice you > should define the ENABLE_IM_EVENT first. >=20 > @@ -2777,6 +2793,10 @@ > Uint32 last_cursor_blink, cur_cursor_blink, > pre_event_time, current_event_time; > =20 > +#ifdef ENABLE_IM_EVENT > + wchar_t wbuf[256]; > + int buf_len =3D 0; > +#endif > @@ -2838,7 +2858,14 @@ > { > key =3D event.key.keysym.sym; > mod =3D event.key.keysym.mod; > - =20 > + > +#ifdef ENABLE_IM_EVENT > + SDL_SetIMPosition(cursor_x - 2, cursor_y - 2 + > TTF_FontHeight(getfonthandle(cur_font))); > + if (buf_len =3D SDL_FlushIMString(wbuf)) > + SDL_FlushIMString(wbuf); > + wbuf[buf_len] =3D 0; > +#endif > + > handle_keymouse(key, SDL_KEYDOWN); > =20 > if (key =3D=3D SDLK_ESCAPE && !disable_quit) > @@ -2991,6 +3018,10 @@ > if (cur_tool =3D=3D TOOL_TEXT && > cursor_x !=3D -1 && cursor_y !=3D -1) > { > +#ifdef ENABLE_IM_EVENT > + if (buf_len > 0) > + event.key.keysym.unicode =3D wbuf[0]; > +#endif > key_down =3D key; > key_unicode =3D event.key.keysym.unicode; > =20 > @@ -3004,8 +3035,13 @@ > =20 > if (texttool_len > 0) > { > +#ifdef ENABLE_IM_EVENT > + texttool_len =3D > utf8_remove_last_char(texttool_str, texttool_len); > + texttool_str[texttool_len] =3D '\0'; > +#else > texttool_len--; > texttool_str[texttool_len] =3D '\0'; > +#endif > playsound(0, SND_KEYCLICK, 0); > =20 > do_render_cur_text(0); > @@ -3040,8 +3076,12 @@ > cursor_textwidth =3D 0; > } > } > +#ifdef ENABLE_IM_EVENT > + else //if (isprint(key_unicode)) > +#else > else if (isprint(key_unicode)) > - { > +#endif > + { > if (texttool_len < sizeof(texttool_str) - > MAX_UTF8_CHAR_LENGTH) > { > int old_cursor_textwidth =3D cursor_textwidth; > @@ -3050,9 +3090,18 @@ > "unicode =3D %c (%d)\n\n", > key_down, key_unicode, key_unicode); > #endif > - =20 > + > +#ifdef ENABLE_IM_EVENT > + if (buf_len > 0) { > + texttool_len +=3D > unicode_to_utf8(&texttool_str[texttool_len], key_unicode); > + } else if (key_unicode !=3D 0) { > texttool_str[texttool_len++] =3D key_unicode; > - =09 > + } > +#else > + if (key_unicode !=3D 0) { > + texttool_str[texttool_len++] =3D key_unicode; > + } > +#endif > texttool_str[texttool_len] =3D '\0'; > do_render_cur_text(0); >=20 > Of course, there are unicode_to_utf8() and utf8_remove_last_char() func= tion > implementations. > And I must fix several tuxpaint-0.9.15b source files to build with > Microsoft Visual Studio .Net 2003. >=20 > You can get results in following URL's: > 1. screenshot <http://kldp.org/files/tuxpaint+SDL_im.PNG> > 2. diff source <http://kldp.org/files/tuxpaint-0.9.15b+SDL_im-1.2.9- > 20060329.diff.txt> > 3. Windows XP binary files <http://kldp.org/files/tuxpaint-0.9.15b+SDL_= im-1. > 2.9-20060329.zip> >=20 > I hope this could help people who want to use the Windows IME with tuxp= aint- > 0.9.15b for Windows. >=20 > Best regards. >=20 > PS: I use the Korean font downloaded from the tuxpaint website. >=20 >=20 > =09 > ________________________________________________________ > =EC=95=BC=ED=9B=84! =EB=AA=A8=EB=B0=94=EC=9D=BC - =ED=9C=B4=EB=8C=80=ED= =8F=B0=EC=97=90 =EB=8C=80=ED=95=9C =EB=AA=A8=EB=93=A0 =EC=9E=AC=EB=AF=B8!= =EC=9C=A0=EB=AC=B4=EC=84=A0 =EC=95=BC=ED=9B=84!=EB=AA=A8=EB=B0=94=EC=9D=BC= =EC=9D=84 =EC=A6=90=EA=B8=B0=EC=84=B8=EC=9A=94 > http://kr.mobile.yahoo.com >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > that extends applications into web and mobile media. Attend the live we= bcast > and join the prime developer group breaking into this new coding territ= ory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > Tuxpaint-devel mailing list > Tux...@li... > https://lists.sourceforge.net/lists/listinfo/tuxpaint-devel --=20 Mark K. Kim AIM: markus kimius Homepage: http://www.cbreak.org/ Xanga: http://www.xanga.com/vindaci Cyworld: http://www.cyworld.com/markuskimius Friendster: http://www.friendster.com/user.php?uid=3D13046 PGP key fingerprint: 7324 BACA 53AD E504 A76E 5167 6822 94F0 F298 5DCE PGP key available on the homepage |