summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 18:02:18 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 18:02:18 +0000
commit1010aa34547be12e63f922824fb9510d88686294 (patch)
tree47c0c390173a01573d19c87830ff546b08d67fbb /views
parent1bc869d5bb06728b63a3e9a603605e27ead5f985 (diff)
downloadchromium_src-1010aa34547be12e63f922824fb9510d88686294.zip
chromium_src-1010aa34547be12e63f922824fb9510d88686294.tar.gz
chromium_src-1010aa34547be12e63f922824fb9510d88686294.tar.bz2
Don't store/restore focus when window is activated/deactivated on linux.
GTK can restore focus if the native widget has a focus, and views always remembers the focused_view, so there is no need to store/restore on linux for this case. Opening it (like wrench menu) was causing the issues in bugs because it changes window activation. BUG=70032,chromium-os:8829 TEST=see bugs TEST= Review URL: http://codereview.chromium.org/6691052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80809 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/focus/focus_manager_unittest.cc6
-rw-r--r--views/widget/widget_gtk.cc5
2 files changed, 6 insertions, 5 deletions
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index 75d3b72..11662df 100644
--- a/views/focus/focus_manager_unittest.cc
+++ b/views/focus/focus_manager_unittest.cc
@@ -966,6 +966,11 @@ TEST_F(FocusManagerTest, FocusNativeControls) {
EXPECT_EQ(tab_button, GetFocusManager()->GetFocusedView());
}
+
+// On linux, we don't store/restore focused view because gtk handles
+// this (and pure views will be the same).
+#if defined(OS_WIN)
+
// Test that when activating/deactivating the top window, the focus is stored/
// restored properly.
TEST_F(FocusManagerTest, FocusStoreRestore) {
@@ -1042,6 +1047,7 @@ TEST_F(FocusManagerTest, FocusStoreRestore) {
EXPECT_TRUE(listener.focus_changes()[1] == ViewPair(null_view, view));
*/
}
+#endif
TEST_F(FocusManagerTest, ContainsView) {
View* view = new View();
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 15394c4..6a31bb8 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -1222,8 +1222,6 @@ gboolean WidgetGtk::OnFocusIn(GtkWidget* widget, GdkEventFocus* event) {
if (!got_initial_focus_in_) {
got_initial_focus_in_ = true;
SetInitialFocus();
- } else {
- GetFocusManager()->RestoreFocusedView();
}
return false;
}
@@ -1239,9 +1237,6 @@ gboolean WidgetGtk::OnFocusOut(GtkWidget* widget, GdkEventFocus* event) {
// Only top-level Widget should have an InputMethod instance.
if (input_method_.get())
input_method_->OnBlur();
-
- // The top-level window lost focus, store the focused view.
- GetFocusManager()->StoreFocusedView();
return false;
}