Very interesting discussion! Here I go!
As far as I understand, SDL does not provide GUI elements such as text
input widgets.
I agree with others who have said that SDL should remain this way.
Can we look at how the dialogs used by existing IMEs interact with the
graphics environments of typical SDL applications? SDL may be used in
windowed, and full screen modes. It can be used with single and double
buffering, and with its 2D API and OpenGL rendering. The IME must be
able to be used, or ignored, in all of those graphics environments.
Being a person whose native and supplementary languages are pretty
well accommodated by a US English keyboard layout (in most gaming
environments no one is offended if you omit details like accent marks)
I am pretty ignorant of any IME other than compose/dead keys like
holding ALT and punching in codes on MSWindows, pressing
Control+Shift+U and then punching in codes on Debian, or holding the
Option/Alt key on Mac OS X.
Having said that, I have this to say: I am not even certain where the
realm of things called IME begins and ends. So far it seems that it
includes means of inputting text defined by your “desktop environment”
(for lack of a better term – please don’t say OS, though
as well
as third-party applications for intercepting the user’s input and
transforming it into different input for other applications. Is this
right? Does anything that is called IME fall outside of this (poor)
definition?
Moving along…
When visual feedback is required while pre-editing, things get
complicated and SDL has to take
over the input and display of text.
The problem is that each input method has its
own manner of showing candidates, and each application has its own style
of showing preedits.
We must verify whether
or not the dialogs used by existing IMEs can be made visible on top of
the different SDL graphic modes. Which raises the question, do we
always want to do “on the spot” IME dialog, which are more work for
the programmer, or do we want to allow the use of the IME’s dialog box
when it is possible?
I think we need a comprehensive discussion of the input methods SDL
may support. (I don’t use the term “IME” since I am still not entirely
sure what that term encompasses.) It is critical to compare the APIs
and capabilities of these different input methods. I expect, for
instance, that stylus-driven input interfaces common on portables, all
have no problem overlaying the input editor GUI over top of the
application. (That may or may not be accurate.) I’m not sure sure
however, for instance, that Mac OS X can offer accommodate OpenGL
applications with a text edit field (and I’m quite certain that most
developers would not want to be constrained to using an Apple text
widget for i18n-capable text input.) We need to know what these
various platforms and IME applications have in common, the technical
details of how they interface with users’ applications, before we can
begin deciding upon implementation details and how much implementation
belongs in SDL proper or in the application / satellite libraries.
Where platforms fall short of providing good integration with SDL
applications, we could consider platform emulation to some degree. I
give an example of emulating Mac OS X compose key emulation further
down in this email.
Just to give folks something to think about and throw rocks at I’m
going to propose an API 
SelectIME(optional standard locale name) - This function tells SDL
that we want to use an IME and tells SDL what the locale is. If the
locale is null or empty then SDL will use the default system locale,
otherwise it will use the provided locale. If that locale is not
support it returns false, otherwise it return true.
Locale (? la setlocale() et al, see
http://linux.die.net/man/3/setlocale) seems to me to be an issue best
handled separately. For input, locale really only matters for
formatting expectations of things like numbers (is one thousand
1,000.00 or 1.000,00 for example) and phone numbers (1-412-555-1212 or
1.412.555.1212) and I think is outside the scope of this discussion.
(Did you maybe mean character encoding?)
I’m going to assume that turning on IME support causes SDL to start
sending IME specific events to the event queue. To handle these events
lets provide a special IME filter function.
Is it possible to fake complex IME if you (the SDL layer) can make
certain text-edit-ish assumptions about the application mode?
(Provided, obviously, by the application letting SDL know just that.)
For instance, if I am on Mac OS X, and I hold ALT+E to compose an
accent acute, and then press “e” to make “?,” would it be good for SDL
to fake this by sending first an accent character to begin with, and
then once I hit “e,” SDL could send two events: backspace, then “??”
The application could do things like kill or restart the input session
if it was closing the target of the user’s input, or if the user
clicks somewhere else to move the cursor.On Thu, May 28, 2009 at 12:22 AM, Simos Xenitellis <simos.lists at googlemail.com> wrote:
On Fri, May 29, 2009 at 6:16 PM, Bob Pendleton wrote:
On Thu, May 28, 2009 at 12:22 AM, Simos Xenitellis <simos.lists at googlemail.com> wrote:
On Fri, May 29, 2009 at 8:42 AM, Alissa Sabre <alissa_sabre at yahoo.co.jp> wrote:
On Fri, May 29, 2009 at 6:16 PM, Bob Pendleton wrote:
On Thu, May 28, 2009 at 2:36 AM, Jjgod Jiang wrote:
In my upcoming emails, I will give a brief overview of how input methods
work for CJK (Chinese, Japanese, Korean) languages and detailed discussion
on how input methods work on Mac OS X, finally, I’ll summarize the current
status of SDL Unicode text input support.
I look forward to your future posts!
–
http://codebad.com/