diff options
author | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 06:17:57 +0000 |
---|---|---|
committer | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 06:17:57 +0000 |
commit | 2b107a348f2b27934fe38680ec8010d743f61765 (patch) | |
tree | 1d80545b8776ccbfc3ea6c401ec2fb8514f63201 /views | |
parent | 695e65dc775445c0bd2226a49a91431a55c13b8d (diff) | |
download | chromium_src-2b107a348f2b27934fe38680ec8010d743f61765.zip chromium_src-2b107a348f2b27934fe38680ec8010d743f61765.tar.gz chromium_src-2b107a348f2b27934fe38680ec8010d743f61765.tar.bz2 |
Make the code for unmaximizing the window during SetBounds much simpler.
This still fixes the original bug and does it in a much simpler (and faster)
way. I was previously attempting to use an API to do this rather than just
setting the style directly but that API may have hidden side effects like
causing a window activation on some versions of Windows.
BUG=69724
TEST=WidgetWinTest::SetBoundsForZoomedWindow
Review URL: http://codereview.chromium.org/6331006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/widget_win.cc | 5 | ||||
-rw-r--r-- | views/widget/widget_win_unittest.cc | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 8bc3c2c..08dbe92 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -239,8 +239,9 @@ void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const { } void WidgetWin::SetBounds(const gfx::Rect& bounds) { - if (IsZoomed()) - ShowWindow(SW_SHOWNOACTIVATE); + LONG style = GetWindowLong(GWL_STYLE); + if (style & WS_MAXIMIZE) + SetWindowLong(GWL_STYLE, style & ~WS_MAXIMIZE); SetWindowPos(NULL, bounds.x(), bounds.y(), bounds.width(), bounds.height(), SWP_NOACTIVATE | SWP_NOZORDER); } diff --git a/views/widget/widget_win_unittest.cc b/views/widget/widget_win_unittest.cc index 01e16885..d0cb4e4 100644 --- a/views/widget/widget_win_unittest.cc +++ b/views/widget/widget_win_unittest.cc @@ -74,8 +74,7 @@ TEST_F(WidgetWinTest, SetBoundsForZoomedWindow) { // cause it to be activated. window->SetBounds(gfx::Rect(50, 50, 650, 650)); EXPECT_FALSE(window->IsZoomed()); - // Re-enable the check below: http://crbug.com/69724 - // EXPECT_FALSE(window->IsActive()); + EXPECT_FALSE(window->IsActive()); // Cleanup. window->CloseNow(); |