diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-10 23:11:47 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-10 23:11:47 +0000 |
commit | 290353d2e35e004cd0c3d2ce15d3027a545c086e (patch) | |
tree | 7d37c7080bad8523ad228a447cf42454696d5044 /ui/views/widget | |
parent | e3a722b7311cd7bf9a812ccea475948b6ba88bb7 (diff) | |
download | chromium_src-290353d2e35e004cd0c3d2ce15d3027a545c086e.zip chromium_src-290353d2e35e004cd0c3d2ce15d3027a545c086e.tar.gz chromium_src-290353d2e35e004cd0c3d2ce15d3027a545c086e.tar.bz2 |
linux_aura: Enforce minimum/maximum window size.
This send min/max sizing information to the X server on Layout().
BUG=285387
Review URL: https://chromiumcodereview.appspot.com/23461042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget')
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc | 5 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_native_widget_aura.h | 1 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host.h | 2 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_win.cc | 3 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_win.h | 1 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc | 29 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_x11.h | 1 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 3 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.h | 1 | ||||
-rw-r--r-- | ui/views/widget/native_widget_private.h | 1 | ||||
-rw-r--r-- | ui/views/widget/native_widget_win.cc | 3 | ||||
-rw-r--r-- | ui/views/widget/native_widget_win.h | 1 | ||||
-rw-r--r-- | ui/views/widget/root_view.cc | 5 | ||||
-rw-r--r-- | ui/views/widget/root_view.h | 1 | ||||
-rw-r--r-- | ui/views/widget/widget.cc | 4 | ||||
-rw-r--r-- | ui/views/widget/widget.h | 4 |
16 files changed, 65 insertions, 0 deletions
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index a2ab44c..529e8ca 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc @@ -696,6 +696,11 @@ ui::NativeTheme* DesktopNativeWidgetAura::GetNativeTheme() const { return DesktopRootWindowHost::GetNativeTheme(window_); } +void DesktopNativeWidgetAura::OnRootViewLayout() const { + if (window_) + desktop_root_window_host_->OnRootViewLayout(); +} + //////////////////////////////////////////////////////////////////////////////// // DesktopNativeWidgetAura, aura::WindowDelegate implementation: diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h index da45e2d..6b29d0c 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h @@ -160,6 +160,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; + virtual void OnRootViewLayout() const OVERRIDE; // Overridden from aura::WindowDelegate: virtual gfx::Size GetMinimumSize() const OVERRIDE; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host.h b/ui/views/widget/desktop_aura/desktop_root_window_host.h index 9bdc946..583b0ac 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host.h @@ -109,6 +109,8 @@ class VIEWS_EXPORT DesktopRootWindowHost { virtual void FlashFrame(bool flash_frame) = 0; + virtual void OnRootViewLayout() const = 0; + // Called when the DesktopNativeWidgetAura's aura::Window is focused and // blurred. virtual void OnNativeWidgetFocus() = 0; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc index 3467fea..b9915ba 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc @@ -365,6 +365,9 @@ void DesktopRootWindowHostWin::FlashFrame(bool flash_frame) { message_handler_->FlashFrame(flash_frame); } +void DesktopRootWindowHostWin::OnRootViewLayout() const { +} + void DesktopRootWindowHostWin::OnNativeWidgetFocus() { // HWNDMessageHandler will perform the proper updating on its own. } diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h index 0428243..3e11208 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h @@ -92,6 +92,7 @@ class VIEWS_EXPORT DesktopRootWindowHostWin const gfx::ImageSkia& app_icon) OVERRIDE; virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; virtual void FlashFrame(bool flash_frame) OVERRIDE; + virtual void OnRootViewLayout() const OVERRIDE; virtual void OnNativeWidgetFocus() OVERRIDE; virtual void OnNativeWidgetBlur() OVERRIDE; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc index acb84ff..3718f9b 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc @@ -521,6 +521,35 @@ void DesktopRootWindowHostX11::FlashFrame(bool flash_frame) { NOTIMPLEMENTED(); } +void DesktopRootWindowHostX11::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 DesktopRootWindowHostX11::OnNativeWidgetFocus() { native_widget_delegate_->AsWidget()->GetInputMethod()->OnFocus(); } diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h index 526bee4..a3623de 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h @@ -119,6 +119,7 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 : const gfx::ImageSkia& app_icon) OVERRIDE; virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; virtual void FlashFrame(bool flash_frame) OVERRIDE; + virtual void OnRootViewLayout() const OVERRIDE; virtual void OnNativeWidgetFocus() OVERRIDE; virtual void OnNativeWidgetBlur() OVERRIDE; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 86012a5..f61be25ba 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -688,6 +688,9 @@ ui::NativeTheme* NativeWidgetAura::GetNativeTheme() const { #endif } +void NativeWidgetAura::OnRootViewLayout() const { +} + //////////////////////////////////////////////////////////////////////////////// // NativeWidgetAura, views::InputMethodDelegate implementation: diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index b14da5c..d0bbcd2 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h @@ -131,6 +131,7 @@ class VIEWS_EXPORT NativeWidgetAura virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; + virtual void OnRootViewLayout() const OVERRIDE; // Overridden from views::InputMethodDelegate: virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; diff --git a/ui/views/widget/native_widget_private.h b/ui/views/widget/native_widget_private.h index 3bdd681..16f66be 100644 --- a/ui/views/widget/native_widget_private.h +++ b/ui/views/widget/native_widget_private.h @@ -213,6 +213,7 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget { virtual void EndMoveLoop() = 0; virtual void SetVisibilityChangedAnimationsEnabled(bool value) = 0; virtual ui::NativeTheme* GetNativeTheme() const = 0; + virtual void OnRootViewLayout() const = 0; // Overridden from NativeWidget: virtual internal::NativeWidgetPrivate* AsNativeWidgetPrivate() OVERRIDE; diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index 8cfeca7..ebfa66f 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -456,6 +456,9 @@ ui::NativeTheme* NativeWidgetWin::GetNativeTheme() const { return ui::NativeTheme::instance(); } +void NativeWidgetWin::OnRootViewLayout() const { +} + //////////////////////////////////////////////////////////////////////////////// // NativeWidgetWin, NativeWidget implementation: diff --git a/ui/views/widget/native_widget_win.h b/ui/views/widget/native_widget_win.h index 1db1835..bc24630 100644 --- a/ui/views/widget/native_widget_win.h +++ b/ui/views/widget/native_widget_win.h @@ -146,6 +146,7 @@ class VIEWS_EXPORT NativeWidgetWin : public internal::NativeWidgetPrivate, virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; + virtual void OnRootViewLayout() const OVERRIDE; // Overridden from NativeWidget: virtual ui::EventHandler* GetEventHandler() OVERRIDE; diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc index c7fdffb..0f4e3b9 100644 --- a/ui/views/widget/root_view.cc +++ b/ui/views/widget/root_view.cc @@ -362,6 +362,11 @@ bool RootView::IsDrawn() const { return visible(); } +void RootView::Layout() { + View::Layout(); + widget_->OnRootViewLayout(); +} + const char* RootView::GetClassName() const { return kViewClassName; } diff --git a/ui/views/widget/root_view.h b/ui/views/widget/root_view.h index 5d206b2..0b674e9 100644 --- a/ui/views/widget/root_view.h +++ b/ui/views/widget/root_view.h @@ -101,6 +101,7 @@ class VIEWS_EXPORT RootView : public View, virtual const Widget* GetWidget() const OVERRIDE; virtual Widget* GetWidget() OVERRIDE; virtual bool IsDrawn() const OVERRIDE; + virtual void Layout() OVERRIDE; virtual const char* GetClassName() const OVERRIDE; virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index d28848a..18fd19e 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -967,6 +967,10 @@ void Widget::SynthesizeMouseMoveEvent() { root_view_->OnMouseMoved(mouse_event); } +void Widget::OnRootViewLayout() { + native_widget_->OnRootViewLayout(); +} + void Widget::OnOwnerClosing() { } diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index a65762f..cbf43bf 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -676,6 +676,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // mouse location to refresh hovering status in the widget. void SynthesizeMouseMoveEvent(); + // Called by our RootView after it has performed a Layout. Used to forward + // window sizing information to the window server on some platforms. + void OnRootViewLayout(); + // Notification that our owner is closing. // NOTE: this is not invoked for aura as it's currently not needed there. // Under aura menus close by way of activation getting reset when the owner |