FYI: How to implement text service input with IME

Made a cool mod to CEF that you'd like to share with others? Discuss CEF modifications here, and view modifications that others have made.

FYI: How to implement text service input with IME

Postby heshiming » Thu Jan 28, 2010 9:17 am

The current revision of CEF references test_shell, which contains no implementation of IME (Input Method Editor) based keyboard input (mostly for East Asian Languages) and others such as voice based input. Form elements in chromium aren't using the Windows Edit Control, therefore the host window has to implement specific IME details. Otherwise IME input will either be broken or impossible.

Luckily, we have a good reference in the chromium project itself, the existing implementations are suitable for the current revision of CEF. The steps to provide IME support in CEF are as below:
1. Include chromium\src\chrome\browser\ime_input.cc and chromium\src\chrome\browser\ime_input.h in libcef_static project, no modification is needed.
2. Consult chromium\src\chrome\browser\renderer_host\render_widget_host_view_win.cc and chromium\src\chrome\renderer\render_widget.cc for usage on ImeInput class and required message handlers.
3. In CEF's webwidget_host.h and webwidget_host.cc, add the ImeInput instance, message handlers for WM_IME_SETCONTEXT; WM_IME_STARTCOMPOSITION; WM_IME_COMPOSITION; WM_IME_ENDCOMPOSITION, and other details such as OnInputLangChange and IMEUpdateStatus.
4. Because CEF is not using WTL, it's important to review |bHandled| argument in original message handlers (in render_widget_host_view_win.cc) to decide whether to return "0" or "DefWindowProc".
5. Chromium's implementation involves IPC, but CEF doesn't, we can control |webwidget_| directly, like the way "render_widget.cc" did (calling WebKit's internal support for IME).

This is a short guide for anyone who would like to include the IME capability in CEF based apps. And to Marshall, you probably would also need custom IME implementation for the new edition of CEF you talked about.
heshiming
Techie
 
Posts: 29
Joined: Fri Jul 31, 2009 1:59 am

Re: FYI: How to implement text service input with IME

Postby magreenblatt » Fri Jan 29, 2010 9:32 am

Thanks for this information. If the current Chromium browser process window is embedded in the client application (as proposed for the next version of CEF) would it still be necessary for the client application to implement this directly?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: FYI: How to implement text service input with IME

Postby heshiming » Fri Jan 29, 2010 8:23 pm

magreenblatt wrote:Thanks for this information. If the current Chromium browser process window is embedded in the client application (as proposed for the next version of CEF) would it still be necessary for the client application to implement this directly?

Well I thought you were going to create something similar to chromium itself, that talks to background "render_widget" processes. This way, the "render_widgets" are already IME-aware, but you are still responsible for processing these window messages and dispatch them through IPC.

On the other hand, if the embedded chromium can process messages itself, it's probably okay to ignore it.
heshiming
Techie
 
Posts: 29
Joined: Fri Jul 31, 2009 1:59 am

Re: FYI: How to implement text service input with IME

Postby googol4u » Mon Mar 22, 2010 3:05 am

heshiming wrote:The current revision of CEF references test_shell, which contains no implementation of IME (Input Method Editor) based keyboard input (mostly for East Asian Languages) and others such as voice based input. Form elements in chromium aren't using the Windows Edit Control, therefore the host window has to implement specific IME details. Otherwise IME input will either be broken or impossible.

Luckily, we have a good reference in the chromium project itself, the existing implementations are suitable for the current revision of CEF. The steps to provide IME support in CEF are as below:
1. Include chromium\src\chrome\browser\ime_input.cc and chromium\src\chrome\browser\ime_input.h in libcef_static project, no modification is needed.
2. Consult chromium\src\chrome\browser\renderer_host\render_widget_host_view_win.cc and chromium\src\chrome\renderer\render_widget.cc for usage on ImeInput class and required message handlers.
3. In CEF's webwidget_host.h and webwidget_host.cc, add the ImeInput instance, message handlers for WM_IME_SETCONTEXT; WM_IME_STARTCOMPOSITION; WM_IME_COMPOSITION; WM_IME_ENDCOMPOSITION, and other details such as OnInputLangChange and IMEUpdateStatus.
4. Because CEF is not using WTL, it's important to review |bHandled| argument in original message handlers (in render_widget_host_view_win.cc) to decide whether to return "0" or "DefWindowProc".
5. Chromium's implementation involves IPC, but CEF doesn't, we can control |webwidget_| directly, like the way "render_widget.cc" did (calling WebKit's internal support for IME).

This is a short guide for anyone who would like to include the IME capability in CEF based apps. And to Marshall, you probably would also need custom IME implementation for the new edition of CEF you talked about.


I have some issues concerning IME. Is it the same reason?

http://code.google.com/p/chromiumembedd ... tail?id=77

http://code.google.com/p/chromium/issue ... l?id=38417
googol4u
Newbie
 
Posts: 4
Joined: Fri Dec 25, 2009 8:33 am

Re: FYI: How to implement text service input with IME

Postby shileiyu » Thu Dec 09, 2010 12:13 pm

googol4u wrote:
heshiming wrote:The current revision of CEF references test_shell, which contains no implementation of IME (Input Method Editor) based keyboard input (mostly for East Asian Languages) and others such as voice based input. Form elements in chromium aren't using the Windows Edit Control, therefore the host window has to implement specific IME details. Otherwise IME input will either be broken or impossible.

Luckily, we have a good reference in the chromium project itself, the existing implementations are suitable for the current revision of CEF. The steps to provide IME support in CEF are as below:
1. Include chromium\src\chrome\browser\ime_input.cc and chromium\src\chrome\browser\ime_input.h in libcef_static project, no modification is needed.
2. Consult chromium\src\chrome\browser\renderer_host\render_widget_host_view_win.cc and chromium\src\chrome\renderer\render_widget.cc for usage on ImeInput class and required message handlers.
3. In CEF's webwidget_host.h and webwidget_host.cc, add the ImeInput instance, message handlers for WM_IME_SETCONTEXT; WM_IME_STARTCOMPOSITION; WM_IME_COMPOSITION; WM_IME_ENDCOMPOSITION, and other details such as OnInputLangChange and IMEUpdateStatus.
4. Because CEF is not using WTL, it's important to review |bHandled| argument in original message handlers (in render_widget_host_view_win.cc) to decide whether to return "0" or "DefWindowProc".
5. Chromium's implementation involves IPC, but CEF doesn't, we can control |webwidget_| directly, like the way "render_widget.cc" did (calling WebKit's internal support for IME).

This is a short guide for anyone who would like to include the IME capability in CEF based apps. And to Marshall, you probably would also need custom IME implementation for the new edition of CEF you talked about.


I have some issues concerning IME. Is it the same reason?

http://code.google.com/p/chromiumembedd ... tail?id=77

http://code.google.com/p/chromium/issue ... l?id=38417


Because test_shell response WM_IME_CHAR and forware the message to DefWindowProc again.
so system generated a duplicated WM_CHAR
shileiyu
Newbie
 
Posts: 9
Joined: Thu Dec 09, 2010 10:52 am


Return to Modifications Forum

Who is online

Users browsing this forum: No registered users and 15 guests