Q: How can I get my input method palettes to show up above a Dashboard widget?
A: Windows in Dashboard and Spotlight have high window levels (typically set to level 100) in order to be visible above all application UI. When Dashboard or Spotlight have key focus, they will set the
To adjust its window levels, the IM should create a window group (see MacWindows.h) to include its window (for example, the candidate window for inline input), and set the window group's level via Window Mgr API.
Q: Are there other issues when using input methods in Dashboard widgets that I need to be aware of?
A: There are two issues that you should be aware of in Tiger when using Input Methods in the Dashboard environment.
First, when the user initiates an inline input session in a Dashboard widget text field and leaves it unconfirmed before switching out of Dashboard, the inline input session will be commited in the widget. The next time the Dashboard widget receives key focus, the user will need to reinitiate the inline session, or reconvert the confirmed text into an inline session in the same way as happens when an inline session is accidentally confirmed. There are no input method workarounds for this issue.
Second, when using an input method in a Dashboard widget, if the user clicks in a popup menu in one of your input method palettes, and then releases the menu, key focus does not return to the Dashboard widget. Instead it returns to the previous frontmost application, i.e. TextEdit, Finder, etc... there are no known workarounds in the input method that address this issue.
Q: How should I modify my input method's messaging to my server to contribute to system stability?
A: Input Methods that communicate with their (UI) server need to be careful that arbitrary runLoop sources do not fire while the input method client is waiting on a reply, and to not use synchronous RPC requests (via unnecessary message timeouts) for messages that should be asynchronous.
Some input methods using
Also, when sending messages to a server via
Q: How do I write a palette-class input method?
A: You need to do the following:
Use the '
When the user interacts with your User Interface (such as a floating palette presented by a UI server process), send messages to the instance of your input method that is currently active (i.e. in the process that currently has key focus). If these actions produce text, you need to pass
Q: How do I make my palette-class input method invisible in System UI?
A: Making your input method invisible to System UI can be useful when your (palette) input method provides a service specific to an application or a set of applications that know how to discover, enable, and select your service. This technique is also useful for input methods that need information only available in the context of the frontmost (or key focus) process. To make your input method invisible, specify a boolean value of '
Q: Do I still need to define my icons in my component's resource fork?
A: No, in fact we now discourage input method developers from keeping any data (other than that required by
Q: How do I make my keyboard input method input-mode savvy?
A: Your input method should become input-mode savvy if it provides multiple ways of processing keyboard text input, such as translation of key events via different keyboard layouts, different kinds of transliteration, and/or multiple kinds of more complex processing like Kotoeri's Hiragana input or the Traditional Chinese input method's Hanin input mode. Instead of presenting these different input modes in your own UI, your input method should let the System do this for you. This integrates your input method's principal features into a consistent system-provided UI, alongside other input modes and keyboard layouts enabled by the user. The user can then select your input modes from the Text Input menu, and can enable them independently of one another via the International Preferences pane in System Preferences.
To become mode-savvy, your input method must:
1. Add a new dictionary in its Info.plist file for the ComponentInputModeDict key
The following sample would describe a mode-savvy input method, called "Special IM". It uses some TSM provided (standard) input modes for Japanese and Roman.
All icon files reside in the component's
Some notes on the various input mode properties.
Input Modes are assigned a Mac ScriptCode, such as
If the input method defines several input modes in the same script, at most one of these should be marked as the "primary" input mode for that script. See
Each input mode should define an icon to be used in the TextInput menu to show when the input mode is selected.
An "alternate" icon should also be defined for use when the user clicks the icon in the menu bar. See
Input Modes can be enabled by default when the input method itself is enabled in System Preferences/International Prefs pane. This is specified via
An Input mode can define a shortcut sequence via
Private Input Modes can be defined. It is not necessary to restrict input mode keys to the list in TextServices.h. However, when an input mode provides substantially the same functionality as one would expect from a pre-defined input mode, the TSM input mode should be used instead, such as
Listing 1: Info.plist dictionary.
<key>ComponentInputModeDict</key> <dict> <key>tsInputModeListKey</key> <dict> <key>com.apple.inputmethod.Japanese</key> <dict> <key>tsInputModeDefaultStateKey</key> <true/> <key>tsInputModeIsVisibleKey</key> <true/> <key>tsInputModeKeyEquivalentKey</key> <string>J</string> <key>tsInputModeKeyEquivalentModifiersKey</key> <integer>4608</integer> // Ctl-Shift modifiers <key>tsInputModeMenuIconFileKey</key> <string>Hiragana.tif</string> <key>tsInputModeAlternateMenuIconFileKey</key> <string>HiraganaSelected.tif</string> <key>tsInputModeScriptKey</key> <string>smJapanese</string> <key>tsInputModePrimaryInScriptKey</key> <true/> </dict> <key>com.apple.inputmethod.Japanese.Katakana</key> <dict> <key>tsInputModeDefaultStateKey</key> <true/> <key>tsInputModeIsVisibleKey</key> <true/> <key>tsInputModeMenuIconFileKey</key> <string>Katakana.tif</string> <key>tsInputModeAlternateMenuIconFileKey</key> <string>KatakanaSelected.tif</string> <key>tsInputModeScriptKey</key> <string>smJapanese</string> <key>tsInputModePrimaryInScriptKey</key> <false/> </dict> <key>com.myDomain.SpecialIM.SpecialInputMode</key> <dict> <key>tsInputModeDefaultStateKey</key> <true/> <key>tsInputModeIsVisibleKey</key> <true/> <key>tsInputModePrimaryInScriptKey</key> <false/> <key>tsInputModeScriptKey</key> <string>smJapanese</string> </dict> <key>com.apple.inputmethod.Roman</key> <dict> <key>tsInputModeDefaultStateKey</key> <false/> <key>tsInputModeIsVisibleKey</key> <true/> <key>tsInputModeMenuIconFileKey</key> <string>Roman.tif</string> <key>tsInputModeAlternateMenuIconFileKey</key> <string>RomanSelected.tif</string> <key>tsInputModeScriptKey</key> <string>smRoman</string> <key>tsInputModePrimaryInScriptKey</key> <true/> </dict> </dict> <key>tsVisibleInputModeOrderedArrayKey</key> <array> <string>com.apple.inputmethod.Japanese</string> <string>com.apple.inputmethod.Japanese.Katakana</string> <string>com.myDomain.SpecialIM.SpecialInputMode</string> <string>com.apple.inputmethod.Roman</string> </array> </dict> <key>tsInputMethodIconFileKey</key> <string>SpecialIM.tif</string>
Listing 2: Japanese.lproj/InfoPlist.strings.
CFBundleName = "スペーシャル IM"; com.apple.inputmethod.Roman = "スペーシャル 英字"; com.apple.inputmethod.Japanese = "スペーシャル ひらがな"; com.myDomain.SpecialIM.SpecialInputMode = "スペーシャル モード"; com.apple.inputmethod.Japanese.Katakana = "スペーシャル カタカナ";
Listing 3: English.lproj/InfoPlist.strings.
CFBundleName = "Special IM"; com.apple.inputmethod.Roman = "Special Romaji"; com.apple.inputmethod.Japanese = "Special Hiragana"; com.myDomain.SpecialIM.SpecialInputMode = "Special InputMode"; com.apple.inputmethod.Japanese.Katakana = "Special Katakana";
2. Implement the CopyTextServiceInputModeList component call
3. Implement kTextServiceInputModePropertyTag property of the SetTextServiceProperty component call
When one of your input modes is selected from the Text Input menu or programmatically, TSM will make the
4. Call TSMSelectInputMode to confirm the selection of an input mode when the System requests you switch to the specified input mode
When TSM requests a particular input mode be selected, the input method makes the final decision as to whether to allow the selection. To commit the selection or to alter it, the input method must call the
5. Follow the recommendations of these Do's and Dont's for Input Modes
Q: My input method uses a private keyboard layout. How do I make it invisible to the System?
A: If you install a private keyboard layout in one of the bundles in
Document Revision History