Re: XIM String Conversion Callback



Steve Underwood <steveu coppice org> writes:

> Owen Taylor wrote:
> 
> > Reconversion is especially tricky and I'm not sure it should be
> > joined together with context.
> >
> >
> > For getting context, my current idea of how it should look is:
> >
> >  GtkIMContext should have a signal ::retrieve_context() which has parameters
> >  indicating the desired context region.
> >
> >  When the owner of the context (the GtkEntry, for example), gets this
> >  signal, it should call:
> >
> >   gtk_im_context_set_context (GtkIMContext *im_context,
> >                               gint          position,
> >                               gchar        *context_text,
> >                               gint          length);
> >
> >  Where position is the offset (in bytes, not including the
> >  preedit string) of the start of the context string from the cursor
> >  position.

> I think there are likely to be contention problems here between what
> the app thinks is the current context, and what the IME might
> do. Defining context requires a model of "context", and that varies
> between input methods, even for a single language. Is the context
> the last few characters which form a polysyllabic word in Chinese?
> Is it the sentance to date (where "sentance" can be a slightly vague
> term in some languages)? The XIM documentation doesn't really
> address these issues. It just vaguely refers to "context".

Well, the idea here is that the ::retrieve_context signal would
have parameters specifying how much context the input method
wants. This would be similar as to how in XIM, the 
StringConversionCallbackStruct has a direction argument 
which can be XIMLineEnd,XIMForwardChar,XIMBackwardChar, etc.

(Section 13.5.7.3 of the Xlib manual)

The definition of the units would be in terms of the boundaries
determined by pango_get_log_attrs().

> Actually, I'm not sure precisely what you mean by context and
> reconversion in your
> 
> comments. By "reconversion" are you just refering to the repeated
> changes of the pre-edit string, or something more?

"recoversion" means taking areas of text that have already been
converted into the final form and sent to the client and changing them
back to a preedit string. 

Usually the way this would work is that the users selects a
part of the text that was misconverted and hits a hot key
or selects a command from a menu. Alternatively, while editing,
there may be a hot keys to reconvert the previous word, etc.

I've never actually used a system with reconversion, but it
apparently can be useful.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]