#2884 Tk does not handle input-manager input on Mac OS X


OS X allows the user to enter accented and CJK characters through system-provided input methods, similarly to IME on Windows and XIM on X11. While the latter two are supported in Tk, the former is not.

Currently on the Carbon Tk implementation there is limited support for entering accented characters, however the "working" text (usually an underlined form of the accent component itself) is not shown. The Cocoa version does not even support this, and neither supports CJK entry at all.


  • Torsten Berg

    Torsten Berg - 2011-03-10

    This is the same as bug 2907388, right?

  • Adrian Robert

    Adrian Robert - 2011-03-10

    No, this is different from 2907388. That bug reported a crash when trying to enter a latin accented character, and apparently stopping the crash was considered sufficient to close the bug. This report is about the fact that users cannot use their system input methods to enter text (accented characters, CJK, etc.) in Tk applications on OS X.

  • Torsten Berg

    Torsten Berg - 2011-03-11

    Yeah, ok, the reason for submitting was the crash, but the fix is just preventing the crash. It does not allow to enter accented characters still. So, the two items are related but it is perhaps really best to reopen the issue as such with a new bug here. And the priority should be 9, IMO.

  • Daniel A. Steffen

    I was well aware of this limitation when I wrote the NSEvent keyboard input code. Integrating the key-level tk input subsystem with the general higher level Cocoa full multi-character unicode input method layer (with in place temporary input etc) is a very difficult problem that I still don't know how to solve. I wouldn't expect a solution anytime soon, whatever the priority is set to...

  • Adrian Robert

    Adrian Robert - 2011-03-21

    Added an initial patch, against the last CVS version of Tk.
    It lets you enter characters using input methods. :)
    But it won't display the working text or position helper panels
    correctly. And some parts of it could probably be refined,
    e.g. the criteria for sending to the input manager.
    Any help or hints welcome.

  • Adrian Robert

    Adrian Robert - 2011-03-22

    I uploaded an improved version of the patch, using Tk_SetCaretPos() to help set the helper panel position. (This seems to not get called on pack events though; it should.) Multi-character input is also supported. Still left is the working text management. I'm not sure whether it can be done in entry widgets since there might be a filter, but in text should be OK. Does anyone know if X11 or Windows do working text in Tk?

  • Torsten Berg

    Torsten Berg - 2011-03-31

    Very good to see someone working on a patch. Thanks for your effort!

    However, when I apply the patch and build Tk, I cannot see any accented characters when e.g. entering ^ e I don't get ê. Is it this, you mean by the missing 'working text managment'? Or did I do something wrong, maybe?

  • Adrian Robert

    Adrian Robert - 2011-04-01

    Thanks for testing. It should be working same as other apps on OS X as far as the characters entered. So it goes by your system input method settings (System Preferences | Language and Text | Input Sources). I've tested so far with two different settings. When I am in "US", I hit option-i, then e, it will give me ê for example, or option-u, then a or o to get Scandinavian letters. But unlike other apps, it won't show you the ˆ or ¨ in yellow or underlined ("working" display) before you've hit the second letter.

    I've also tested with Chinese input methods, and here the helper windows pop up as normal and let you select the alternative to insert, which works, but again you don't see any intermediate working text before you've done so.

    If you are seeing something different please let me know your keyboard layout and input method setting, and exactly what you are typing. Thanks!

  • Torsten Berg

    Torsten Berg - 2011-04-03

    OK, I use MacOS X 10.6.6 with a German keyboard layout and the input method is also German. When I enter the key ´ followed by e in any text box in a program (Mail or TextEdit or Pages or Safari or ...) then I will get the accented letter é. When I do the same in a text widget (or entry widget) in the patched Tk I get e without the accent. I also cannot get a single ´ character by using the normal ´ plus <space> sequence.

    So, I don't need or use the option key to get accented characters. But I do need them for scandinavian characters. Getting e.g. the letter æ always worked by typing option-ä in German input method, also in the unpatched Tk already.

    I hope this helps to see what I do.

  • Adrian Robert

    Adrian Robert - 2011-04-04

    Ah yes, I should have known not to post anything without testing on a German keyboard! OK, so much for being lazy. :-/ I've updated the patch, could you please try it again?

  • Torsten Berg

    Torsten Berg - 2011-04-06

    Great, now it works! I tried all the combinations, I could think of and they all did the expected output. Thanks!

  • Torsten Berg

    Torsten Berg - 2011-07-12


    would some maintainer mind to review this patch? It works for me and the missing "highlighting of the working text" could be transferred to a feature request, when this issue is closed.

  • Jeffrey Hobbs

    Jeffrey Hobbs - 2011-07-18
    • priority: 5 --> 6
    • assigned_to: das --> wordtech
  • Kevin Walzer

    Kevin Walzer - 2011-07-19

    Review of this patch is on my to-do list this week or next...will get to it very soon.

  • Adrian Robert

    Adrian Robert - 2011-08-18

    Uploaded new version of patch includeing Dvorak-Qwerty support (https://sourceforge.net/tracker/?func=detail&aid=3393315&group_id=12997&atid=112997).

  • Kevin Walzer

    Kevin Walzer - 2012-01-29
    • status: open --> closed