Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3544)

Unified Diff: chrome/views/window.cc

Issue 42027: Make Chromium windows not hide auto-hide taskbars, take 2.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/win_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/window.cc
===================================================================
--- chrome/views/window.cc (revision 11284)
+++ chrome/views/window.cc (working copy)
@@ -568,8 +568,40 @@
if (non_client_view_->UseNativeFrame())
return WidgetWin::OnNCCalcSize(mode, l_param);
- // We need to repaint all when the window bounds change.
- return WVR_REDRAW;
+ 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 cannot return WVR_REDRAW when there is nonclient area, or Windows
+ // exhibits bugs where client pixels and child HWNDs are mispositioned by
+ // the width/height of the upper-left nonclient area.
+ return 0;
+ }
+
+ // If the window bounds change, we're going to relayout and repaint anyway.
+ // Returning WVR_REDRAW avoids an extra paint before that of the old client
+ // pixels in the (now wrong) location, and thus makes actions like resizing a
+ // window from the left edge look slightly less broken.
+ return mode ? WVR_REDRAW : 0;
}
LRESULT Window::OnNCHitTest(const CPoint& point) {
@@ -1098,21 +1130,10 @@
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.
« no previous file with comments | « chrome/common/win_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698