sd/source/ui/animations/CustomAnimationList.cxx |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 794b93daa9bc31f4ca78d5d88a8dafb12f7ff869
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Mar 7 14:05:11 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Mar 7 18:06:54 2022 +0100

    Resolves: tdf#146825 select under mouse on right click
    
    if something isn't already selected
    
    Change-Id: Ifa692cd71bb71ecb5c7af732deef510f2bac5fce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131111
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sd/source/ui/animations/CustomAnimationList.cxx 
b/sd/source/ui/animations/CustomAnimationList.cxx
index c5690a0c113f..9dcde6d8e9a2 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -1147,6 +1147,22 @@ IMPL_LINK(CustomAnimationList, CommandHdl, const 
CommandEvent&, rCEvt, bool)
     if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
         return false;
 
+    if (rCEvt.IsMouseEvent())
+    {
+        ::Point aPos = rCEvt.GetMousePosPixel();
+        std::unique_ptr<weld::TreeIter> xIter(mxTreeView->make_iterator());
+        if (mxTreeView->get_dest_row_at_pos(aPos, xIter.get(), false) && 
!mxTreeView->is_selected(*xIter))
+        {
+            mxTreeView->unselect_all();
+            mxTreeView->set_cursor(*xIter);
+            mxTreeView->select(*xIter);
+            SelectHdl(*mxTreeView);
+        }
+    }
+
+    if (!mxTreeView->get_selected(nullptr))
+        return false;
+
     std::unique_ptr<weld::Builder> 
xBuilder(Application::CreateBuilder(mxTreeView.get(), 
"modules/simpress/ui/effectmenu.ui"));
     std::unique_ptr<weld::Menu> xMenu = xBuilder->weld_menu("menu");
 

Reply via email to