[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 28 18:48:21 UTC 2021


 sw/source/uibase/docvw/edtdd.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 9f46ae1ab572b62af01119dcd473f99184e4760c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 28 17:19:30 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Apr 28 20:47:36 2021 +0200

    tdf#116384 only drag hyperlink if user's not currently setting the selection
    
    which is what writer does for normal text.
    
    Under gtk it's common on selecting by dragging the mouse over a hyperlink
    for one or two letters of the hyperlink to get selected before that
    selection then gets dragged as dnd.
    
    Under gen StartDragWidth is 2 by default so the drag kicks in before
    enough text has been selected for writer to select anything, but under
    gtk gtk-dnd-drag-threshold is used for StartDragWidth and that is 8 by
    default making it easy to select one or two characters before the
    gesture is recognized as a possible drag.
    
    it seems sane to do the same as for normal text and not dnd if the user
    is still using the mouse to set a selection
    
    Change-Id: I971d429acaf8a5a656c5ce58f52632979b94e40a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114817
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index 3436c4159771..c8984a32844b 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -84,7 +84,8 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
     bool bStart = false, bDelSelect = false;
     SdrObject *pObj = nullptr;
     Point aDocPos( PixelToLogic( rPosPixel ) );
-    if ( !rSh.IsInSelect() && rSh.TestCurrPam( aDocPos, true))
+    const bool bInSelect = rSh.IsInSelect();
+    if (!bInSelect && rSh.TestCurrPam(aDocPos, true))
         //We are not selecting and aren't at a selection
         bStart = true;
     else if ( !g_bFrameDrag && rSh.IsSelFrameMode() &&
@@ -110,7 +111,7 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
         else
             rSh.UnlockPaint();
     }
-    else
+    else if (!bInSelect)// tdf#116384 only drag hyperlink if user's not currently setting the selection
     {
         SwContentAtPos aSwContentAtPos( IsAttrAtPos::InetAttr );
         bStart = rSh.GetContentAtPos( aDocPos,


More information about the Libreoffice-commits mailing list