[SDL] SDL 1.3 Text editing
Jjgod Jiang
gzjjgod at gmail.com
Wed Apr 14 20:38:35 PDT 2010
Hi Pavel,
On Thu, Apr 15, 2010 at 3:41 AM, Pavel Kanzelsberger <kanzels at gmail.com> wrote:
> I'm working on a multi-window GUI and now working on text input.
>
> It works perfect but when I want to implement text editing events and character composition, I would like to display it as well. The problem is that corresponding event structure is missing windowID and I don't know to what window the final text input goes...
>
> Here for this event, windowID is not specified...
>
> typedef struct SDL_TextEditingEvent
> {
> Uint32 type; /**< ::SDL_TEXTEDITING */
> char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
> int start; /**< The start cursor of selected editing text */
> int length; /**< The length of selected editing text */
> } SDL_TextEditingEvent;
>
> And then when character is finally composed, I know the windowID:
>
> typedef struct SDL_TextInputEvent
> {
> Uint32 type; /**< ::SDL_TEXTINPUT */
> Uint32 windowID; /**< The window with keyboard focus, if any */
> Uint8 which; /**< The keyboard device index */
> Uint8 padding1;
> Uint8 padding2;
> Uint8 padding3;
> char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
> } SDL_TextInputEvent;
>
> Could that be fixed or is it a limitation of some operating system??
>
> I could hack some code and remember what was the last active window, but that's not very safe probably.
Indeed, that can be fixed. Can you give me a sample code that how you
are going to use this API with multi-window? Even pseudo-code will
help me understand the situation better.
Currently the text input implementation is a bit broken for
multi-window since I only added a field edit to the front most window
on Cocoa_StartTextInput(). It can be solved once we switched to use
the field edit provided by NSWindow. I am working on it.
- Jiang
More information about the SDL
mailing list