Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Issue 8342026: Get basic KeyEvents working in RWHVA (Closed)

Created:
9 years, 2 months ago by Ben Goodger (Google)
Modified:
9 years, 2 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, dpranke-watch+content_chromium.org
Visibility:
Public.

Description

Get KeyEvents to limp in Aura. This assumes the desktop host is going to send two aura::KeyEvents for every keydown - one raw key down, and one char. They share the same ET, but the first has is_char = false, the second is_char = true. http://crbug.com/99757 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=106374

Patch Set 1 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -12 lines) Patch
M content/browser/renderer_host/web_input_event_aura.cc View 2 chunks +16 lines, -1 line 0 comments Download
M content/browser/renderer_host/web_input_event_aurax11.cc View 2 chunks +5 lines, -3 lines 0 comments Download
M ui/aura/desktop_host_linux.cc View 1 chunk +9 lines, -3 lines 0 comments Download
M ui/aura/desktop_host_win.h View 1 chunk +3 lines, -0 lines 0 comments Download
M ui/aura/desktop_host_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/aura/event.h View 2 chunks +5 lines, -1 line 0 comments Download
M ui/aura/event.cc View 1 chunk +5 lines, -3 lines 0 comments Download
M views/widget/native_widget_aura.cc View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
Ben Goodger (Google)
OK, this actually looks like the real bandaid. I'm not going to bother with the ...
9 years, 2 months ago (2011-10-19 04:53:41 UTC) #1
Hironori Bono
Greetings Ben, This is just for your information. On 2011/10/19 04:53:41, Ben Goodger (Google) wrote: ...
9 years, 2 months ago (2011-10-19 05:45:31 UTC) #2
Hironori Bono
Greetings, On 2011/10/19 05:45:31, hbono wrote: > From my rusty knowledge about X, XLookupKeysym() looks ...
9 years, 2 months ago (2011-10-19 10:43:53 UTC) #3
sadrul
Quite interesting. The change to make keyevents work in X11 is here: http://codereview.chromium.org/8353005/
9 years, 2 months ago (2011-10-19 13:05:26 UTC) #4
Ben Goodger (Google)
So, I am beginning to think DesktopHostLinux should send two key events, just like Windows ...
9 years, 2 months ago (2011-10-19 14:21:38 UTC) #5
sadrul
On 2011/10/19 14:21:38, Ben Goodger (Google) wrote: > So, I am beginning to think DesktopHostLinux ...
9 years, 2 months ago (2011-10-19 14:36:10 UTC) #6
Ben Goodger (Google)
Peng, to bring you up to speed... in the Aura environment we are talking about ...
9 years, 2 months ago (2011-10-19 14:39:11 UTC) #7
Ben Goodger (Google)
On Wed, Oct 19, 2011 at 7:36 AM, <sadrul@chromium.org> wrote: > On 2011/10/19 14:21:38, Ben ...
9 years, 2 months ago (2011-10-19 14:44:09 UTC) #8
Ben Goodger (Google)
OK, I updated this. The DesktopHostLinux should send another KeyEvent passing true through the ctor. ...
9 years, 2 months ago (2011-10-19 16:15:32 UTC) #9
Peng
I am not very familiar with IME on Windows, but I think on Windows, IME ...
9 years, 2 months ago (2011-10-19 16:16:49 UTC) #10
sadrul
LGTM
9 years, 2 months ago (2011-10-19 20:24:56 UTC) #11
James Su
9 years, 2 months ago (2011-10-20 01:45:51 UTC) #12
On 2011/10/19 14:21:38, Ben Goodger (Google) wrote:
> So, I am beginning to think DesktopHostLinux should send two key events,
> just like Windows ends up doing. One for keypress and one for char. We would
> have to add a flag to aura::KeyEvent |is_char| to disambiguate. I don't know
> if we can introduce a new event type without breaking the universe.
> 
> In NativeWidgetAura, we would discard the |is_char| ones.
> In RWHVA, we'd fwd them just like keypress.
> 
> The reason for doing this is so that we propagate an identical event
> sequence on windows and linux. This makes it possible for the IME folk to
> write an InputMethodAura that actually processes the char events properly in
> NativeWidgetAura.

On Windows, keyboard layouts and IMEs are handled in a unified (well, almost)
way. All KEYDOWN/KEYUP events are dispatched to the system IME or keyboard
layout engine (by USER.EXE/IMM)  before being dispatched to the application. And
the CHAR events are actually synthesized by the keyboard layout/IME layer
(unlike KEYDOWN/KEYUP, which are kind of hardware events). So InputMethodWin is
merely for receiving results from the system keyboard layout/IME. It's actually
nothing to do with keyboard event handling.

But on Linux, keyboard layouts and input methods are handled differently. All
keyboard events are sent to the application directly, it's the application's
responsibility to forward them to the system input method, and receive results
from it. If there is no input method or the input method cannot handle the key
events, then the application needs to query the X server by itself to get the
correct characters according to the current keyboard layout configuration.
In chrome, InputMethodIBus/InputMethodGtk takes the responsibility for both
sending the keyboard events to the system input method and querying the X server
for characters if a keyboard layout is used instead.

So if we need to synthesize CHAR events in DesktopHostLinux, then IMHO the most
appropriate way is to incorporate InputMethodIBus/InputMethodGtk into
DesktopHostLinux and handle this logic there. We also need to do the same thing
on Windows that incorporate InputMethodWin into DesktopHostWin to handle IME
related logics.

Then we can have InputMethodAura as a fake input method implementation which
simply receives results from the real input method implementation owned by the
DesktopHost class.

But whether or not to use a CHAR event (is_char in aura::Event) to transfer the
character results from InputMethodIBus/Win/Gtk to the InputMethodAura is still
debatable, because we need to handle not only results from keyboard layouts
(usually CHAR events on Windows), but also results from input methods. I think
the easiest way for us is to let InputMethodAura implement
views::TextInputClient interface, so that both of these results can be
transfered via this interface from InputMethodIBus/Gtk/Win to InputMethodAura
and then to RenderWidgetHostViewAura. Then we can synthesize Webkit::Char events
inside TextInputClient::InsertChar() method implemented by either
InputMethodAura or RenderWidgetHostViewAura.

With this approach, we should not need to dispatch Char events down to the
aura/views widget tree at all. Just like what we have done in the original pure
views implementation (NativeWidgetWin does not dispatch Char events down to
views tree at all).

> 
> Sadrul, WDYT?
> 
> -Ben
> 
> On Wed, Oct 19, 2011 at 6:05 AM, <mailto:sadrul@chromium.org> wrote:
> 
> > Quite interesting. The change to make keyevents work in X11 is here:
> >
>
http://codereview.chromium.**org/8353005/%3Chttp://codereview.chromium.org/83...>
> >
> >
>
http://codereview.chromium.**org/8342026/%3Chttp://codereview.chromium.org/83...>
> >

Powered by Google App Engine
This is Rietveld 408576698