summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/frame/browser_frame.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 00:36:48 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 00:36:48 +0000
commit3fbfa3fb89128ea61adf02c63f2cf4e1121c7933 (patch)
tree6d8d30b009c8e13336c1f5578c32fea90d494eaf /chrome/browser/views/frame/browser_frame.cc
parentb9636005dd6f235dfb4fa4ea3a83df284341667d (diff)
downloadchromium_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/browser/views/frame/browser_frame.cc')
-rw-r--r--chrome/browser/views/frame/browser_frame.cc58
1 files changed, 44 insertions, 14 deletions
diff --git a/chrome/browser/views/frame/browser_frame.cc b/chrome/browser/views/frame/browser_frame.cc
index c318f37..a264908c 100644
--- a/chrome/browser/views/frame/browser_frame.cc
+++ b/chrome/browser/views/frame/browser_frame.cc
@@ -116,22 +116,49 @@ LRESULT BrowserFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) {
// We don't adjust the client area unless we're a tabbed browser window and
// are using the native frame.
if (!non_client_view_->UseNativeFrame() ||
- !browser_view_->IsBrowserTypeNormal() || !mode) {
+ !browser_view_->IsBrowserTypeNormal()) {
return Window::OnNCCalcSize(mode, l_param);
}
- // In fullscreen mode, we make the whole window client area.
- if (!browser_view_->IsFullscreen()) {
- NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param);
- int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
- params->rgrc[0].left += (border_thickness - kClientEdgeThickness);
- params->rgrc[0].right -= (border_thickness - kClientEdgeThickness);
- params->rgrc[0].bottom -= (border_thickness - kClientEdgeThickness);
+ RECT* client_rect = mode ?
+ &reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0] :
+ reinterpret_cast<RECT*>(l_param);
+ int border_thickness = 0;
+ if (browser_view_->IsMaximized()) {
+ // Make the maximized mode client rect fit the screen exactly, by
+ // subtracting the border Windows automatically adds for maximized mode.
+ border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
+ // 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_RIGHT, monitor))
+ client_rect->right -= win_util::kAutoHideTaskbarThicknessPx;
+ if (win_util::EdgeHasAutoHideTaskbar(ABE_BOTTOM, monitor)) {
+ client_rect->bottom -= win_util::kAutoHideTaskbarThicknessPx;
+ } else if (win_util::EdgeHasAutoHideTaskbar(ABE_TOP, monitor)) {
+ // Tricky bit. Due to a bug in DwmDefWindowProc()'s handling of
+ // WM_NCHITTEST, having any nonclient area atop the window causes the
+ // caption buttons to draw onscreen but not respond to mouse hover/clicks.
+ // So for a taskbar at the screen top, we can't push the client_rect->top
+ // down; instead, we move the bottom up by one pixel, which is the
+ // smallest change we can make and still get a client area less than the
+ // screen size. This is visibly ugly, but there seems to be no better
+ // solution.
+ --client_rect->bottom;
+ }
+ } else if (!browser_view_->IsFullscreen()) {
+ // We draw our own client edge over part of the default frame would be.
+ border_thickness = GetSystemMetrics(SM_CXSIZEFRAME) - kClientEdgeThickness;
}
+ client_rect->left += border_thickness;
+ client_rect->right -= border_thickness;
+ client_rect->bottom -= border_thickness;
UpdateDWMFrame();
-
- SetMsgHandled(TRUE);
return 0;
}
@@ -140,9 +167,8 @@ LRESULT BrowserFrame::OnNCHitTest(const CPoint& pt) {
if (non_client_view_->UseNativeFrame()) {
LRESULT result;
if (DwmDefWindowProc(GetHWND(), WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y),
- &result)) {
+ &result))
return result;
- }
}
return Window::OnNCHitTest(pt);
}
@@ -179,12 +205,16 @@ void BrowserFrame::UpdateDWMFrame() {
// because the GDI-drawn text in the web content composited over it will
// become semi-transparent over any glass area.
MARGINS margins = { 0 };
- if (!browser_view_->IsFullscreen()) {
+ if (browser_view_->CanCurrentlyResize()) {
margins.cxLeftWidth = kClientEdgeThickness + 1;
margins.cxRightWidth = kClientEdgeThickness + 1;
+ margins.cyBottomHeight = kClientEdgeThickness + 1;
+ }
+ // In maximized mode, we only have a titlebar strip of glass, no side/bottom
+ // borders.
+ if (!browser_view_->IsFullscreen()) {
margins.cyTopHeight =
GetBoundsForTabStrip(browser_view_->tabstrip()).bottom();
- margins.cyBottomHeight = kClientEdgeThickness + 1;
}
DwmExtendFrameIntoClientArea(GetHWND(), &margins);
}