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

Side by Side Diff: chrome/views/window.cc

Issue 28338: Make Chromium windows not hide auto-hide taskbars.... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/win_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/views/window.h" 5 #include "chrome/views/window.h"
6 6
7 #include "base/win_util.h" 7 #include "base/win_util.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/common/gfx/chrome_canvas.h" 9 #include "chrome/common/gfx/chrome_canvas.h"
10 #include "chrome/common/gfx/chrome_font.h" 10 #include "chrome/common/gfx/chrome_font.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 554 }
555 return CallDefaultNCActivateHandler(active); 555 return CallDefaultNCActivateHandler(active);
556 } 556 }
557 557
558 LRESULT Window::OnNCCalcSize(BOOL mode, LPARAM l_param) { 558 LRESULT Window::OnNCCalcSize(BOOL mode, LPARAM l_param) {
559 // We only need to adjust the client size/paint handling when we're not using 559 // We only need to adjust the client size/paint handling when we're not using
560 // the native frame. 560 // the native frame.
561 if (non_client_view_->UseNativeFrame()) 561 if (non_client_view_->UseNativeFrame())
562 return WidgetWin::OnNCCalcSize(mode, l_param); 562 return WidgetWin::OnNCCalcSize(mode, l_param);
563 563
564 RECT* client_rect = mode ?
565 &reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param)->rgrc[0] :
566 reinterpret_cast<RECT*>(l_param);
567 if (IsMaximized()) {
568 // Make the maximized mode client rect fit the screen exactly, by
569 // subtracting the border Windows automatically adds for maximized mode.
570 int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
571 InflateRect(client_rect, -border_thickness, -border_thickness);
572
573 // Find all auto-hide taskbars along the screen edges and adjust in by the
574 // thickness of the auto-hide taskbar on each such edge, so the window isn't
575 // treated as a "fullscreen app", which would cause the taskbars to
576 // disappear.
577 HMONITOR monitor = MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST);
578 if (win_util::EdgeHasAutoHideTaskbar(ABE_LEFT, monitor))
579 client_rect->left += win_util::kAutoHideTaskbarThicknessPx;
580 if (win_util::EdgeHasAutoHideTaskbar(ABE_TOP, monitor))
581 client_rect->top += win_util::kAutoHideTaskbarThicknessPx;
582 if (win_util::EdgeHasAutoHideTaskbar(ABE_RIGHT, monitor))
583 client_rect->right -= win_util::kAutoHideTaskbarThicknessPx;
584 if (win_util::EdgeHasAutoHideTaskbar(ABE_BOTTOM, monitor))
585 client_rect->bottom -= win_util::kAutoHideTaskbarThicknessPx;
586 }
587
564 // We need to repaint all when the window bounds change. 588 // We need to repaint all when the window bounds change.
565 return WVR_REDRAW; 589 return mode ? WVR_REDRAW : 0;
566 } 590 }
567 591
568 LRESULT Window::OnNCHitTest(const CPoint& point) { 592 LRESULT Window::OnNCHitTest(const CPoint& point) {
569 // First, give the NonClientView a chance to test the point to see if it 593 // First, give the NonClientView a chance to test the point to see if it
570 // provides any of the non-client area. 594 // provides any of the non-client area.
571 CPoint temp = point; 595 CPoint temp = point;
572 MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1); 596 MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
573 int component = non_client_view_->NonClientHitTest(gfx::Point(temp)); 597 int component = non_client_view_->NonClientHitTest(gfx::Point(temp));
574 if (component != HTNOWHERE) 598 if (component != HTNOWHERE)
575 return component; 599 return component;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 } 1094 }
1071 1095
1072 // Changing the window region is going to force a paint. Only change the 1096 // Changing the window region is going to force a paint. Only change the
1073 // window region if the region really differs. 1097 // window region if the region really differs.
1074 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); 1098 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0);
1075 int current_rgn_result = GetWindowRgn(GetHWND(), current_rgn); 1099 int current_rgn_result = GetWindowRgn(GetHWND(), current_rgn);
1076 1100
1077 CRect window_rect; 1101 CRect window_rect;
1078 GetWindowRect(&window_rect); 1102 GetWindowRect(&window_rect);
1079 HRGN new_region; 1103 HRGN new_region;
1080 if (IsMaximized()) { 1104 gfx::Path window_mask;
1081 HMONITOR monitor = MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST); 1105 non_client_view_->GetWindowMask(
1082 MONITORINFO mi; 1106 gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask);
1083 mi.cbSize = sizeof mi; 1107 new_region = window_mask.CreateHRGN();
1084 GetMonitorInfo(monitor, &mi);
1085 CRect work_rect = mi.rcWork;
1086 work_rect.OffsetRect(-window_rect.left, -window_rect.top);
1087 new_region = CreateRectRgnIndirect(&work_rect);
1088 } else {
1089 gfx::Path window_mask;
1090 non_client_view_->GetWindowMask(gfx::Size(window_rect.Width(),
1091 window_rect.Height()),
1092 &window_mask);
1093 new_region = window_mask.CreateHRGN();
1094 }
1095 1108
1096 if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { 1109 if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) {
1097 // SetWindowRgn takes ownership of the HRGN created by CreateHRGN. 1110 // SetWindowRgn takes ownership of the HRGN created by CreateHRGN.
1098 SetWindowRgn(new_region, TRUE); 1111 SetWindowRgn(new_region, TRUE);
1099 } else { 1112 } else {
1100 DeleteObject(new_region); 1113 DeleteObject(new_region);
1101 } 1114 }
1102 1115
1103 DeleteObject(current_rgn); 1116 DeleteObject(current_rgn);
1104 } 1117 }
(...skipping 25 matching lines...) Expand all
1130 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); 1143 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS);
1131 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); 1144 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE);
1132 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); 1145 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW);
1133 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); 1146 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE);
1134 initialized = true; 1147 initialized = true;
1135 } 1148 }
1136 } 1149 }
1137 1150
1138 } // namespace views 1151 } // namespace views
1139 1152
OLDNEW
« 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