Thanks for the details.
I think that a better implementation of inputMethodEvent would be the following:
void QTMWidget::inputMethodEvent (QInputMethodEvent* event) { QString const & commit_string = event->commitString(); if (!commit_string.isEmpty()) { int key = 0; for (int i = 0; i < commit_string.size(); ++i) { QKeyEvent ev(QEvent::KeyPress, key, Qt::NoModifier, commit_string[i]); keyPressEvent(&ev); } } event->accept(); }
Could you be so nice to test if it is OK for you?
Actually I have some problems on my system with inputMethod. If I type `+a+b then I obtain àab and not àb as I expect. In this case the inputMethod handler is activated by the first dead key but apparently spourious keypresses are generated AFTER the inputMethodEvent has been handled and it seems to me a bug with QT (which I cannot reproduce on Linux). If you have a Mac, could you tell me what is the output of the above sequence after you apply your patch to the current TeXmacs?
Best Massimiiano
On 12 sept. 2010, at 07:23, Zou Hu wrote: Take MacOSX 10.6 as an example:
1. Go to "System Preferences -> Language and Text -> Input Sources", select one of the CJK input methods such as "Chinese Simplified".
2. Now download Chinese font (fireflysung) from texmacs website and extract it to ~/.TeXmacs directory. Start texmacs, click the menu item "Edit->Preference->Language->Chinese" and restart it.
3. Inside texmacs, press Cmd+Space to activate Chinese input method. Now you could input some English characters, then press space, and the corresponding Chinese characters will be inserted to texmacs editor.
在2010-09-11 22:39:23,"Gubinelli Massimiliano" <address@hidden> 写道:
>Dear Zoo,
> I will integrate the first patch on input methods. I would like to have a bit more of details on how it works and how to check it on a european system. Thanks.
>
>For the locate patch a better alternative should be found. A priori use_locate is true only if /bin/locate is available on the system (see init_texmacs.cpp:280) so I do not understand why you need to comment it. In any case a ifdef would be better.
>
>Best
>Massimiliano
>
>
>
>On 9 sept. 2010, at 15:06, Zou Hu wrote:
>
>> Hi all, in Qt-texmacs, input methods for CJK characters is unworkable. Attached is a patch for making it works just as x11-texmacs. It supports commitStrings but still not preeditStrings, but this is enough for most of the input methods.
>>
>> Also, to make texmacs able to find CJK fonts under Windows, I need to make a minor change to tt_file.cpp, since under Windows "use_locate" is false.
>>
>> Best.
>> <patch04.diff>_______________________________________________
>> Texmacs-dev mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/texmacs-dev
>
|