Add multi-step input method support for Linux (#21897)
This implements the Gtk hooks required to support multi-step input methods on Linux. This builds on the support for composing regions (preedit region in Gtk terminology) added to TextInputModel in https://github.com/flutter/engine/pull/21682. Specifically, the following changes are included: 1. Add handler for TextInput.setMarkedTextRegion framework messages: On any change to the EditableText in the framework, this message is sent which provides an updated rect (in the local co-ordinates of the EditableText) for the composing region. If not in composing mode, the cursor rect is sent. 2. Add handler for TextInput.setEditableSizeAndTransform framework messages: On any change to the RenderObject underlying the EditableText, an updated size for the full EditableText widget, as well as an affine transform matrix from local co-ordinates to Flutter root co-ordinates is sent. 3. On either of the above messages, we use the transformed composing rect to compute the cursor position in Gtk window co-ordinates and inform Gtk, so that it can position any system IM composing window correctly for on-the-spot composing, such as is used when inputting Japanese text. 4. Adds handlers for preedit-start, preedit-changed, and preedit-end signals from Gtk. These are passed on to the TextInputModel. 5. Updates the preedit-commit handler to commit the composing region to the text or, if not composing, insert new text at the cursor. 6. Updates the handler for TextInput.setEditingState framework messages to extract the composing range base and extent and pass these on to TextInputModel. 7. Updates update_editing_state function to set composing base and extent on text input state updates sent to the framework.
Showing
想要评论请 注册 或 登录