summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 00:08:19 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 00:08:19 +0000
commit778c0d933118eec1b9a027010051e432d6d09852 (patch)
treeeaa868f55e0174d3fea22a8df0cc7d81bd2aa123 /chrome/views
parent28b5a8494387b85fa19ca61940760e08954bcaa3 (diff)
downloadchromium_src-778c0d933118eec1b9a027010051e432d6d09852.zip
chromium_src-778c0d933118eec1b9a027010051e432d6d09852.tar.gz
chromium_src-778c0d933118eec1b9a027010051e432d6d09852.tar.bz2
Don't allow the browser window to be resized so small that layout starts breaking horribly. When it _is_ small, draw the frame correctly.This is an incomplete fix; only non-Aero main/popup/app windows are handled so far, but this was becoming hairy enough I wanted to checkpoint it.BUG=9885
Review URL: http://codereview.chromium.org/88069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/widget/widget_win.h4
-rw-r--r--chrome/views/window/non_client_view.cc7
-rw-r--r--chrome/views/window/non_client_view.h1
-rw-r--r--chrome/views/window/window_win.cc7
-rw-r--r--chrome/views/window/window_win.h1
5 files changed, 20 insertions, 0 deletions
diff --git a/chrome/views/widget/widget_win.h b/chrome/views/widget/widget_win.h
index ede4252..110a0b4 100644
--- a/chrome/views/widget/widget_win.h
+++ b/chrome/views/widget/widget_win.h
@@ -178,6 +178,7 @@ class WidgetWin : public Widget,
MSG_WM_ENDSESSION(OnEndSession)
MSG_WM_ENTERSIZEMOVE(OnEnterSizeMove)
MSG_WM_EXITMENULOOP(OnExitMenuLoop)
+ MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
MSG_WM_HSCROLL(OnHScroll)
MSG_WM_INITMENU(OnInitMenu)
MSG_WM_INITMENUPOPUP(OnInitMenuPopup)
@@ -376,6 +377,9 @@ class WidgetWin : public Widget,
}
virtual LRESULT OnEraseBkgnd(HDC dc);
virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param);
+ virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
+ SetMsgHandled(FALSE);
+ }
virtual void OnHScroll(int scroll_type, short position, HWND scrollbar) {
SetMsgHandled(FALSE);
}
diff --git a/chrome/views/window/non_client_view.cc b/chrome/views/window/non_client_view.cc
index bc69587..29daf06 100644
--- a/chrome/views/window/non_client_view.cc
+++ b/chrome/views/window/non_client_view.cc
@@ -131,10 +131,17 @@ void NonClientView::LayoutFrameView() {
// NonClientView, View overrides:
gfx::Size NonClientView::GetPreferredSize() {
+ // TODO(pkasting): This should probably be made to look similar to
+ // GetMinimumSize() below. This will require implementing GetPreferredSize()
+ // better in the various frame views.
gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize());
return GetWindowBoundsForClientBounds(client_bounds).size();
}
+gfx::Size NonClientView::GetMinimumSize() {
+ return frame_view_->GetMinimumSize();
+}
+
void NonClientView::Layout() {
LayoutFrameView();
diff --git a/chrome/views/window/non_client_view.h b/chrome/views/window/non_client_view.h
index 0481cfd..e82ec77 100644
--- a/chrome/views/window/non_client_view.h
+++ b/chrome/views/window/non_client_view.h
@@ -192,6 +192,7 @@ class NonClientView : public View {
// NonClientView, View overrides:
virtual gfx::Size GetPreferredSize();
+ virtual gfx::Size GetMinimumSize();
virtual void Layout();
protected:
diff --git a/chrome/views/window/window_win.cc b/chrome/views/window/window_win.cc
index 3d2c74f..8c03219 100644
--- a/chrome/views/window/window_win.cc
+++ b/chrome/views/window/window_win.cc
@@ -640,6 +640,13 @@ void WindowWin::OnFinalMessage(HWND window) {
WidgetWin::OnFinalMessage(window);
}
+void WindowWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) {
+ gfx::Size min_window_size(GetNonClientView()->GetMinimumSize());
+ minmax_info->ptMinTrackSize.x = min_window_size.width();
+ minmax_info->ptMinTrackSize.y = min_window_size.height();
+ WidgetWin::OnGetMinMaxInfo(minmax_info);
+}
+
namespace {
static void EnableMenuItem(HMENU menu, UINT command, bool enabled) {
UINT flags = MF_BYCOMMAND | (enabled ? MF_ENABLED : MF_DISABLED | MF_GRAYED);
diff --git a/chrome/views/window/window_win.h b/chrome/views/window/window_win.h
index cd7bd50..222ac52 100644
--- a/chrome/views/window/window_win.h
+++ b/chrome/views/window/window_win.h
@@ -129,6 +129,7 @@ class WindowWin : public WidgetWin,
virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param,
LPARAM l_param);
virtual void OnFinalMessage(HWND window);
+ virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info);
virtual void OnInitMenu(HMENU menu);
virtual void OnMouseLeave();
virtual LRESULT OnNCActivate(BOOL active);