IMKServerInput is an informal protocol that defines methods for receiving text events. This is intentionally not a formal protocol because there are three ways to receive events. An input method chooses one of the following approaches and implements the appropriate methods:


  • Key binding. In this approach the system tries to map each key-down event to an action method that the input method has implemented. If successful (action method found), the system calls didCommandBySelector:client:. If unsuccessful (action method not found), the system calls inputText:client:. For this approach you need to implement inputText:client: and didCommandBySelector:client:.

  • Text data only. In this approach, you opt to receive all key events without the key binding, and then unpack the relevant text data. Key events are broken down into the Unicodes, the key code that generated them, and modifier flags. This data is then sent to the inputText:key:modifiers:client: method, which you need to implement.

  • Handle all events. In this approach, you receive events directly from the Text Services Manager as NSEvent objects. You must implement handleEvent:client: method.


Supporting Key Binding

- inputText:client:

Handles key down events that do not map to an action method.

- didCommandBySelector:client:

Processes a command generated by user action such as typing certain keys or pressing the mouse button.

Unpacking Text Data

- inputText:key:modifiers:client:

Receives Unicode, the key code that generated it, and any modifier flags.

Receiving Events Directly from the Text Services Manager

- handleEvent:client:

Handles key down and mouse events.

Committing a Composition

- commitComposition:

Informs the controller that the composition should be committed.

Getting Input Strings and Candidates

- composedString:

Return the current composed string.

- originalString:

Return the string that consists of the precomposed Unicode characters.

- candidates:

Returns an array of candidates.


Info Dictionary Keys

Constants for keys used to look up information in the info dictionary.