[Uim] Focus and cursor position shift handlings (bug #7729)

YAMAMOTO Kengo / YamaKen yamaken at bp.iij4u.or.jp
Sun Oct 15 05:35:18 EEST 2006


At Tue, 10 Oct 2006 18:00:34 +0900,
yamaken at bp.iij4u.or.jp wrote:
> 
> At Tue, 10 Oct 2006 14:44:04 +0900,
> ek.kato at gmail.com wrote:
> > 
> > On 10/10/06, YAMAMOTO Kengo / YamaKen <yamaken at bp.iij4u.or.jp> wrote:
> > > Could anyone contribute your time to implement this feature?
> > > I can offer API suggestion, documentation and responses to
> > > discussion.
> > 
> > OK.  But I'm rather busy this week.  Perhaps I can help after this weekend.
> 
> Thank you. I'll post the API suggestion later.

These 4 handlers in addition to preexisting 'reset' handler will
be added if there are no problems. Please review the concept,
interface, namings and usage of it. Jae-hyeon, please confirm
the scenario #3 and #4 with your requirements.

I'll commit actual interface codes to trunk once it is reviewed.


- (reset)

  Reset the context to neutral state. Internal state that
  considered as 'global' may be kept. This handler MUST NOT
  commit a string and/or update the preedit.  If a preedit
  string is existing on a GUI toolkit-level reset, the bridge is
  responsible to clear it.

- (focus-out)
- (focus-in)

  Notify the context that the textarea is being focused
  out/in. This handler may commit a string and/or update the
  preedit.

- (displace textarea-local?)

  Notify the context that the input at current input point
  (textarea and/or cursor position) has been discontinued. This
  handler may commit a string, but must not update/clear the
  preedit. Bridge-level preedit must be cleared by bridge itself
  (uim-level preedit may be preserved for subsequent 'place'
  handler call).

- (place textarea-local?)

  Notify the context that the input point (textarea and/or
  cursor position) has been relocated. This handler may commit a
  string and/or update the preedit.


Scenario #1: Clear all web forms by 'clear' button
  1) Input a Japanese sentence in hiragana to a web form and
     hold it in the preedit
  2) Click 'clear' button
  3) The GUI tookit clear the text of the form
  4) The GUI tookit reset the input context of the form
  5) The uim bridge clear toolkit-level preedit
  6) The uim bridge call uim_reset_context()
  7) reset-handler has been called
  8) The context clear uim-level preedit and transit all input
     states to neutral

Scenario #2: Reset a partial input sequence of a Latin IM
  1) Input a dead key
  2) Click another window
  3) focus-out handler has been called
  4) The IM reset the character composition sequence (dead key 1))
  5) When the focus is backed to the original textarea, the user
     can input any character from beginning of its input
     sequence. This behavior is important to avoid user confusion

Scenario #3: Commit precomposed Hangul character of a 2 beol-sik IM (1)
  1) Input some hangul jamos and compose a character in the preedit
  2) Click another window
  3) focus-out handler has been called
  4) The IM commit the character and clear preedit

Scenario #4: Commit precomposed Hangul character of a 2 beol-sik IM (2)
  1) Input some hangul jamos and compose a character in the preedit
  2) Click another position of the same textarea
  3) 'displace' handler has been called
  4) The IM commit the character and clear preedit
  5) 'place' handler has been called
  6) ignore 5)

Scenario #5: Preedit relocation (direct relocation to another textarea)
  1) Input a Japanese sentence in hiragana into a Japanese
     multi-segment IM
  2) Click another textarea which shares input context with the
     textarea 1)
  3) 'displace' handler has been called at textarea 1)
  4) The context clear the bridge-level preedit of 1) by
     im-clear-preedit
  5) focus-out handler has been called at 1) and ignored
  6) focus-in handler has been called at 2) and ignored
  7) 'place' handler has been called at textarea 2)
  8) The context update the preedit of 2) by the preserved
     uim-level preedit

Scenario #6: Preedit relocation (deferred relocation)
  1) Input a Japanese sentence in hiragana into a Japanese
     multi-segment IM
  2) Click another window
  3) focus-out handler has been called at 1) and ignored
  4) Click another textarea which shares input context with the
     textarea 1)
  5) 'displace' handler has been called at textarea 1) by using
     preserved the internal variable last_text_widget of the GUI
     toolkit
  6) The context clear the bridge-level preedit of 1) by
     im-clear-preedit
  7) focus-in handler has been called at 4) and ignored
  8) 'place' handler has been called at textarea 4)
  9) The context update the preedit of 4) by the preserved
     uim-level preedit


Notes:

1. In scenario #1, uim context must not commit a string, update
   or clear the preedit. It may make widget-level consistency
   broken, and breaks 'reset' semantics.

2. Some (or most?) GUI toolkit issues a reset on inappropriate
   timings such as focus-out. Such tookit assumes that all input
   context is ephemeral like Latin character composition. But
   most Japanese IMs are definitely not.

   To deal against such toolkits, uim IMs may ignore
   reset-handler as a temporary solution. We should send patches
   for such toolkits to the toolkit developers to fix the
   problem.

3. See the document of QInputContext to know what is preedit
   relocation.

     http://anonsvn.freedesktop.org/svn/immqt/immodule-qt-x11/trunk/src/kernel/qinputcontext.cpp


4. Scenario #4 and #5 requires appropriate support of the GUI
   tookit. But since I am not confident with the 'place' and
   'displace' API about the note 5. (see below), API revision
   suggestion for GUI toolkits should be deferred for now.

5. Some combined call of the handlers (see below) are needed to
   reduce text flicker on a focus-sensitive preedit display. But
   since such IMs are rare and unneeded for now, it is not
   supported to reduce development cost and keep the API simple.

   - focus-out and displace
   - focus-in and displace
   - focus-in and place

------------------------------------------------
YAMAMOTO Kengo / YamaKen  yamaken at bp.iij4u.or.jp
FAMILY   Given / Nick



More information about the uim mailing list