diff options
author | suzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-01 22:05:14 +0000 |
---|---|---|
committer | suzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-01 22:05:14 +0000 |
commit | 6c8a4312deb82e599b2c9695b2ec22aa1e298271 (patch) | |
tree | b524c5d2d193ca166da62b4906d19e899a850f47 /views/focus/accelerator_handler_touch.cc | |
parent | 38788d94bc411c89d6a0bbebe6e0628e401e43e4 (diff) | |
download | chromium_src-6c8a4312deb82e599b2c9695b2ec22aa1e298271.zip chromium_src-6c8a4312deb82e599b2c9695b2ec22aa1e298271.tar.gz chromium_src-6c8a4312deb82e599b2c9695b2ec22aa1e298271.tar.bz2 |
Integrate the new input method API for Views into Chromium.
This CL contains following changes:
1. Improve TextfieldViewsModel to support composition text.
2. Implement TextInputClient interface in NativeTextfieldViews.
3. Fix Textfield and native implementations to avoid calling TextfieldController::ContentsChanged() when the text is changed by calling Textfield::SetText() or AppendText().
4. Fix a bug in FocusManager that causes NativeTextfieldViewsTest.FocusTraversalTest to fail.
5. Fix accelerator_handler_touch.cc to send key events to the top-level widget's input method instance instead of the root view.
6. Do the same fix in extension_input_api.cc.
7. Hook InputMethod into WidgetGtk and WidgetWin.
BUG=75003
TEST=views_unittests --gtest_filter=NativeTextfieldViews*
Review URL: http://codereview.chromium.org/6675005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus/accelerator_handler_touch.cc')
-rw-r--r-- | views/focus/accelerator_handler_touch.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc index 3755e76..04dbec8 100644 --- a/views/focus/accelerator_handler_touch.cc +++ b/views/focus/accelerator_handler_touch.cc @@ -15,6 +15,7 @@ #include "views/accelerator.h" #include "views/events/event.h" #include "views/focus/focus_manager.h" +#include "views/ime/input_method.h" #include "views/touchui/touch_factory.h" #include "views/widget/root_view.h" #include "views/widget/widget_gtk.h" @@ -23,7 +24,7 @@ namespace views { namespace { -RootView* FindRootViewForGdkWindow(GdkWindow* gdk_window) { +Widget* FindWidgetForGdkWindow(GdkWindow* gdk_window) { gpointer data = NULL; gdk_window_get_user_data(gdk_window, &data); GtkWidget* gtk_widget = reinterpret_cast<GtkWidget*>(data); @@ -37,7 +38,7 @@ RootView* FindRootViewForGdkWindow(GdkWindow* gdk_window) { DLOG(WARNING) << "no WidgetGtk found for that GtkWidget"; return NULL; } - return widget->GetWidget()->GetRootView(); + return widget->GetWidget(); } #if defined(HAVE_XINPUT2) @@ -162,13 +163,21 @@ bool DispatchXEvent(XEvent* xev) { #endif GdkWindow* gwind = gdk_window_lookup_for_display(gdisp, xwindow); - - if (RootView* root = FindRootViewForGdkWindow(gwind)) { + Widget* widget = FindWidgetForGdkWindow(gwind); + if (widget) { + RootView* root = widget->GetRootView(); switch (xev->type) { case KeyPress: case KeyRelease: { Event::FromNativeEvent2 from_native; KeyEvent keyev(xev, from_native); + InputMethod* ime = widget->GetInputMethod(); + // Always dispatch key events to the input method first, to make sure + // that the input method's hotkeys work all time. + if (ime) { + ime->DispatchKeyEvent(keyev); + return true; + } return root->ProcessKeyEvent(keyev); } |