summaryrefslogtreecommitdiffstats
path: root/views/widget
diff options
context:
space:
mode:
Diffstat (limited to 'views/widget')
-rw-r--r--views/widget/widget_gtk.cc9
-rw-r--r--views/widget/widget_gtk.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 2f21358..c3b0814 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -849,6 +849,15 @@ View* WidgetGtk::GetFocusTraversableParentView() {
return NULL;
}
+void WidgetGtk::ClearNativeFocus() {
+ DCHECK(type_ != TYPE_CHILD);
+ if (!GetNativeView()) {
+ NOTREACHED();
+ return;
+ }
+ gtk_window_set_focus(GTK_WINDOW(GetNativeView()), NULL);
+}
+
////////////////////////////////////////////////////////////////////////////////
// WidgetGtk, protected:
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h
index 3b95140..816a263 100644
--- a/views/widget/widget_gtk.h
+++ b/views/widget/widget_gtk.h
@@ -194,6 +194,9 @@ class WidgetGtk
virtual FocusTraversable* GetFocusTraversableParent();
virtual View* GetFocusTraversableParentView();
+ // Clears the focus on the native widget having the focus.
+ virtual void ClearNativeFocus();
+
protected:
// If widget containes another widget, translates event coordinates to the
// contained widget's coordinates, else returns original event coordinates.