diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-08 23:33:23 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-08 23:33:23 +0000 |
commit | 3c59ef0629260028c98b9648ee7e6732b24018a0 (patch) | |
tree | 3ce67f67d5754b5089628433cdd1298d7ea10b0a /views/widget/widget_win.cc | |
parent | 1f082083982da6f2261a2bc1bb74247a903ba2ee (diff) | |
download | chromium_src-3c59ef0629260028c98b9648ee7e6732b24018a0.zip chromium_src-3c59ef0629260028c98b9648ee7e6732b24018a0.tar.gz chromium_src-3c59ef0629260028c98b9648ee7e6732b24018a0.tar.bz2 |
Moving the Windows specific activation code in the FocusManager to the widget_win.
BUG=None
TEST=Test that the focus in the browser works well: that windows remember which view had focus when deactivated/reactivated. Make sure focus traversal works as expected.
Review URL: http://codereview.chromium.org/118406
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17911 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/widget_win.cc')
-rw-r--r-- | views/widget/widget_win.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 353fcbc..41c7309 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -1046,7 +1046,26 @@ LRESULT CALLBACK WidgetWin::WndProc(HWND window, UINT message, widget->hwnd_ = NULL; widget->OnFinalMessage(window); } + if (message == WM_ACTIVATE) + PostProcessActivateMessage(widget, LOWORD(w_param)); return result; } +// static +void WidgetWin::PostProcessActivateMessage(WidgetWin* widget, + int activation_state) { + FocusManager* focus_manager = + FocusManager::GetFocusManager(widget->GetNativeView()); + if (!focus_manager) { + NOTREACHED(); + return; + } + if (WA_INACTIVE == activation_state) { + focus_manager->StoreFocusedView(); + } else { + // We must restore the focus after the message has been DefProc'ed as it + // does set the focus to the last focused HWND. + focus_manager->RestoreFocusedView(); + } +} } // namespace views |