summaryrefslogtreecommitdiffstats
path: root/views/focus/focus_manager_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/focus/focus_manager_gtk.cc')
-rw-r--r--views/focus/focus_manager_gtk.cc11
1 files changed, 10 insertions, 1 deletions
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) {