Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| index 7ceac3af3ee7c0f72158cef9c249c744c9008376..d91481da0e82f998b80bb43c9064567abd3466df 100644 |
| --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| @@ -787,33 +787,8 @@ void DesktopWindowTreeHostX11::FlashFrame(bool flash_frame) { |
| urgency_hint_set_ = flash_frame; |
| } |
| -void DesktopWindowTreeHostX11::OnRootViewLayout() const { |
| - if (!window_mapped_) |
| - return; |
| - |
| - XSizeHints hints; |
| - long supplied_return; |
| - XGetWMNormalHints(xdisplay_, xwindow_, &hints, &supplied_return); |
| - |
| - gfx::Size minimum = native_widget_delegate_->GetMinimumSize(); |
| - if (minimum.IsEmpty()) { |
| - hints.flags &= ~PMinSize; |
| - } else { |
| - hints.flags |= PMinSize; |
| - hints.min_width = minimum.width(); |
| - hints.min_height = minimum.height(); |
| - } |
| - |
| - gfx::Size maximum = native_widget_delegate_->GetMaximumSize(); |
| - if (maximum.IsEmpty()) { |
| - hints.flags &= ~PMaxSize; |
| - } else { |
| - hints.flags |= PMaxSize; |
| - hints.max_width = maximum.width(); |
| - hints.max_height = maximum.height(); |
| - } |
| - |
| - XSetWMNormalHints(xdisplay_, xwindow_, &hints); |
| +void DesktopWindowTreeHostX11::OnRootViewLayout() { |
| + UpdateMinAndMaxSize(); |
| } |
| void DesktopWindowTreeHostX11::OnNativeWidgetFocus() { |
| @@ -870,6 +845,15 @@ void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { |
| DCHECK_GT(bounds.width(), 0); |
| DCHECK_GT(bounds.height(), 0); |
| + if (bounds.width() < min_size_.width() || |
| + bounds.height() < min_size_.height() || |
| + (!max_size_.IsEmpty() && |
| + (bounds.width() > max_size_.width() || |
| + bounds.height() > max_size_.height()))) { |
| + // Update the minimum and maximum sizes in case they have changed. |
| + UpdateMinAndMaxSize(); |
| + } |
| + |
| changes.width = bounds.width(); |
| changes.height = bounds.height(); |
| value_mask |= CWHeight | CWWidth; |
| @@ -1247,6 +1231,41 @@ void DesktopWindowTreeHostX11::OnFrameExtentsUpdated() { |
| } |
| } |
| +void DesktopWindowTreeHostX11::UpdateMinAndMaxSize() { |
| + if (!window_mapped_) |
| + return; |
| + |
| + gfx::Size minimum = native_widget_delegate_->GetMinimumSize(); |
| + gfx::Size maximum = native_widget_delegate_->GetMaximumSize(); |
| + if (min_size_ == minimum && max_size_ == maximum) |
| + return; |
|
pkotwicz
2014/07/17 17:39:07
In the old code, we did not early return. Is there
Elliot Glaysher
2014/07/17 18:15:28
I can't see any reason we shouldn't.
|
| + |
| + min_size_ = minimum; |
| + max_size_ = maximum; |
| + |
| + XSizeHints hints; |
| + long supplied_return; |
| + XGetWMNormalHints(xdisplay_, xwindow_, &hints, &supplied_return); |
| + |
| + if (minimum.IsEmpty()) { |
| + hints.flags &= ~PMinSize; |
| + } else { |
| + hints.flags |= PMinSize; |
| + hints.min_width = min_size_.width(); |
| + hints.min_height = min_size_.height(); |
| + } |
| + |
| + if (maximum.IsEmpty()) { |
| + hints.flags &= ~PMaxSize; |
| + } else { |
| + hints.flags |= PMaxSize; |
| + hints.max_width = max_size_.width(); |
| + hints.max_height = max_size_.height(); |
| + } |
| + |
| + XSetWMNormalHints(xdisplay_, xwindow_, &hints); |
| +} |
| + |
| void DesktopWindowTreeHostX11::UpdateWMUserTime( |
| const ui::PlatformEvent& event) { |
| if (!IsActive()) |