OLD | NEW |
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 "views/window/window_win.h" | 5 #include "views/window/window_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include "app/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 } | 1273 } |
1274 | 1274 |
1275 // Changing the window region is going to force a paint. Only change the | 1275 // Changing the window region is going to force a paint. Only change the |
1276 // window region if the region really differs. | 1276 // window region if the region really differs. |
1277 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); | 1277 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); |
1278 int current_rgn_result = GetWindowRgn(GetNativeView(), current_rgn); | 1278 int current_rgn_result = GetWindowRgn(GetNativeView(), current_rgn); |
1279 | 1279 |
1280 CRect window_rect; | 1280 CRect window_rect; |
1281 GetWindowRect(&window_rect); | 1281 GetWindowRect(&window_rect); |
1282 HRGN new_region; | 1282 HRGN new_region; |
1283 gfx::Path window_mask; | 1283 if (IsMaximized()) { |
1284 non_client_view_->GetWindowMask( | 1284 HMONITOR monitor = |
1285 gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); | 1285 MonitorFromWindow(GetNativeView(), MONITOR_DEFAULTTONEAREST); |
1286 new_region = window_mask.CreateHRGN(); | 1286 MONITORINFO mi; |
| 1287 mi.cbSize = sizeof mi; |
| 1288 GetMonitorInfo(monitor, &mi); |
| 1289 CRect work_rect = mi.rcWork; |
| 1290 work_rect.OffsetRect(-window_rect.left, -window_rect.top); |
| 1291 new_region = CreateRectRgnIndirect(&work_rect); |
| 1292 } else { |
| 1293 gfx::Path window_mask; |
| 1294 non_client_view_->GetWindowMask( |
| 1295 gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); |
| 1296 new_region = window_mask.CreateHRGN(); |
| 1297 } |
1287 | 1298 |
1288 if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { | 1299 if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { |
1289 // SetWindowRgn takes ownership of the HRGN created by CreateHRGN. | 1300 // SetWindowRgn takes ownership of the HRGN created by CreateHRGN. |
1290 SetWindowRgn(new_region, TRUE); | 1301 SetWindowRgn(new_region, TRUE); |
1291 } else { | 1302 } else { |
1292 DeleteObject(new_region); | 1303 DeleteObject(new_region); |
1293 } | 1304 } |
1294 | 1305 |
1295 DeleteObject(current_rgn); | 1306 DeleteObject(current_rgn); |
1296 } | 1307 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 Window::CloseSecondaryWidget(root_view->GetWidget()); | 1373 Window::CloseSecondaryWidget(root_view->GetWidget()); |
1363 return TRUE; | 1374 return TRUE; |
1364 } | 1375 } |
1365 } // namespace | 1376 } // namespace |
1366 | 1377 |
1367 void Window::CloseAllSecondaryWindows() { | 1378 void Window::CloseAllSecondaryWindows() { |
1368 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); | 1379 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0); |
1369 } | 1380 } |
1370 | 1381 |
1371 } // namespace views | 1382 } // namespace views |
OLD | NEW |