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 a831886004fba93a4eb0e5675b1e3e8afbe3d3bb Author: Caolán McNamara <[email protected]> AuthorDate: Thu May 4 09:53:37 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Thu May 4 21:22:14 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/+/151355 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx index 9cfb5c7148d1..d5ca8a50a041 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 52c05515237d..8285419d1809 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;
