Index: views/controls/textfield/native_textfield_gtk.cc |
diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc |
index b52a50bbd22aac612229dbff80dc1316b25ed276..7ba95050e7ba0f76d8392bc0c9b2943fa64f2656 100644 |
--- a/views/controls/textfield/native_textfield_gtk.cc |
+++ b/views/controls/textfield/native_textfield_gtk.cc |
@@ -14,6 +14,7 @@ |
#include "views/controls/textfield/gtk_views_entry.h" |
#include "views/controls/textfield/gtk_views_textview.h" |
#include "views/controls/textfield/textfield.h" |
+#include "views/widget/widget_gtk.h" |
namespace views { |
@@ -352,12 +353,23 @@ gboolean NativeTextfieldGtk::OnKeyPressEventHandler( |
} |
gboolean NativeTextfieldGtk::OnKeyPressEvent(GdkEventKey* event) { |
+ bool handled = false; |
+ |
Textfield::Controller* controller = textfield_->GetController(); |
if (controller) { |
Textfield::Keystroke ks(event); |
- return controller->HandleKeystroke(textfield_, ks); |
+ handled = controller->HandleKeystroke(textfield_, ks); |
} |
- return false; |
+ |
+ // If the controller doesn't handle the event, invite the widget's |
+ // keyboard event handler. This picks up accelerators that would otherwise be |
+ // lost to the widget. |
+ if (!handled) { |
+ WidgetGtk* widget = static_cast<WidgetGtk*>(GetWidget()); |
+ if (widget) |
+ handled = widget->HandleKeyboardEvent(event); |
+ } |
+ return handled; |
James Su
2010/12/02 08:37:24
This approach can cause problem as it handles a ke
|
} |
// static |