This page is a Japanese translation of SDL-IM's web site ( http://sdl-im.csie.net/ ).
このページ は、SDL-IMのウェブサイト(http://sdl-im.csie.net/)の日本語訳です。
SDL -IM自体に関する質問は、オリジナルのサイトを確認の上、そちらによろしくお願いします。
翻訳に関する質問や、日本語での質問は、haramako <at> gmail.com までお願いします。

SDL-IM: IM(Input Method) support in SDL

SDL-IM: SDLからIM(Input Method) を使用する

(update date: 2005/09/02: (訳注:日本語訳は、2007/01/04) )  English Page  TW Big5 Page   CN GB2312 Page

Where can I get necessary files?
you can get SDL-1.2.8 from: http://www.libsdl.org
you can get the patch for SDL-1.2.8 from :
SDL_im-1.2.8-20050828.diff.gz
This is applied with harpy's XIM patch(Thanks harpy!)

必要なものは、どこでダウンロードすればよい?

SDL-1.2.8 : http://www.libsdl.org

SDL-IM の SDL-1.2.8 へのパッチ : SDL_im-1.2.8-20050828.diff.gz

↑これは、すでに harpy's XIM patch があてられています(ありがとう harpy!)

The more supports?(New option pack for SDL-IM)
In order to make games looks more professional, SDL-IM should provide more IM information to help users to draw IM widgets in their game UI. Although SDL-IM provides SDL_GetIMInfo to get the handle and the context of IM server, but I think it may trouble some people.

At the same time, I also hope SDL-IM can keep simple to be suitable with future technology, so I still evaluate this support about more IM information or OnTheSpot mode. If you have any ideas, please mail to me.

*                    *                    *

Now, there is an option pack based on SDL-IM named SDL_imm can solve some parts of  this problem

より細かいIMへの対応は?(SDL-IMの新しいオプションパック)

ゲームの見た目をより プロっぽくするために、SDL-IMは、ゲーム中のIMウィジェットを描画するための情報にアクセスする手段を用意するべきでしょう。SDL-IMは SDL_GetIMInfo()をIMのハンドルやコンテキストを取得するために用意していますが、これは一部の人には煩わしいのではないかと思います。

同時に、SDL-IM は将来のテクノロジーにあわせられるようにシンプルであるべきだと思います。なので、これ以上のIMの情報の取得やOnTheSpotモード(訳注:って なに?)に関しては、まだ評価中です。もしなにかアイデアがあれば、ぜひメールをください。

*                    *                    *

現在、SDL-IMを 基盤とした、SDL_imm というオプションパックによりこの問題の一部を解決されました。


Anything else?
Yes! Here are some samples or libraries applied this patch:
1. GuiChan/SDL-IM by harpy (Thanks harpy!)

2. patch for paraGUI-1.1.8 (update: 2005/02/11)

3. patch for aedGUI-0.1.8a (update: 2005/03/12)

4. a tutorial of i18n support with standard C/C++ and an easy used library ustring which is a template wrapper for std::basic_string. (update: 2005/07/31)

5. patch for OGRE(> 1.0.3) to make it supports i18n (update: 2005/07/30)

Some screenshot or test:

1. showfont.c(included in test.tar.gz) example for SDL_ttf. screenshot.

2. test.tar.gz: simple tests for SDL-IM. (update: 2005/08/28)

The binary package for SDL_im( Development Libraries ):

SDL-devel-1.2.8-VC6.zip (Visual C++ 5,6,7)
SDL-devel-1.2.8-mingw32.tar.gz (Mingw32)

ほかには?

イエス!いくつかのサ ンプルやライブラリが以下にあります。

1. GuiChan/SDL-IM by harpy (Thanks harpy!)

2. patch for paraGUI-1.1.8 (update: 2005/02/11)

3. patch for aedGUI-0.1.8a (update: 2005/03/12)

4. C/C++によるi18n(国際化)のサポートと、簡単に使えるustringライブラリ(std::basic_stringのラッパー)の チュートリアル  (update: 2005/07/31)

5. patch : OGRE(> 1.0.3) の i18n(国際化)のサポートパッチ (update: 2005/07/30)

スクリーンショットと テスト:

1. showfont.c(test.tar.gzに 含まれる) , SDL_ttf を使用した例. screenshot.

2. test.tar.gz: シンプルなテストプログラム for SDL-IM. (update: 2005/08/28)

バイナリパッケージ for SDL_im( Development Libraries )(訳注:リンクがない?):

SDL-devel-1.2.8-VC6.zip (Visual C++ 5,6,7)
SDL-devel-1.2.8-mingw32.tar.gz (Mingw32)

How to apply this patch?
1. download SDL-1.2.8 and decompress it(ex. $tar zxvf SDL-1.2.8.tar.gz).
2. download patch in the SDL-1.2.8 extracted directory and decompress it(ex. $gzip -d SDL_im-1.2.8-20050828.diff.gz).
3. patch this diff file in the SDL-1.2.8 directory(ex. $patch -p1 < SDL_im-1.2.8-20050731.diff).
4. Make sure the pre-processer symbol is defined(ENABLE_IM_EVENT).
5. then, build SDL and enjoy it! :-)
Note: If you use Visual C++ in Win32, using DirectX and adding ENABLE_IM_EVENT define in your Makefile or Project file. If you use automake in Linux, just check “--enable-im-event” and "--enable-directx"
symbols when you command “./configure”.
There are the project files for VC6 and VC7.1: VisualC.zip, VisualC7.zip
There is the DirectX devel source for MinGW to build SDL: http://www.libsdl.org/extras/win32/common/

どうやってパッチを適用するの?

1. SDL-1.2.8 をダウンロードして、解凍します。(例: $tar zxvf SDL-1.2.8.tar.gz).
2. パッチをダウンロードして、SDL-1.2.8を解凍したディレクトリに解凍します。(例: $gzip -d SDL_im-1.2.8-20050828.diff.gz).
3. diff ファイルを
SDL -1.2.8に適 用します。(例: $patch -p1 < SDL_im-1.2.8-20050731.diff).
4. プリプロセッサのマクロ
(ENABLE_IM_EVENT)が定義されているか確認します。(訳注:訳者がここで引っかかったので太 字)
5. SDLをビルドして完了!

注 意: もし、Visual C++(Win32)でビルドするなら、DirectXを使用し(訳注:DIBではなくということかな?)、ENABLE_IM_EVENT の定義をMakefileかプロジェクトファイルに追加してください。もし、Linux上でautoconfでビルドするなら、"--enable-im -event"と"--enable-directx"オプションを"./configure"コマンド時に有効にしてしてください。

VC6 と VC7.1のプロジェクトファイルは、ここにあります。VisualC.zip, VisualC7.zip

MinGW 用のDirectX-develのソースは、ここにあります。 http://www.libsdl.org/extras/win32/common/

What platforms are supported?
This patch supported IME(Input Method Editor) in Win32 and XIM(X Input Method) in Linux(X11). It also supported to flip IME/XIM window in fullscreen mode.

どのプラットフォームがサポートされてるの?

このパッチは、IME(Win32), XIM( X Input Method ) in Linux(X11) をサポートします。ともに、フ ルスクリーンモードでのIME/XIMウィンドウのフリップをサポートします。


How to use these new functions?
First, ensure your IM at least supporting one of three modes: Root, OverTheSpot, OnTheSpot.
(In GNU/Linux with XIM, if setting the environment variable "SDLIM_STYLE", SDL-IM will prefer to use variable setting. For example, in bash, we use $export SDLIM_STYLE=OverTheSpot to set variable, then SDL-IM will prefer to use OverTheSpot mode.)
And then, read following manual:
SDL_imvalue
SDL_SetIMValues
SDL_GetIMValues
SDL_SetIMPosition
SDL_FlushIMString
SDL_GetIMInfo

If you have any suggestion, question, or problem, please mail to: < dr.courage AT gmail.com >
If you have interest in maintaining, please mail to:
< jserv AT kaffe.org >

どのように使うの?

最 初にあなたの使用しているIMが右の三つモードのうち、どれか一つでもサポートしているか確認します。: Root, OverTheSpot, OnTheSpot.

(GNU/Linux 上の XIMでは、"SDLIM_STYLE"環境変数が設定されていれば、SDL-IMはその設定を優先します。たとえば、bashで $export SDLIM_STYLE=OverTheSpot などと環境変数を設定すれば、SDL-IMは、OverTheSpotモードを使用します)

あ とは、以下のマニュアルを参照してください。

SDL_imvalue

SDL_SetIMValues

SDL_GetIMValues

SDL_SetIMPosition

SDL_FlushIMString

SDL_GetIMInfo

もし、なにか提案、質問、問題があれば、< dr.courage AT gmail.com >までメールをください。 (訳注:オリジナルの作者なので当然英語か中国語です)

もし、メンテナンスに興味があれば、< jserv AT kaffe.org >までメールをください。(訳注:当然英語です)

Why should I apply this patch?

I have two reasons to do this:

1.If you want to develop an online-game and distribute it to the world, especially to Asia, IM support is necessary.

2.There are many good GUI libraries based on SDL. If SDL supported IM, that means we can not only choose MFC, Qt or GTK+ for your window application, but also have many other GUI libraries to use. There is nothing better than feeling free to choose what you really want.

ど うして、このパッチを適用するの?

それには二つの理由があります。

1.もし、オンラインゲームを作成し、世界 中で配布したいなら(特にアジアでは)、IMのサポートは必須です。

2.SDLをベースとしたGUIライブラリ はたくさんあります。もし、SDLがIMをサポートすれば、ウィンドウアプリケーションを作成するのにMFC,Qt,GTK+しか選択肢がないということ がなくなります。本当にほしいものを選択できるという自由は、何にも代えがたいものです。

Can I patch SDL by myself?

Of course! It is NOT very hard to patch, because SDL's structure is clear and object-based. And what technology you have to know is just knowing how to create a window and let this main window receive events in your platform. I will be very glad if you are interested to make SDL supporting IM.

私 にも自分でSDLにパッチをあてられるかな?

も ちろん!SDLにパッチをあてるのは、とても難しいわけではあ りません。SDLの構造は、クリーンでオブジェクトベースですから。そして、あなたが知るべき技術は、どのようにウィンドウを 作成するか、そしてあなたのプラットフォームでどのようにイベントを受け取るか、だけです。もし、あなたがIM対応のSDLを作ることに興味を持ってくれ たなら私はとてもうれしいです。


Do you need help?

Yes! I need your help:

1. In Win32 DirectDraw environment, although I had successfully flip IME window in fullscreen mode, the status window still can not be flipped. I don't know how to do this, If you know, please tell me.( This problem is solved! )

2. This patch doesn't have many tests. If you can test it by using Japanese, Korean or any other language using multi-byte characters, I will greatly appreciate your help.

3. If you have some window programming experience in Mac (Classic), MacOS X, FreeBSD or any other platform Please join me to implement IM support together! :-)

なにか手伝えるかな?

イ エス!あなたの協力が必要です:

1. Win32のDirectDraw環境において、IMEウィンドウのフリップには成功しましたが、ステータスウィンドウのフリップにはまだ成功していませ ん。私には、どうしたらいいかわからないので、もし知っている方がいたら教えてください。(この問題は解決されました!

2. このパッチは、大量のテストは受けていません。もし、あなたが日本語、韓国語やほかのマルチバイト言語でテストできるなら、大変ありがたいです。

3. もしあなたがMac(Classic), MacOS X, FreeBSDやほかのプラットフォームでのウィンドウプログラミングの経験があるなら、ぜひIM対応に一緒に参加してください! (・∀・)

What are the important points to patch?

First, the reason SDL don't support IM now is that SDL have held up the events translation to IM server. In order to translate events to IM server, you have to find out where the events was held up:

1. In Win32(DirectX), in file “src/video/windx5/SDL_dx5events.c”, at function DX5_CheckInput, add TranslateMessage function in the first event loop.

2. In Linux(X11), in file “src/video/x11/SDL_x11events.c”, at function X11_DispatchEvent, add XFilterEvent function after XNextEvent.

Second, to understand the structure of SDL video event is important. All of the new function are the virtual members function of interface SDL_VideoDevice(see “src/video/SDL_sysvideo.h”). To implement any other platform, all you have to do is just to implement the virtual function. For example, the function X11_FlushIMString in “src/video/x11/SDL_x11events_c.h” and “src/video/x11/SDL_x11events.c” is the implement of virtual member “SDL_VideoDevice::FlushIMString”.

[To Be Continued..]

パッチを作るには、どういう点が重要?

ま ず、SDLが現在IMに対応していない原因は、SDLがIMサービスへのイベント変換を妨げていることです。IMサービスのためのイベントを変換するため に、どこで妨害をしているかを突き止めなくてはなりません。

1. Win32(DirectX)では、“src/video/windx5/SDL_dx5events.c” 内のDX5_CheckInput()です。TranslateMessage()を最初のメッセージループに追 加します。

2. Linux(X11)では、“src/video/x11/SDL_x11events.c” 内のX11_DispatchEvent()です。XFilterEvent()をXNextEvent()の後 に追加します。

次 は、SDL videoのイベントの構造について理解することが重要です。新しい関数郡は、SDL_VideoDeviceインターフェースの ("src/video/SdL_sysvideo.h"を参照)の仮想関数として実装されています。ほかのプラットフォームに実装する場合、これらの仮 想関数をすべて実装する必要があります。たとえば、“src/video/x11/SDL_x11events_c.h” と“src/video/x11/SDL_x11events.c”内 のX11_FlushIMString()関数は、仮想関数“SDL_VideoDevice:: FlushIMString”の実装です。

[つ づく・・・]

変更履歴:

2004/12/27: This page/patch is available. :-)
2004/12/31: hosted in http://svn.csie.net/. Thanks jserv and lwhsu! :-D
2005/02/11: Add something about new patches(especially for paraGUI-1.1.8), binary libraries, and screenshots, and change a few rules about SDL_FlushIMString interface.
2005/03/07: Add patch for aedGUI-0.1.8a, and add UNICODE_to_UTF8 example in SDL_FlushIMString manual.
2005/03/11: Add new patch(fix some utf-8 handle) for aedGUI-0.1.8a.
2005/03/12: Optimize SDL_im and update it(source only). Add Big5 and GB2312 main pages.
2005/07/25: Add ustring and the OGRE i18n patch.
2005/07/30: Fix Ogre::font and update SDL-IM.
2005/07/31: Solving the problem with SDL-IM that it can not flip state window in win32 fullscreen mode and adding the
the explain of cvt_traits.
2005/08/28: change the spec of SDL_FlushIMString(see the manual), add new option pack "SDL_imm".
2005/09/02: fixed ustring and ogre patch with some compiling error.

(訳注:以下、翻訳版の変更履歴)
2007/01/04: とりあえず翻訳

Copyright 2004-2005 L.Y.C., Taiwan(Formosa).

Translated by Makoto HARADA.( haramako <at> gmail.com )