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

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 16 12:01:05 UTC 2021


 sc/source/ui/view/gridwin.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 1241983ec433598e70bc422d769750bfbd094431
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Wed Aug 11 16:40:34 2021 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Mon Aug 16 14:00:12 2021 +0200

    sc: lok: avoid selection jumps with multiple users
    
    In LOK case, avoid spurious "leavingwindow" mouse move events which has
    negative coordinates. We later use these coordinates to compute the cell
    address corresponding to the event to extend the selection which will be
    wrong in this case. Such spurious events occur for some reason when a
    user is selecting a range, (even when not leaving the view area) with
    one or more other viewers in that sheet. The root cause of these bad
    coordinates seems to be in vcl
    
    in winproc.cxx, ImplHandleMouseEvent() in the code block starting
    ```
    // test for mouseleave and mouseenter
    VclPtr<vcl::Window> pMouseMoveWin = pWinFrameData->mpMouseMoveWin;
    if ( pChild != pMouseMoveWin )
    {
        if ( pMouseMoveWin )
        {
            Point aLeaveMousePos = pMouseMoveWin->ImplFrameToOutput( aMousePos );
    ```
    
    This needs more investigation. Meanwhile this interim patch fixes the
    issue of selection jump by avoiding those unhelpful mouse events.
    
    Conflicts:
            sc/source/ui/view/gridwin.cxx
    
    Change-Id: I01fb3ae6a3903ada2a44a8b3d2b4a46b0122326b
    Signed-off-by: Dennis Francis <dennis.francis at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120317
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Mert Tumer <mert.tumer at collabora.com>
    (cherry picked from commit 7eb8a1d6c5697fd89ff75d3b116bbbf6c2de6950)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120443
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index f944f72faea7..c7e95a54721c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2664,8 +2664,14 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
         }
     }
 
-    if ( mrViewData.GetView()->GetSelEngine()->SelMouseMove( rMEvt ) )
-        return;
+    // In LOK case, avoid spurious "leavingwindow" mouse move events which has negative coordinates.
+    // Such events occur for some reason when a user is selecting a range, (even when not leaving the view area)
+    // with one or more other viewers in that sheet.
+    bool bSkipSelectionUpdate = comphelper::LibreOfficeKit::isActive() &&
+        rMEvt.IsLeaveWindow() && (aCurMousePos.X() < 0 || aCurMousePos.Y() < 0);
+
+    if (!bSkipSelectionUpdate)
+        mrViewData.GetView()->GetSelEngine()->SelMouseMove( rMEvt );
 }
 
 static void lcl_InitMouseEvent(css::awt::MouseEvent& rEvent, const MouseEvent& rEvt)


More information about the Libreoffice-commits mailing list