diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 21:37:43 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 21:37:43 +0000 |
commit | 89a8114a6bcf5506a8ba970cbaf85184642c971e (patch) | |
tree | 75a49a2211283a87a77a78aee5d4e982437edfcd /chrome/views | |
parent | 59c098679b18b4b8f731cf7041f4506616327663 (diff) | |
download | chromium_src-89a8114a6bcf5506a8ba970cbaf85184642c971e.zip chromium_src-89a8114a6bcf5506a8ba970cbaf85184642c971e.tar.gz chromium_src-89a8114a6bcf5506a8ba970cbaf85184642c971e.tar.bz2 |
Try again to fix "maximized window size wrong after unlock". This is a blind fix but it seems like it should work.
Instead of adjusting the window rect by the change in work rect for maximized windows, just size to (work area inflated by SM_CXSIZEFRAME), which is what a maximized window normally does. This makes the new window size independent of the previous window size, which could prevent problems if during a chain of resizes Windows doesn't like one of the desired window sizes and modifies it.
BUG=8873
Review URL: http://codereview.chromium.org/88001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r-- | chrome/views/window/window_win.cc | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/chrome/views/window/window_win.cc b/chrome/views/window/window_win.cc index f49aa86..3d2c74f 100644 --- a/chrome/views/window/window_win.cc +++ b/chrome/views/window/window_win.cc @@ -1137,30 +1137,21 @@ void WindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) { // to any notification, and we're just sent a SetWindowPos() call with a // new (frequently incorrect) position/size. In either case, the best // response is to throw away the existing position/size information in - // |window_pos| and recalculate it based on the old window coordinates, - // adjusted for the change in the work area (or, for fullscreen windows, - // to just set it to the monitor rect). + // |window_pos| and recalculate it based on the new work rect. + gfx::Rect new_window_rect; if (IsFullscreen()) { - window_pos->x = monitor_rect.x(); - window_pos->y = monitor_rect.y(); - window_pos->cx = monitor_rect.width(); - window_pos->cy = monitor_rect.height(); + new_window_rect = monitor_rect; } else if (IsZoomed()) { - window_pos->x = - window_rect.left + work_area.x() - last_work_area_.x(); - window_pos->y = window_rect.top + work_area.y() - last_work_area_.y(); - window_pos->cx = window_rect.Width() + work_area.width() - - last_work_area_.width(); - window_pos->cy = window_rect.Height() + work_area.height() - - last_work_area_.height(); + new_window_rect = work_area; + int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); + new_window_rect.Inset(-border_thickness, -border_thickness); } else { - gfx::Rect window_gfx_rect(window_rect); - gfx::Rect new_window_rect = window_gfx_rect.AdjustToFit(work_area); - window_pos->x = new_window_rect.x(); - window_pos->y = new_window_rect.y(); - window_pos->cx = new_window_rect.width(); - window_pos->cy = new_window_rect.height(); + new_window_rect = gfx::Rect(window_rect).AdjustToFit(work_area); } + window_pos->x = new_window_rect.x(); + window_pos->y = new_window_rect.y(); + window_pos->cx = new_window_rect.width(); + window_pos->cy = new_window_rect.height(); // WARNING! Don't set SWP_FRAMECHANGED here, it breaks moving the child // HWNDs for some reason. window_pos->flags &= ~(SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW); |