vcl/source/window/floatwin.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 2b3dcd24e4da1f83bfaf8e0ffd93839eeae621b0
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Jul 26 10:35:36 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Jul 26 12:13:04 2023 +0200

    Revert "simplify logic in FloatingWindow::ImplCalcPos"
    
    This reverts commit ea3317188589554ea5773db53aa9e0cc88bee271.
    
    Reason for revert: There are 3 different coordinate systems at work here, 
not 2, my mistake.
    
    Change-Id: Iee69b8ba3c2fe60b26b118e79116035be42c6c45
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154922
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index aa3abb3ec16b..3aff8ef400c0 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -445,6 +445,8 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
 
     rArrangeIndex = nArrangeIndex;
 
+    aPos = pW->AbsoluteScreenToOutputPixel( aPos );
+
     // store a cliprect that can be used to clip the common edge of the 
itemrect and the floating window
     if( pFloatingWindow && pFloatingWindow->mpImplData->mpBox )
     {
@@ -454,8 +456,6 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
 
     if (bLOKActive && pLOKTwipsPos)
     {
-        Point aPosOut = pW->AbsoluteScreenToOutputPixel( aPos );
-
         if (pW->IsMapModeEnabled() || pW->GetMapMode().GetMapUnit() == 
MapUnit::MapPixel)
         {
             // if we use pW->LogicToLogic(aPos, pW->GetMapMode(), 
MapMode(MapUnit::MapTwip)),
@@ -466,16 +466,16 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
             // and anyway the following is what we already do in
             // ScGridWindow::LogicInvalidate when map mode is not enabled.
 
-            *pLOKTwipsPos = pW->PixelToLogic(aPosOut, 
MapMode(MapUnit::MapTwip));
+            *pLOKTwipsPos = pW->PixelToLogic(aPos, MapMode(MapUnit::MapTwip));
         }
         else
         {
-            *pLOKTwipsPos = OutputDevice::LogicToLogic(aPosOut, 
pW->GetMapMode(), MapMode(MapUnit::MapTwip));
+            *pLOKTwipsPos = OutputDevice::LogicToLogic(aPos, pW->GetMapMode(), 
MapMode(MapUnit::MapTwip));
         }
     }
 
     // caller expects coordinates relative to top-level win
-    return aPos;
+    return pW->OutputToScreenPixel( aPos );
 }
 
 Point FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const 
Point& rPos)

Reply via email to