summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-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();
}
}