From 097faa945cfc7150d5c556444991f85458e9cea9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 14 Dec 2020 15:08:33 +0000 Subject: add a way to correctly position a weld::Menu given a vcl::Window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7fc6a1bb6cfca40a4a97568f957d127445b4d31c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107727 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/app/weldutils.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'vcl/source/app') diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index 837220447063..bce1f478a1f1 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -595,6 +596,21 @@ IMPL_LINK_NOARG(ButtonPressRepeater, RepeatTimerHdl, Timer*, void) m_aRepeat.SetTimeout(Application::GetSettings().GetMouseSettings().GetButtonRepeat()); m_aLink.Call(m_rButton); } + +weld::Window* GetPopupParent(vcl::Window& rOutWin, tools::Rectangle& rRect) +{ + rRect.SetPos(rOutWin.OutputToScreenPixel(rRect.TopLeft())); + rRect = FloatingWindow::ImplConvertToAbsPos(&rOutWin, rRect); + + vcl::Window* pWin = &rOutWin; + while (!pWin->IsTopWindow()) + pWin = pWin->GetParent(); + + rRect = FloatingWindow::ImplConvertToRelPos(pWin, rRect); + rRect.SetPos(pWin->ScreenToOutputPixel(rRect.TopLeft())); + + return rOutWin.GetFrameWeld(); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit