svx/inc/galbrws2.hxx             |    2 +-
 svx/source/gallery2/galbrws2.cxx |    7 ++++---
 svx/source/gallery2/galctrl.cxx  |    4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit b4254d6cf27849ef4d61d94570b2cf27cc40f61b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu May 4 09:53:37 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu May 4 14:15:46 2023 +0200

    Resolves: tdf#155140 gallery right click for context menu doesn't consume 
event
    
    Change-Id: I13b6d62561e3d9eed47f81c4268a6a32ff108b40
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151289
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index 2cf8609ed32b..4dd8b25c7120 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -143,7 +143,7 @@ public:
     sal_Int8            ExecuteDrop( const ExecuteDropEvent& rEvt );
     bool                StartDrag();
     void                TogglePreview();
-    void                ShowContextMenu(const CommandEvent& rCEvt);
+    bool                ShowContextMenu(const CommandEvent& rCEvt);
     bool                KeyInput(const KeyEvent& rEvt);
     bool                ViewBoxHasFocus() const;
 
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index f2732757d161..310b7895671a 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -486,20 +486,20 @@ void GalleryBrowser2::TogglePreview()
     GetViewWindow()->grab_focus();
 }
 
-void GalleryBrowser2::ShowContextMenu(const CommandEvent& rCEvt)
+bool GalleryBrowser2::ShowContextMenu(const CommandEvent& rCEvt)
 {
     Point aMousePos = rCEvt.GetMousePosPixel();
     Point aSelPos;
     const sal_uInt32 nItemId = ImplGetSelectedItemId( rCEvt.IsMouseEvent() ? 
&aMousePos : nullptr, aSelPos );
 
     if( !(mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() 
)) )
-        return;
+        return false;
 
     ImplSelectItemId( nItemId );
 
     css::uno::Reference< css::frame::XFrame > xFrame( GetFrame() );
     if ( !xFrame.is() )
-        return;
+        return false;
 
     weld::Widget* pParent = GetViewWindow();
     mnCurActionPos = nItemId - 1;
@@ -511,6 +511,7 @@ void GalleryBrowser2::ShowContextMenu(const CommandEvent& 
rCEvt)
             GALLERYBROWSERMODE_PREVIEW == GetMode(),
             this ) );
     xPopup->ExecutePopup(pParent, aSelPos);
+    return true;
 }
 
 bool GalleryBrowser2::ViewBoxHasFocus() const
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index ae9de1ce77b8..716a198ec87f 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -384,9 +384,9 @@ bool GalleryIconView::Command(const CommandEvent& rCEvt)
 {
     bool bRet = ValueSet::Command(rCEvt);
 
-    if (rCEvt.GetCommand() == CommandEventId::ContextMenu)
+    if (!bRet && rCEvt.GetCommand() == CommandEventId::ContextMenu)
     {
-        mpParent->ShowContextMenu(rCEvt);
+        bRet = mpParent->ShowContextMenu(rCEvt);
     }
 
     return bRet;

Reply via email to