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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 656723002: [Win] Update HWND max size if either width or height is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 2 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
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <wtsapi32.h> 10 #include <wtsapi32.h>
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 1424
1425 // Add the native frame border size to the minimum and maximum size if the 1425 // Add the native frame border size to the minimum and maximum size if the
1426 // view reports its size as the client size. 1426 // view reports its size as the client size.
1427 if (delegate_->WidgetSizeIsClientSize()) { 1427 if (delegate_->WidgetSizeIsClientSize()) {
1428 RECT client_rect, window_rect; 1428 RECT client_rect, window_rect;
1429 GetClientRect(hwnd(), &client_rect); 1429 GetClientRect(hwnd(), &client_rect);
1430 GetWindowRect(hwnd(), &window_rect); 1430 GetWindowRect(hwnd(), &window_rect);
1431 CR_DEFLATE_RECT(&window_rect, &client_rect); 1431 CR_DEFLATE_RECT(&window_rect, &client_rect);
1432 min_window_size.Enlarge(window_rect.right - window_rect.left, 1432 min_window_size.Enlarge(window_rect.right - window_rect.left,
1433 window_rect.bottom - window_rect.top); 1433 window_rect.bottom - window_rect.top);
1434 if (!max_window_size.IsEmpty()) { 1434 // Either axis may be zero, so enlarge them independently.
1435 max_window_size.Enlarge(window_rect.right - window_rect.left, 1435 if (max_window_size.width())
1436 window_rect.bottom - window_rect.top); 1436 max_window_size.Enlarge(window_rect.right - window_rect.left, 0);
1437 } 1437 if (max_window_size.height())
1438 max_window_size.Enlarge(0, window_rect.bottom - window_rect.top);
1438 } 1439 }
1439 minmax_info->ptMinTrackSize.x = min_window_size.width(); 1440 minmax_info->ptMinTrackSize.x = min_window_size.width();
1440 minmax_info->ptMinTrackSize.y = min_window_size.height(); 1441 minmax_info->ptMinTrackSize.y = min_window_size.height();
1441 if (max_window_size.width() || max_window_size.height()) { 1442 if (max_window_size.width() || max_window_size.height()) {
1442 if (!max_window_size.width()) 1443 if (!max_window_size.width())
1443 max_window_size.set_width(GetSystemMetrics(SM_CXMAXTRACK)); 1444 max_window_size.set_width(GetSystemMetrics(SM_CXMAXTRACK));
1444 if (!max_window_size.height()) 1445 if (!max_window_size.height())
1445 max_window_size.set_height(GetSystemMetrics(SM_CYMAXTRACK)); 1446 max_window_size.set_height(GetSystemMetrics(SM_CYMAXTRACK));
1446 minmax_info->ptMaxTrackSize.x = max_window_size.width(); 1447 minmax_info->ptMaxTrackSize.x = max_window_size.width();
1447 minmax_info->ptMaxTrackSize.y = max_window_size.height(); 1448 minmax_info->ptMaxTrackSize.y = max_window_size.height();
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2493 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2493 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2494 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2494 } 2495 }
2495 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2496 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
2496 // to notify our children too, since we can have MDI child windows who need to 2497 // to notify our children too, since we can have MDI child windows who need to
2497 // update their appearance. 2498 // update their appearance.
2498 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2499 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2499 } 2500 }
2500 2501
2501 } // namespace views 2502 } // namespace views
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