YamaKen
yamak****@bp*****
2004年 7月 22日 (木) 02:08:18 JST
ヤマケンです。reset-handler一般の話にだけ反応します。 今はimmodule for Qtに時間を割く必要があるので問題全体は調査でき ていません。すいません。 At Wed, 21 Jul 2004 21:10:41 +0900, Etsushi Kato wrote: > On Wed, Jul 21, 2004 at 08:36:27PM +0900, > yusuk****@cheru***** wrote: > > > input contextのreset handlerを最近書きはじめたのですが、 > > その際に多分primeに影響は無いと思ってお伝えしてませんでした。 > > すいません。 > > reset-handler中で内部状態を全部消し去るコードを > > 書いてもらえないでしょうか? > > #それでは直らないかもしれないですが、今後必要なコードです。 > また全般に関係しますが、preedit が空でも uim_reset_context() で > uim_update_preedit_segments() としてしまうのは問題あるかもしれません。 プラットフォームによっては問題になります。例えばQtのtext wigetは input contextの入力状態をwidget側でも管理していて、reset 時に commit が発生するとcontext側との一貫性が保てなくなってしまいます。 したがってreset時にcommitが発生する挙動は空文字列であってもあり がたくないです。immodule for Qtでのresetに関する仕様では以下のよ うに規定しています。 - a text widget call this function before inserting a text to make widget ready to accept a text. - You have not to send commit string at reset(). It will break input state consistency. また、anthy.scmのreset-handlerを見ると";; code to commit pending string may be added here"とありますが、bug #454にコメントを付け たようにQtではまずい事になりますし、resetという機能の責任を越え ているのでやめるべきです。uim側のresetはあくまでpassiveに振舞う べきで、空文字列のcommit等はプラットフォーム固有の事情として bridgeが処理するべきだと考えています。 余談ですが、Trolltechが書いたQt/X11のXIM対応コードやQt/Embedded では日本語IMに取ってはまずいタイミングでresetが呼ばれているので、 Qt側のコードを慎重に修正する必要がありました(Qt/Embeddedの方は未 完ですが)。GTKの方でもライブラリ本体でのresetの扱いがまずいとい う事はないですか? もしそうであってもlibuim本体はGTKの事情に引き ずられる事なく仕様を決めるべきだと思います。 immodule for Qtでは以下のコメントにあるような修正を施しています。 まだ記述してませんがフォーカス移動時の"preedit relocation"や "preedit preservation" に関わる仕様です。 /*! This function is called when text widgets need to be neutral state to execute text operations properly. See qlineedit.cpp and qtextedit.cpp as example. Ordinary reset such as along with changes focus to another widget, moves the cursor, etc, is implicitly handled via unfocusInputContext() because whether reset or not when such situation is a responsibility of input methods. For example, Japanese input context should not be reset when focus out. The context sometimes contains a whole paragraph and has minutes of lifetime different to ephemeral one in other languages. The input context should be survived until focused again. So we delegate the responsibility to the input context via unfocusInputContext(). */ void QWidget::resetInputContext() ------------------------------- YamaKen yamak****@bp*****