[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sd/source

Caolán McNamara caolanm at redhat.com
Fri Jul 28 10:51:31 UTC 2017


 sd/source/ui/slidesorter/controller/SlideSorterController.cxx     |   14 +++++++---
 sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx |    1 
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 6e812e78cdbda7704414f9bc76830d043d38e2a5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 24 21:32:30 2017 +0100

    don't jump back to selected slide on right click context menu
    
    i.e. two many slides to fit in slide sorter panel, so scroll bar,
    select slide one, scroll to the end and right click between slides
    (or anywhere that isn't a slide) and without this fix the sorter
    jumps back to make the selected slide 1 visible. The right click
    menu will offer "new slide", choosing that will insert a slide
    at the point that was originally clicked, not at the point it
    was scrolled back to
    
    losing focus trigger a (dubious looking) callback to jump to the
    selected slide, so disable it while context menu is up
    
    Change-Id: Ie42bf158258cc38c9b7cfda7672f24d2ac8bfa11
    Reviewed-on: https://gerrit.libreoffice.org/40382
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index dfbf1692ef8d..dfd07f3de532 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -111,6 +111,7 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
       mpListener(),
       mnModelChangeLockCount(0),
       mbIsForcedRearrangePending(false),
+      mbContextMenuOpen(false),
       mbPreModelChangeDone(false),
       mbPostModelChangePending(false),
       maSelectionBeforeSwitch(),
@@ -386,7 +387,9 @@ bool SlideSorterController::Command (
                 SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
                 if (pDispatcher != nullptr)
                 {
+                    mbContextMenuOpen = true;
                     pDispatcher->ExecutePopup( aPopupId, pWindow, &aMenuLocation );
+                    mbContextMenuOpen = false;
                     mrSlideSorter.GetView().UpdatePageUnderMouse();
                     ::rtl::Reference<SelectionFunction> pFunction(GetCurrentSelectionFunction());
                     if (pFunction.is())
@@ -553,9 +556,14 @@ IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent&, rEvent, vo
                     GetFocusManager().HideFocus();
                     mrView.GetToolTip().Hide();
 
-                    // Select the current slide so that it is properly
-                    // visualized when the focus is moved to the edit view.
-                    GetPageSelector().SelectPage(GetCurrentSlideManager()->GetCurrentSlide());
+                    //don't scroll back to the selected slide when we lose
+                    //focus due to a temporary active context menu
+                    if (!mbContextMenuOpen)
+                    {
+                        // Select the current slide so that it is properly
+                        // visualized when the focus is moved to the edit view.
+                        GetPageSelector().SelectPage(GetCurrentSlideManager()->GetCurrentSlide());
+                    }
                 }
                 break;
 
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index cee9f9631bd8..33130e5aeea0 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -240,6 +240,7 @@ private:
 
     int mnModelChangeLockCount;
     bool mbIsForcedRearrangePending;
+    bool mbContextMenuOpen;
 
     bool mbPreModelChangeDone;
     bool mbPostModelChangePending;


More information about the Libreoffice-commits mailing list