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

Unified Diff: views/focus/accelerator_handler_touch.cc

Issue 6675005: Integrate the new input method API for Views into Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/textfield/textfield_views_model_unittest.cc ('k') | views/focus/focus_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/focus/accelerator_handler_touch.cc
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc
index 3755e766a97412f5337f1dc414cdd7101cc7e67b..04dbec872aee9b7bda925efff225aa8225df9daf 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);
}
« no previous file with comments | « views/controls/textfield/textfield_views_model_unittest.cc ('k') | views/focus/focus_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698