From cec6c9c550f44741c7acacfd5d3f67e919110c4c Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Tue, 29 Sep 2009 17:40:13 +0000 Subject: See original review at http://codereview.chromium.org/251001/show This CL hooks the focus traversal for the TabbedPaneView on Linux with toolkit views. It also has few focus related fixed (focus with buttons, clearing focus effectively in the focus manager). BUG=None TEST=Run the view_examples app. Press tab to move the focus. Try the different tabs. Review URL: http://codereview.chromium.org/246030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27504 0039d316-1c4b-4281-b951-d872f2087c98 --- views/focus/focus_manager_gtk.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'views/focus') diff --git a/views/focus/focus_manager_gtk.cc b/views/focus/focus_manager_gtk.cc index 93b9cb7..3038d93 100644 --- a/views/focus/focus_manager_gtk.cc +++ b/views/focus/focus_manager_gtk.cc @@ -8,11 +8,20 @@ #include "base/logging.h" #include "views/widget/widget_gtk.h" +#include "views/window/window_gtk.h" namespace views { void FocusManager::ClearNativeFocus() { - gtk_widget_grab_focus(widget_->GetNativeView()); + GtkWidget* gtk_widget = widget_->GetNativeView(); + if (!gtk_widget) { + NOTREACHED(); + return; + } + + // Since only top-level WidgetGtk have a focus manager, the native view is + // expected to be a GtkWindow. + gtk_window_set_focus(GTK_WINDOW(gtk_widget), NULL); } void FocusManager::FocusNativeView(gfx::NativeView native_view) { -- cgit v1.1