diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 01:14:30 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 01:14:30 +0000 |
commit | e9d6398c5de33b6b13405717b85f3c31961816fe (patch) | |
tree | ba96e75a04cc3da12099ec3cead4921e2b6361c1 | |
parent | 563ba2d6669f39fb9ea8caab3063f854f08eb24f (diff) | |
download | chromium_src-e9d6398c5de33b6b13405717b85f3c31961816fe.zip chromium_src-e9d6398c5de33b6b13405717b85f3c31961816fe.tar.gz chromium_src-e9d6398c5de33b6b13405717b85f3c31961816fe.tar.bz2 |
Fix maximized mode drawing offscreen in Classic mode. Apparently Classic, unlike Luna, does not auto-clip maximized windows with an explicitly-set HRGN of NULL, so we have to set one.
BUG=5054
TEST=On a desktop extended across multiple monitors, switch to Classic mode, open a Chrome window, and maximize it on one monitor. Make sure it doesn't draw any pixels on the other monitor.
Review URL: http://codereview.chromium.org/18258
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8062 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/views/custom_frame_window.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index baf5b5e..5896b24 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -1319,10 +1319,18 @@ void CustomFrameWindow::ResetWindowRegion() { HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); int current_rgn_result = GetWindowRgn(GetHWND(), current_rgn); - HRGN new_region = NULL; - if (!IsMaximized()) { - CRect window_rect; - GetWindowRect(&window_rect); + CRect window_rect; + GetWindowRect(&window_rect); + HRGN new_region; + if (IsMaximized()) { + HMONITOR monitor = MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST); + MONITORINFO mi; + mi.cbSize = sizeof mi; + GetMonitorInfo(monitor, &mi); + CRect work_rect = mi.rcWork; + work_rect.OffsetRect(-window_rect.left, -window_rect.top); + new_region = CreateRectRgnIndirect(&work_rect); + } else { gfx::Path window_mask; non_client_view_->GetWindowMask(gfx::Size(window_rect.Width(), window_rect.Height()), @@ -1330,11 +1338,10 @@ void CustomFrameWindow::ResetWindowRegion() { new_region = window_mask.CreateHRGN(); } - if (current_rgn_result == ERROR || - !EqualRgn(current_rgn, new_region)) { + if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { // SetWindowRgn takes ownership of the HRGN created by CreateHRGN. SetWindowRgn(new_region, TRUE); - } else if (new_region) { + } else { DeleteObject(new_region); } |