| Index: chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc
|
| diff --git a/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc
|
| index bb263c0d9d93ec795f3b3f37bf2c6316c1d21a8a..d6e18f6427109a9e209b23bea398ab6bfe6dab3a 100644
|
| --- a/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc
|
| +++ b/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.cc
|
| @@ -19,6 +19,7 @@
|
| #include "ui/base/ime/composition_text_util_pango.h"
|
| #include "ui/base/ime/text_input_client.h"
|
| #include "ui/events/event.h"
|
| +#include "ui/events/keycodes/keyboard_code_conversion_x.h"
|
| #include "ui/gfx/x/x11_types.h"
|
|
|
| namespace libgtk2ui {
|
| @@ -191,8 +192,16 @@ void X11InputMethodContextImplGtk2::ResetXModifierKeycodesCache() {
|
|
|
| GdkEvent* X11InputMethodContextImplGtk2::GdkEventFromNativeEvent(
|
| const base::NativeEvent& native_event) {
|
| - const XKeyEvent& xkey = native_event->xkey;
|
| - DCHECK(xkey.type == KeyPress || xkey.type == KeyRelease);
|
| + XEvent xkeyevent;
|
| + if (native_event->type == GenericEvent) {
|
| + // If this is an XI2 key event, build a matching core X event, to avoid
|
| + // having two cases for every use.
|
| + ui::InitXKeyEventFromXIDeviceEvent(*native_event, &xkeyevent);
|
| + } else {
|
| + DCHECK(native_event->type == KeyPress || native_event->type == KeyRelease);
|
| + xkeyevent.xkey = native_event->xkey;
|
| + }
|
| + XKeyEvent& xkey = xkeyevent.xkey;
|
|
|
| // Get a GdkDisplay.
|
| GdkDisplay* display = gdk_x11_lookup_xdisplay(xkey.display);
|
| @@ -207,7 +216,7 @@ GdkEvent* X11InputMethodContextImplGtk2::GdkEventFromNativeEvent(
|
| // Get a keysym and group.
|
| KeySym keysym = NoSymbol;
|
| guint8 keyboard_group = 0;
|
| - XLookupString(&native_event->xkey, NULL, 0, &keysym, NULL);
|
| + XLookupString(&xkey, NULL, 0, &keysym, NULL);
|
| GdkKeymap* keymap = gdk_keymap_get_for_display(display);
|
| GdkKeymapKey* keys = NULL;
|
| guint* keyvals = NULL;
|
|
|