diff options
Diffstat (limited to 'chrome/views')
-rw-r--r-- | chrome/views/window.cc | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/chrome/views/window.cc b/chrome/views/window.cc index d0875d8..80c6f31 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -561,8 +561,32 @@ LRESULT Window::OnNCCalcSize(BOOL mode, LPARAM l_param) { if (non_client_view_->UseNativeFrame()) return WidgetWin::OnNCCalcSize(mode, l_param); + RECT* client_rect = mode ? + &reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0] : + reinterpret_cast<RECT*>(l_param); + if (IsMaximized()) { + // Make the maximized mode client rect fit the screen exactly, by + // subtracting the border Windows automatically adds for maximized mode. + int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); + InflateRect(client_rect, -border_thickness, -border_thickness); + + // Find all auto-hide taskbars along the screen edges and adjust in by the + // thickness of the auto-hide taskbar on each such edge, so the window isn't + // treated as a "fullscreen app", which would cause the taskbars to + // disappear. + HMONITOR monitor = MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST); + if (win_util::EdgeHasAutoHideTaskbar(ABE_LEFT, monitor)) + client_rect->left += win_util::kAutoHideTaskbarThicknessPx; + if (win_util::EdgeHasAutoHideTaskbar(ABE_TOP, monitor)) + client_rect->top += win_util::kAutoHideTaskbarThicknessPx; + if (win_util::EdgeHasAutoHideTaskbar(ABE_RIGHT, monitor)) + client_rect->right -= win_util::kAutoHideTaskbarThicknessPx; + if (win_util::EdgeHasAutoHideTaskbar(ABE_BOTTOM, monitor)) + client_rect->bottom -= win_util::kAutoHideTaskbarThicknessPx; + } + // We need to repaint all when the window bounds change. - return WVR_REDRAW; + return mode ? WVR_REDRAW : 0; } LRESULT Window::OnNCHitTest(const CPoint& point) { @@ -1077,21 +1101,10 @@ void Window::ResetWindowRegion(bool force) { 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()), - &window_mask); - new_region = window_mask.CreateHRGN(); - } + gfx::Path window_mask; + non_client_view_->GetWindowMask( + gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); + new_region = window_mask.CreateHRGN(); if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { // SetWindowRgn takes ownership of the HRGN created by CreateHRGN. |