Cross-platform IME support

496 views
Skip to first unread message

ARATA Mizuki

unread,
Apr 4, 2017, 9:07:02 AM4/4/17
to wx-...@googlegroups.com
Hi all,

Reading the recent post by Artur, I feel obliged to share what I have been doing to support IME in wxWidgets.

My main interest is to support IME in wxStyledTextCtrl, since the lack of support for IME renders all the wxSTC-based text editors inappropriate for editing Japanese text.

The following platforms are currently supported:
MSW (via the classic IMM32), OSX/Cocoa, and GTK.

The work-in-progress branch is available here:
https://github.com/minoki/wxWidgets/commits/experimental-ime-support
(Note: This branch is subject to force-push and don't rely on it.)

Demo:
https://vimeo.com/211472594

What I have done so far:
- Define some classes and events to handle IME. (Though the interface is rather messy and needs to be redesigned)
- Implement the IME-related events for each platform (MSW/OSX/GTK).
- Let wxSTC handle IME through the new API. (This is relatively easy because the recent Scintilla has support for 'inline IME')

What remains to be done:
- Advanced IME support.
- Let wxRichTextCtrl handle IME.

I have little time to work on this, but I hope that some functionality could be merged in before wxWidgets 3.2.


Regards,
ARATA Mizuki

Vadim Zeitlin

unread,
Apr 6, 2017, 6:10:46 PM4/6/17
to wx-...@googlegroups.com
On Tue, 4 Apr 2017 22:06:56 +0900 ARATA Mizuki wrote:

AM> What I have done so far:
AM> - Define some classes and events to handle IME. (Though the interface
AM> is rather messy and needs to be redesigned)
AM> - Implement the IME-related events for each platform (MSW/OSX/GTK).
AM> - Let wxSTC handle IME through the new API. (This is relatively easy
AM> because the recent Scintilla has support for 'inline IME')

This is very nice, thanks! I'm afraid I can't really help much with this,
but it would be great to discuss the final API here if possible.

AM> What remains to be done:
AM> - Advanced IME support.

Sorry, what does this mean?

AM> - Let wxRichTextCtrl handle IME.

Is it too naive to hope that IME can be completely hidden from the
application-level code, i.e. that the application would just receive the
correct wxEVT_CHAR(S?) events?

AM> I have little time to work on this, but I hope that some functionality
AM> could be merged in before wxWidgets 3.2.

Sure, this would be definitely very useful.

Thanks again,
VZ

Artur Sochirca

unread,
Apr 14, 2017, 11:15:48 AM4/14/17
to wx-...@googlegroups.com
Dear Mizuki, Dear all,

I've checked the changes in the experimental IME branch.
They are similar to the patch I intended to submit, but they a more
complete and better platform-independcy-wise.

So instead of submitting the patch, I'd rather integrate/test the
changes made in this IME branch.
I'm just not sure whether it is best to wait until the
final/intermediate version is merged to trunk/master.

Regards,
Artur Sochirca

Vadim Zeitlin

unread,
Apr 15, 2017, 8:41:12 AM4/15/17
to wx-...@googlegroups.com
On Fri, 14 Apr 2017 18:15:47 +0300 Artur Sochirca wrote:

AS> So instead of submitting the patch, I'd rather integrate/test the
AS> changes made in this IME branch.

Could you please make a PR for them?

TIA,
VZ

Artur Sochirca

unread,
Apr 19, 2017, 3:02:30 AM4/19/17
to wx-...@googlegroups.com

Hello Vadim,

Do you mean a PR made for the changes from " experimental-ime-support" branch?
This is to be done by the author, right?

Regards,
Artur

johnsonj joshua

unread,
Jun 4, 2017, 7:35:23 AM6/4/17
to wx-dev
Mizuki:

Thank you for your hard works!
There seems to be some  minor bugs but it appears good working.


ime caret position implemented Demo On wxGtk:

https://youtu.be/7sFAz6BTUGw

I am playing with it but I have found a inconvinient thing.
Is it possible to move or delegate  OnTextInput event in stc.cpp.in to scintillaWX.cpp?

report bugs:   X bad, O good
                       back-space  Handling while composiong                 indicator attribute
wxMsw                                X                                                                                 O
wxGtk                                  O                                                                                 X


cheers to you!


johnsonj joshua

unread,
Jun 11, 2017, 3:41:14 AM6/11/17
to wx-dev
Mizuki:

Woud you please take a review at this patch?

Demo:  https://youtu.be/w8XNc9EFhdk

here are changed:
1. cursor position has been implemented.
  - add charaacter one by one  instead segment of characters.

2. SC_INDICATOR_BLOCK for background color attribute has been introduced.
 - The problem of one line style only has been fixed.

3. candidate window positon has been fixed.

4. recording macro is escaped.

Now I am struggling with scintilla ime on  wxWin .
very troublesome!
imeOnWxgtk0611.patch

johnsonj joshua

unread,
Jun 13, 2017, 10:25:28 AM6/13/17
to wx-dev
ARATA Mizuki:

It appears for VK_BACK and VK_ESCAPE to slip out of hands of IME.
They should make comosition to be canceled,
but no ime event happens.

their behavior differs from notepad, wordpad, or SciTE.

johnsonj joshua

unread,
Jun 16, 2017, 9:45:59 AM6/16/17
to wx-dev
It turnes out no ime event happens when composition string is empty with VK_BACK or VK_ESCAPE.

johnsonj joshua

unread,
Jun 21, 2017, 9:22:11 AM6/21/17
to wx-dev
too many dirty patched for Demonstration of inline ime on wxMSW.

demo : https://youtu.be/dtWGqf3Zhe0

it appears to work good but just for possibility only.

johnsonj joshua

unread,
Jun 30, 2017, 10:52:24 AM6/30/17
to wx-dev
sorry for too many dirty patchs on wxMSW.
I want working version first.

patch file attached for a review.



wxime0630ForAReview.patch

Vadim Zeitlin

unread,
Jul 2, 2017, 8:22:54 PM7/2/17
to wx-...@googlegroups.com
On Fri, 30 Jun 2017 07:52:24 -0700 (PDT) johnsonj joshua wrote:

jj> sorry for too many dirty patchs on wxMSW.
jj> I want working version first.
jj>
jj> patch file attached for a review.

Hi,

Could you please submit it as a pull request to GitHub so that we could
check that the patch passes CI checks?

Thanks in advance,
VZ

johnsonj joshua

unread,
Jul 3, 2017, 9:10:49 AM7/3/17
to wx-dev
VZ:

I think this is too early stage to see if it passes through CI checks.
It needs far more to be discussed, especially on wxMSW.
I hope Mizuki sang, who has built ime wxevent system, arrange this.
I think it is not me that pull the request but him.


johnsonj joshua

unread,
Jul 13, 2017, 1:07:32 PM7/13/17
to wx-dev
solved the problem about VK_BACK on japanese ime.
it sends WM_IME_COMPOSITION but neither  GCS_COMPSTR nor GCS_RESULTSTR.

            if ((lParam & GCS_COMPSTR) || ((wParam == 0) && (lParam == 0))) // VK_BACK


2017년 6월 13일 화요일 오후 11시 25분 28초 UTC+9, johnsonj joshua 님의 말:

johnsonj joshua

unread,
Jul 13, 2017, 1:13:15 PM7/13/17
to wx-dev
I need more information on wxTextInput messages.
I can not understand what they are designed for.

They seem to be useless for implementing reconvert string feature.

johnsonj joshua

unread,
Dec 13, 2018, 6:56:27 AM12/13/18
to wx-dev
good working on gtk an msw,
but how about osx?

Vadim Zeitlin

unread,
Dec 13, 2018, 4:43:37 PM12/13/18
to wx-...@googlegroups.com
On Thu, 13 Dec 2018 03:56:26 -0800 (PST) johnsonj joshua wrote:

jj> but how about osx?

I don't (often) use macOS, could you please explain what exactly doesn't
work there?

Regards,
VZ

johnsonj joshua

unread,
Dec 14, 2018, 10:27:57 AM12/14/18
to wx-dev
sorry, me neither!
I wonder there is anybody who have tried this ime code on osx.

Frédéric

unread,
Dec 14, 2018, 11:21:18 AM12/14/18
to wx-...@googlegroups.com
> I wonder there is anybody who have tried this ime code on osx.

what is IME?

Igor Korot

unread,
Dec 14, 2018, 12:28:02 PM12/14/18
to wx-dev
Hi, Frederic,

On Fri, Dec 14, 2018 at 10:21 AM Frédéric <ufos...@gmail.com> wrote:
>
> > I wonder there is anybody who have tried this ime code on osx.
>
> what is IME?

It a mean to enter Asian hieroglyphs...

Thank you.

>
> --
> To unsubscribe, send email to wx-dev+un...@googlegroups.com
> or visit http://groups.google.com/group/wx-dev
>
Reply all
Reply to author
Forward
0 new messages