summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 21:03:19 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 21:03:19 +0000
commitef291978cb15b511e4b024376fc65b12b89c24fd (patch)
tree2cec52db5a0a31a0f0a272de284533ddf9dbb564 /ui/views
parent51ffaf742c78f2fdd9833167c5534d8009873751 (diff)
downloadchromium_src-ef291978cb15b511e4b024376fc65b12b89c24fd.zip
chromium_src-ef291978cb15b511e4b024376fc65b12b89c24fd.tar.gz
chromium_src-ef291978cb15b511e4b024376fc65b12b89c24fd.tar.bz2
Allow the RWHVW to be focused when a window is restored from minimized.
This restores a hack that was in place in the old NativeTabContentsContainer code that seemed to clear focus during restoration (though the hack was for another purpose, the hack seemed to fix this bug too). I've isolated the hack to the re-activation code. http://crbug.com/125976 TEST=see bug Review URL: https://chromiumcodereview.appspot.com/10378043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136124 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/accessible_pane_view_unittest.cc3
-rw-r--r--ui/views/widget/native_widget_win.cc14
2 files changed, 17 insertions, 0 deletions
diff --git a/ui/views/accessible_pane_view_unittest.cc b/ui/views/accessible_pane_view_unittest.cc
index 467f143..14b0226 100644
--- a/ui/views/accessible_pane_view_unittest.cc
+++ b/ui/views/accessible_pane_view_unittest.cc
@@ -84,6 +84,7 @@ TEST_F(AccessiblePaneViewTest, SimpleSetPaneFocus) {
View* root = widget->GetRootView();
root->AddChildView(test_view);
widget->Show();
+ widget->Activate();
// Set pane focus succeeds, focus on child.
EXPECT_TRUE(test_view->SetPaneFocusAndFocusDefault());
@@ -113,6 +114,7 @@ TEST_F(AccessiblePaneViewTest, TwoSetPaneFocus) {
root->AddChildView(test_view);
root->AddChildView(test_view_2);
widget->Show();
+ widget->Activate();
// Set pane focus succeeds, focus on child.
EXPECT_TRUE(test_view->SetPaneFocusAndFocusDefault());
@@ -142,6 +144,7 @@ TEST_F(AccessiblePaneViewTest, PaneFocusTraversal) {
root->AddChildView(original_test_view);
root->AddChildView(test_view);
widget->Show();
+ widget->Activate();
// Set pane focus on first view.
EXPECT_TRUE(original_test_view->SetPaneFocus(
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index 1cbc98b..2fcc5dd 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -38,6 +38,7 @@
#include "ui/views/drag_utils.h"
#include "ui/views/focus/accelerator_handler.h"
#include "ui/views/focus/view_storage.h"
+#include "ui/views/focus/widget_focus_manager.h"
#include "ui/views/ime/input_method_win.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/aero_tooltip_manager.h"
@@ -1336,6 +1337,7 @@ LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) {
// Get access to a modifiable copy of the system menu.
GetSystemMenu(hwnd(), false);
+
return 0;
}
@@ -2259,6 +2261,18 @@ void NativeWidgetWin::PostProcessActivateMessage(NativeWidgetWin* widget,
widget->restore_focus_when_enabled_ = true;
return;
}
+
+ // Mysteriously, this only appears to be needed support restoration of focus
+ // to a child hwnd when restoring its top level window from the minimized
+ // state. If we don't do this, then ::SetFocus() to that child HWND returns
+ // ERROR_INVALID_PARAMETER, despite both HWNDs being of the same thread.
+ // See http://crbug.com/125976
+ {
+ // Since this is a synthetic reset, we don't need to tell anyone about it.
+ AutoNativeNotificationDisabler disabler;
+ focus_manager->ClearFocus();
+ }
+
focus_manager->RestoreFocusedView();
}
}