summaryrefslogtreecommitdiffstats
path: root/views/widget
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-19 00:02:07 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-19 00:02:07 +0000
commitf56367ccb42c6af4a609b34a6b0f86b230ef8542 (patch)
treed0ee3714a58ae40d149c6f8c2446534c290406a4 /views/widget
parent9870326b1412b1f3804eed8d9b6402ac60ddf8f0 (diff)
downloadchromium_src-f56367ccb42c6af4a609b34a6b0f86b230ef8542.zip
chromium_src-f56367ccb42c6af4a609b34a6b0f86b230ef8542.tar.gz
chromium_src-f56367ccb42c6af4a609b34a6b0f86b230ef8542.tar.bz2
*Add WidgetGtk::ClearNativeFocus so that subclass can implement cutomized behavior when clearning native focus.
This is necessary in ScreenLocker as the focus has to be set to the widget that is grabbing all input focus. * PasswordField that will set focus it itself when mouse is clicked. This is necessary again when the input is grabbed by other widget because the gtk textfield will never receive mouse event. * fix minor bug : locating the grab widget in wrong place. Review URL: http://codereview.chromium.org/2811015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50303 0039d316-1c4b-4281-b951-d872f2087c98
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.