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

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

Issue 18258: Fix maximized mode drawing offscreen in Classic mode. Apparently Classic, un... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 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 | « no previous file | 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/custom_frame_window.h" 5 #include "chrome/views/custom_frame_window.h"
6 6
7 #include "base/gfx/point.h" 7 #include "base/gfx/point.h"
8 #include "base/gfx/size.h" 8 #include "base/gfx/size.h"
9 #include "base/win_util.h" 9 #include "base/win_util.h"
10 #include "chrome/app/theme/theme_resources.h" 10 #include "chrome/app/theme/theme_resources.h"
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 SetWindowLong(GetHWND(), GWL_STYLE, saved_window_style_); 1312 SetWindowLong(GetHWND(), GWL_STYLE, saved_window_style_);
1313 lock_updates_ = false; 1313 lock_updates_ = false;
1314 } 1314 }
1315 1315
1316 void CustomFrameWindow::ResetWindowRegion() { 1316 void CustomFrameWindow::ResetWindowRegion() {
1317 // Changing the window region is going to force a paint. Only change the 1317 // Changing the window region is going to force a paint. Only change the
1318 // window region if the region really differs. 1318 // window region if the region really differs.
1319 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); 1319 HRGN current_rgn = CreateRectRgn(0, 0, 0, 0);
1320 int current_rgn_result = GetWindowRgn(GetHWND(), current_rgn); 1320 int current_rgn_result = GetWindowRgn(GetHWND(), current_rgn);
1321 1321
1322 HRGN new_region = NULL; 1322 CRect window_rect;
1323 if (!IsMaximized()) { 1323 GetWindowRect(&window_rect);
1324 CRect window_rect; 1324 HRGN new_region;
1325 GetWindowRect(&window_rect); 1325 if (IsMaximized()) {
1326 HMONITOR monitor = MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST);
1327 MONITORINFO mi;
1328 mi.cbSize = sizeof mi;
1329 GetMonitorInfo(monitor, &mi);
1330 CRect work_rect = mi.rcWork;
1331 work_rect.OffsetRect(-window_rect.left, -window_rect.top);
1332 new_region = CreateRectRgnIndirect(&work_rect);
1333 } else {
1326 gfx::Path window_mask; 1334 gfx::Path window_mask;
1327 non_client_view_->GetWindowMask(gfx::Size(window_rect.Width(), 1335 non_client_view_->GetWindowMask(gfx::Size(window_rect.Width(),
1328 window_rect.Height()), 1336 window_rect.Height()),
1329 &window_mask); 1337 &window_mask);
1330 new_region = window_mask.CreateHRGN(); 1338 new_region = window_mask.CreateHRGN();
1331 } 1339 }
1332 1340
1333 if (current_rgn_result == ERROR || 1341 if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) {
1334 !EqualRgn(current_rgn, new_region)) {
1335 // SetWindowRgn takes ownership of the HRGN created by CreateHRGN. 1342 // SetWindowRgn takes ownership of the HRGN created by CreateHRGN.
1336 SetWindowRgn(new_region, TRUE); 1343 SetWindowRgn(new_region, TRUE);
1337 } else if (new_region) { 1344 } else {
1338 DeleteObject(new_region); 1345 DeleteObject(new_region);
1339 } 1346 }
1340 1347
1341 DeleteObject(current_rgn); 1348 DeleteObject(current_rgn);
1342 } 1349 }
1343 1350
1344 void CustomFrameWindow::ProcessNCMousePress(const CPoint& point, int flags) { 1351 void CustomFrameWindow::ProcessNCMousePress(const CPoint& point, int flags) {
1345 CPoint temp = point; 1352 CPoint temp = point;
1346 MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1); 1353 MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1);
1347 UINT message_flags = 0; 1354 UINT message_flags = 0;
1348 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) 1355 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80)
1349 message_flags |= MK_CONTROL; 1356 message_flags |= MK_CONTROL;
1350 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) 1357 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80)
1351 message_flags |= MK_SHIFT; 1358 message_flags |= MK_SHIFT;
1352 message_flags |= flags; 1359 message_flags |= flags;
1353 ProcessMousePressed(temp, message_flags, false); 1360 ProcessMousePressed(temp, message_flags, false);
1354 } 1361 }
1355 1362
1356 } // namespace views 1363 } // namespace views
1357 1364
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698