summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 21:02:07 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-14 21:02:07 +0000
commit628bf46171db1a2ca1beca7b83d4e0e0aec69d47 (patch)
treed6555a90a2e97255a0ecfb89bf047acddc056cd8 /views
parent9862092cb1442b9718053a372b7643b2268ae392 (diff)
downloadchromium_src-628bf46171db1a2ca1beca7b83d4e0e0aec69d47.zip
chromium_src-628bf46171db1a2ca1beca7b83d4e0e0aec69d47.tar.gz
chromium_src-628bf46171db1a2ca1beca7b83d4e0e0aec69d47.tar.bz2
Set minimum window size on Windows.
This involves having the GlassBrowserFrameView calculate its minimum size based on its sub-components as well as a change to NativeWidgetWin to adjust the reported minimum size by the native frame size to be consistent with the logic in NativeWidgetWin::ClientAreaSizeChanged(). BUG=9885 TEST=manual Review URL: http://codereview.chromium.org/7277093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/native_widget_win.cc17
-rw-r--r--views/widget/native_widget_win.h3
2 files changed, 18 insertions, 2 deletions
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index da00f33..ce2ab4e 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -1371,6 +1371,15 @@ LRESULT NativeWidgetWin::OnGetObject(UINT uMsg,
void NativeWidgetWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
gfx::Size min_window_size(delegate_->GetMinimumSize());
+ // Add the native frame border size to the minimum size if the view reports
+ // its size as the client size.
+ if (WidgetSizeIsClientSize()) {
+ CRect client_rect, window_rect;
+ GetClientRect(&client_rect);
+ GetWindowRect(&window_rect);
+ window_rect -= client_rect;
+ min_window_size.Enlarge(window_rect.Width(), window_rect.Height());
+ }
minmax_info->ptMinTrackSize.x = min_window_size.width();
minmax_info->ptMinTrackSize.y = min_window_size.height();
SetMsgHandled(FALSE);
@@ -2319,10 +2328,14 @@ void NativeWidgetWin::UnlockUpdates() {
lock_updates_ = false;
}
+bool NativeWidgetWin::WidgetSizeIsClientSize() const {
+ const Widget* widget = GetWidget()->GetTopLevelWidget();
+ return IsZoomed() || (widget && widget->ShouldUseNativeFrame());
+}
+
void NativeWidgetWin::ClientAreaSizeChanged() {
RECT r;
- Widget* widget = GetWidget()->GetTopLevelWidget();
- if (IsZoomed() || (widget && widget->ShouldUseNativeFrame()))
+ if (WidgetSizeIsClientSize())
GetClientRect(&r);
else
GetWindowRect(&r);
diff --git a/views/widget/native_widget_win.h b/views/widget/native_widget_win.h
index 4d668d9..6fea855 100644
--- a/views/widget/native_widget_win.h
+++ b/views/widget/native_widget_win.h
@@ -504,6 +504,9 @@ class NativeWidgetWin : public ui::WindowImpl,
void LockUpdates();
void UnlockUpdates();
+ // Determines whether the delegate expects the client size or the window size.
+ bool WidgetSizeIsClientSize() const;
+
// Responds to the client area changing size, either at window creation time
// or subsequently.
void ClientAreaSizeChanged();