[immodule-qt] Re: Question about deletion of the method of QInputContext

Lars Knoll lars at trolltech.com
Tue Jan 11 14:54:22 EET 2005


On Tuesday 11 January 2005 06:11, Daisuke Kameda wrote:
> On Thursday 06 January 2005 02:15, Lars Knoll wrote:
> > > 3. About isPreeditPreservationEnabled().
> > > It seems that you determined to delete it although Yamaken had
> > > explained several times. Why did you do?
> >
> > Well, if I understood correctly he said that you need it as long as you
> > have one input context per top level and a QInputContext can only hold
> > one low level IC (XIC for XIM). The preedit relocation hack moved the
> > preedit string from one input widget to the next on focus changes (but
> > only if the two widgets had the same toplevel widget). I can't believe
> > this is the behaviour you want.
> >
> > In the current design QInputContext (for XIM, but the same can be
> > implemented for other input methods) holds more than one XIC, and can
> > thus deal correctly with focus changes. It is now up to the input context
> > if they reset the preedit string on focus changes or preserve it.
> >
> > So for XIM, focus changes do not any longer cause the preedit string to
> > be reset, but it is preserved until the widget regains focus. Please try
> > what I have implemented for XIM together with e.g. kinput2 and tell me if
> > this is the wanted behaviour.
>
> I'm considering well about this.
>
> Although present operation is good for Japanese, I think that
> the operation which doesn't reset is not always required.
> If anything, there must be more many languages for which
> it is good behavior not doing so.
>
> Probably, this point at least should be taken into consideration.

You are right. Currently it's only japanese where a reset should not occur on 
focus change. I can adapt the behaviour of the XIM input context to reset on 
focus change if the language is not japanese (see the patch below).

Other input methods can implement this behaviour as they seem fits.

Best regards,
Lars

==== //depot/qt/main/src/gui/inputmethod/qximinputcontext_x11.cpp#16 
- /home/lars/dev/qt/src/gui/inputmethod/qximinputcontext_x11.cpp ====
--- /tmp/tmp.8861.0	2005-01-11 13:53:25.480557792 +0100
+++ /home/lars/dev/qt/src/gui/inputmethod/qximinputcontext_x11.cpp	2005-01-11 
13:53:11.388700080 +0100
@@ -523,6 +525,12 @@
 void QXIMInputContext::setFocusWidget(QWidget *w)
 {
     QWidget *oldFocus = focusWidget();
+    if (oldFocus == w)
+        return;
+
+    if (language() != QLatin1String("ja"))
+        reset();
+
     if (oldFocus) {
         ICData *data = ximData.value(oldFocus);
         if (data && data->ic)



More information about the immodule-qt mailing list