sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit e511a32b70119a1a7ccc762ffbf0d814cf603a2b
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sat Mar 27 12:42:06 2021 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Mar 30 00:37:04 2021 +0200

    Outline folding: only hide the fold button when needed
    
    Current behavior is to always hide the fold button on mouse leave which
    is usually followed by a delayed showing of the same button. This patch
    prevents this hide show by only hiding the button when the button mouse
    leave results in leaving the area of the frame the button controls.
    
    Change-Id: Iecb544bfeffb32ac4ba7183719a193a96162c7c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113243
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx 
b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
index 3a8284fd4398..e866ac0549be 100644
--- a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
+++ b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx
@@ -249,10 +249,18 @@ IMPL_LINK(SwOutlineContentVisibilityWin, MouseMoveHdl, 
const MouseEvent&, rMEvt,
 {
     if (rMEvt.IsLeaveWindow())
     {
-        // MouseMove event may not be seen by edit window
-        // hide collapse button and grab focus to document
         if (GetSymbol() != ButtonSymbol::SHOW)
-            Hide();
+        {
+            // MouseMove event may not be seen by the edit window for example 
when move is to
+            // a show button or when move is outside of the edit window.
+            // Only hide when mouse leave results in leaving the frame.
+            tools::Rectangle aFrameAreaPxRect
+                = 
GetEditWin()->LogicToPixel(GetFrame()->getFrameArea().SVRect());
+            auto nY = GetPosPixel().getY() + rMEvt.GetPosPixel().getY();
+            if (nY <= 0 || nY <= aFrameAreaPxRect.Top() || nY >= 
aFrameAreaPxRect.Bottom()
+                || nY >= GetEditWin()->GetSizePixel().Height())
+                Hide();
+        }
         GrabFocusToDocument();
     }
     else if (rMEvt.IsEnterWindow())
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to