diff options
Diffstat (limited to 'views/controls/native_control_gtk.cc')
-rw-r--r-- | views/controls/native_control_gtk.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/views/controls/native_control_gtk.cc b/views/controls/native_control_gtk.cc index 4aa6411..49453ef 100644 --- a/views/controls/native_control_gtk.cc +++ b/views/controls/native_control_gtk.cc @@ -73,6 +73,26 @@ void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) { // Update the newly created GtkWdigetwith any resident enabled state. gtk_widget_set_sensitive(native_view(), IsEnabled()); + + // Listen for focus change event to update the FocusManager focused view. + g_signal_connect(G_OBJECT(native_control), "focus-in-event", + G_CALLBACK(CallFocusIn), this); +} + +// static +void NativeControlGtk::CallFocusIn(GtkWidget* widget, + GdkEventFocus* event, + NativeControlGtk* control) { + FocusManager* focus_manager = + FocusManager::GetFocusManagerForNativeView(widget); + if (!focus_manager) { + // TODO(jcampan): http://crbug.com/21378 Reenable this NOTREACHED() when the + // options page is only based on views. + // NOTREACHED(); + NOTIMPLEMENTED(); + return; + } + focus_manager->SetFocusedView(control->focus_view()); } } // namespace views |