From ccbb507002b2bf20689def23066521506a1e9c2b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 8 May 2018 12:06:08 +0100 Subject: Related: tdf#117470 docking windows are toplevels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit but are not system windows according to vcl Change-Id: I7f404acc82ca51520b4fabd4d8a06769dc0f0fee Reviewed-on: https://gerrit.libreoffice.org/53971 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/source/app/salvtables.cxx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index a2dfb0f45e41..713e5acada9c 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -470,7 +470,7 @@ weld::Container* SalInstanceWidget::weld_parent() const class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window { private: - VclPtr m_xWindow; + VclPtr m_xWindow; DECL_LINK(HelpHdl, vcl::Window&, bool); @@ -489,7 +489,7 @@ private: } public: - SalInstanceWindow(SystemWindow* pWindow, bool bTakeOwnership) + SalInstanceWindow(vcl::Window* pWindow, bool bTakeOwnership) : SalInstanceContainer(pWindow, bTakeOwnership) , m_xWindow(pWindow) { @@ -545,7 +545,17 @@ public: virtual void resize_to_request() override { - m_xWindow->setOptimalLayoutSize(); + if (SystemWindow* pSysWin = dynamic_cast(m_xWindow.get())) + { + pSysWin->setOptimalLayoutSize(); + return; + } + if (DockingWindow* pDockWin = dynamic_cast(m_xWindow.get())) + { + pDockWin->setOptimalLayoutSize(); + return; + } + assert(false && "must be system or docking window"); } virtual void window_move(int x, int y) override @@ -553,7 +563,7 @@ public: m_xWindow->SetPosPixel(Point(x, y)); } - SystemWindow* getWindow() + vcl::Window* getWindow() { return m_xWindow.get(); } @@ -2237,9 +2247,9 @@ weld::Window* SalFrame::GetFrameWeld() const { vcl::Window* pWindow = GetWindow(); pWindow = pWindow ? pWindow->ImplGetWindow() : nullptr; - SystemWindow* pSystemWindow = pWindow ? pWindow->GetSystemWindow() : nullptr; - if (pSystemWindow) - m_xFrameWeld.reset(new SalInstanceWindow(pSystemWindow, false)); + assert(!pWindow || (pWindow->IsSystemWindow() || pWindow->IsDockingWindow())); + if (pWindow) + m_xFrameWeld.reset(new SalInstanceWindow(pWindow, false)); } return m_xFrameWeld.get(); } -- cgit