Tk Source Code

View Ticket
Login
Ticket UUID: 3205153
Title: Tk does not handle input-manager input on Mac OS X
Type: Bug Version: None
Submitter: arobert3434 Created on: 2011-03-10 08:02:55
Subsystem: 66. Aqua Window Operations Assigned To: wordtech
Priority: 6 Severity:
Status: Closed Last Modified: 2012-01-30 01:22:14
Resolution: None Closed By: wordtech
    Closed on: 2012-01-29 18:22:14
Description:
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.
User Comments: wordtech added on 2012-01-30 01:22:14:

allow_comments - 1

Fixed with commit at http://core.tcl.tk/tk/info/2ca757bfb2d9b3c2f2e073e5f324b98e73b9edaf. Thanks to Adrian Robert for the patch.

arobert3434 added on 2012-01-26 10:41:58:

File Added - 434056: tkc_inputManager_20120125.patch

arobert3434 added on 2012-01-11 09:09:50:

File Added - 432644: tkc_inputManager_20120110.patch

arobert3434 added on 2011-08-18 18:45:04:
Uploaded new version of patch includeing Dvorak-Qwerty support (https://sourceforge.net/tracker/?func=detail&aid=3393315&group_id=12997&atid=112997).

arobert3434 added on 2011-08-18 18:44:20:

File Added - 421448: tkc_inputManager_20110818.patch

wordtech added on 2011-07-19 21:37:28:
Review of this patch is on my to-do list this week or next...will get to it very soon.

treincke added on 2011-07-12 18:54:59:
Hi,

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.

arobert3434 added on 2011-04-18 14:36:56:

File Added - 409082: tkc_inputManager_20110418.patch

treincke added on 2011-04-07 03:15:53:
Great, now it works! I tried all the combinations, I could think of and they all did the expected output. Thanks!

arobert3434 added on 2011-04-05 00:57:45:
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?

arobert3434 added on 2011-04-05 00:56:19:

File Added - 406768: tkc_inputManager_20110404.patch

treincke added on 2011-04-04 02:16:09:
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.

arobert3434 added on 2011-04-01 12:55:05:
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!

treincke added on 2011-04-01 03:49:36:
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?

arobert3434 added on 2011-03-23 05:20:26:
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?

arobert3434 added on 2011-03-23 05:16:08:

File Added - 405109: tkc_inputManager_20110323.patch

arobert3434 added on 2011-03-23 05:15:26:

File Deleted - 405108:

arobert3434 added on 2011-03-23 05:15:12:

File Added - 405108: tkc_inputManager_20110323.patch

arobert3434 added on 2011-03-22 05:28:13:
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.

arobert3434 added on 2011-03-22 05:27:23:

File Added - 404989: tkc_inputManager_20110322.patch

das added on 2011-03-12 00:10:07:
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...

treincke added on 2011-03-11 19:41:34:
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.

arobert3434 added on 2011-03-11 03:14:40:
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.

treincke added on 2011-03-11 02:36:24:
This is the same as bug 2907388, right?

Attachments: