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/+/131130
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 4c18a84..0fd28d6a 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -1148,6 +1148,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");