summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 19:22:03 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 19:22:03 +0000
commitcbea91afd0211e678248c910cb5fc719e8573029 (patch)
tree5e4bda7aa673ac38dd7cbae6b335633e71890892 /views
parent18662b90ae6caf7c9798b3b621f7e7ebd01558e8 (diff)
downloadchromium_src-cbea91afd0211e678248c910cb5fc719e8573029.zip
chromium_src-cbea91afd0211e678248c910cb5fc719e8573029.tar.gz
chromium_src-cbea91afd0211e678248c910cb5fc719e8573029.tar.bz2
Initial focus fix on x11/gtk
The initial focus on x11/gtk was not working propertly. It was jsut working by coincident, and chromeos's compact location bar revealed the bug. This CL fixes by setting a focus when the window itself gets focus. BUG=34159 TEST=on chromeos build, omnibox should have a focus on a new window. Review URL: http://codereview.chromium.org/756002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/widget_gtk.cc6
-rw-r--r--views/widget/widget_gtk.h5
2 files changed, 9 insertions, 2 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 78f301a..796e50b 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -851,10 +851,12 @@ gboolean WidgetGtk::OnFocusIn(GtkWidget* widget, GdkEventFocus* event) {
return false;
// See description of got_initial_focus_in_ for details on this.
- if (!got_initial_focus_in_)
+ if (!got_initial_focus_in_) {
got_initial_focus_in_ = true;
- else
+ SetInitialFocus();
+ } else {
focus_manager_->RestoreFocusedView();
+ }
return false;
}
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h
index 185be3f..dbf4627 100644
--- a/views/widget/widget_gtk.h
+++ b/views/widget/widget_gtk.h
@@ -125,6 +125,11 @@ class WidgetGtk
// Invoked when the active status changes.
virtual void IsActiveChanged() {}
+ // Sets initial focus on a new window. On X11/Gtk, window creation
+ // is asynchronous and a focus request has to be made after a window
+ // gets created. This will not be called on a TYPE_CHILD widget.
+ virtual void SetInitialFocus() {}
+
// Gets the WidgetGtk in the userdata section of the widget.
static WidgetGtk* GetViewForNative(GtkWidget* widget);