-
-
Notifications
You must be signed in to change notification settings - Fork 2
Text Services
Note: This page contains old documentation from 2008, but may still be of use.
According to MSDN the Text services framework "provides a simple and scalable framework for the delivery of advanced text input and natural language technologies"
Overview of text services and it's Linux equivalents The structure of input methods in GTK
Similarities:
- Both use a message passing system with callbacks
- Both query the document
TSF | GtkIM |
---|---|
UTF 16 (?) | UTF 8 (requires conversion) |
Selection aware | Independent of selection |
Processes delete / backspace | Application handles delete \ backspace |
Does not have delete callback † | Has delete callback †† |
? | Application has to handle backspace / delete |
† Might use SetText?
†† Only for automatic (context sensitive) character removal.
Most of the Text Services stuff seems to be concentrated in the VwTextStore class, which implements the ITextStoreACP interface.
It seems that to get a ITextStoreACP object the process is:
- CoCreateInstance()
- ITfThreadMgr::CreateDocumentMgr()
- ITfDocumentMgr::CreateContext()
In C#, keypresses go through:
SimpleRootSite.OnKeyPressEvent() EditingHelper.OnKeyDown() EditingHelper.CommitIfWord() EditingHelper.IsWordBreak() EditingHelper.Commit() IVwRootBox.get_Selection() - <span style="color:red">C++</span> ...? DataUpdateMonitor.Commit() - <span style="color:red">Unported</span> ...? EditingHelper.HandleKeyPress() FwViews.VwShiftStatus EditingHelper.GetShiftStatus() Views + Gdk properties EditingHelper.CollectTypedInput() Views properties StringBuilder() . StringBuilder.Append() . EditingHelper.OnCharAux() Views properties ResourceHelper.MakeUndoRedoLabels() . IVwRootBox.get_DataAccess() . IVwRootBox.get_Site() . IVwRootBox.get_Selection() . IVwRootSite.ScrollSelectionIntoView EditingHelper.RemoveCharFormattingWithUndo() EditingHelper.GetCharacterProps() . EditingHelper.RemoveCharFormatting() IVwSelection.get_IsRange() . ITsTextProps.GetIntPropValues() . ITsTextProps.GetStrPropValue() . ITsPropsBldr.SetStrPropValue() . IVwSelection.SetSelectionProps() . IEditingCallbacks.ShowContextMenuAtIp() . SimpleRootSite.OnKeyPress() EditingHelper.OnKeyPress() EditingHelper.CommitIfWord()* EditingHelper.HandleKeyPress()*
Also, SimpleRootSite.OnButtonPressEvent() calls EditingHelper.CommitIfWord()
There are a number of possible replacements for Text Services, including SCIM and KMFL. Fortunately, we do not need to write separate functionality for each one of these, as they are available as GTK input method modules.
Approaches to replacing Text Services:
- Replace the Windows APIs (msctf.h)
- Replace the Windows API calls (VwTextStore.cpp)
- Replace the workings of the text store (VwTextStore.cpp)
- msctf.h - Windows headers for TSF stuff in FW
- Doug (KMFL)
- XIM \ SCIM \ KMFL