diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 00:36:48 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 00:36:48 +0000 |
commit | 3fbfa3fb89128ea61adf02c63f2cf4e1121c7933 (patch) | |
tree | 6d8d30b009c8e13336c1f5578c32fea90d494eaf /chrome/views | |
parent | b9636005dd6f235dfb4fa4ea3a83df284341667d (diff) | |
download | chromium_src-3fbfa3fb89128ea61adf02c63f2cf4e1121c7933.zip chromium_src-3fbfa3fb89128ea61adf02c63f2cf4e1121c7933.tar.gz chromium_src-3fbfa3fb89128ea61adf02c63f2cf4e1121c7933.tar.bz2 |
Make Chromium windows not hide auto-hide taskbars.
There are a few caveats here:
* On Aero glass, if the auto-hide taskbar is at the top of the screen, we get one row of nonclient pixels along the bottom of the screen (not too noticeable for light-colored pages, looks a bit odd with a dark page). I can't find a way around this.
* Switching between fullscreen and normal mode can leave things a bit confused until you click another app and then reactivate Chromium. This seems to happen with other applications too (e.g. Firefox fullscreen mode) so I'm not too worried.
* Chromium does not deal well with toggling the taskbar's auto-hide setting (or, I think, its position?) unless you restore and remaximize the window. I tried to fix this via modified handling of WM_SETTINGCHANGE but only made things worse and so gave up.
BUG=20
Review URL: http://codereview.chromium.org/28338
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10845 0039d316-1c4b-4281-b951-d872f2087c98
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. |