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

Unified Diff: views/controls/textfield/native_textfield_gtk.cc

Issue 5254011: Forward unhandled KeyEvents to WidgetGtk's HandleKeyboardEvent() in native textfields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/views
Patch Set: Code Review Created 10 years, 1 month 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/native_textfield_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..19437256d6c59187e5a7feff62aaadc8a6b1b3a6 100644
--- a/views/controls/textfield/native_textfield_gtk.cc
+++ b/views/controls/textfield/native_textfield_gtk.cc
@@ -361,6 +361,18 @@ gboolean NativeTextfieldGtk::OnKeyPressEvent(GdkEventKey* event) {
}
// static
+gboolean NativeTextfieldGtk::OnActivateHandler(
+ GtkWidget* widget,
+ NativeTextfieldGtk* textfield) {
+ return textfield->OnActivate();
+}
+
+gboolean NativeTextfieldGtk::OnActivate() {
+ return textfield_->GetParent()->AcceleratorPressed(
+ Accelerator(app::VKEY_RETURN, false, false, false));
James Su 2010/12/01 18:35:56 It's probably better to call the widget's HandleKe
+}
+
+// static
gboolean NativeTextfieldGtk::OnChangedHandler(
GtkWidget* widget,
NativeTextfieldGtk* textfield) {
@@ -409,6 +421,9 @@ void NativeTextfieldGtk::NativeControlCreated(GtkWidget* widget) {
}
g_signal_connect(widget, "key-press-event",
G_CALLBACK(OnKeyPressEventHandler), this);
+ // In order to properly trigger Accelerators bound to VKEY_RETURN, we need to
+ // send an event when the widget gets the activate signal.
+ g_signal_connect(widget, "activate", G_CALLBACK(&OnActivateHandler), this);
James Su 2010/12/01 18:35:56 Only GtkEntry has "activate" signal.
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « views/controls/textfield/native_textfield_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698