diff options
author | Jim Raykowski <raykowj@gmail.com> | 2023-11-08 12:25:47 -0900 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-02-06 12:28:51 +0100 |
commit | c23648abcf78eee2f6c2c3e0f1e9d842daba49b0 (patch) | |
tree | 7214898275cdba10d067c6466d7f05e6d5aa56f3 /vcl | |
parent | 22345c29d126cc7d250ed0c8e35173d1722160f6 (diff) |
tdf#158101 Make non-gtk backends context popup menu item
visibility behavior like gtk
For context popup menus, gtk's native popup menu hides disabled menu
items. This patch makes this the behavior for non-gtk backends while
preserving the intent of commit
a0955317900075371d6adb7f924af24c22f02d09 to make VCL PopupMenu respect
the officecfg::Office::Common::View::Menu::DontHideDisabledEntry setting.
Change-Id: Ice59f2b5ec20dac9d1b0891ccbd83dbbcd308078
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159192
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
(cherry picked from commit 1ac7350a7032a760be22cce845eab7efe435827d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162825
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/salvtables.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 95beb907f6c0..50ecd194bdcd 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1068,6 +1068,12 @@ void SalInstanceToolbar::set_menu_item_active(const OUString& rIdent, bool bActi { if (bActive) { + MenuFlags nMenuFlags = pPopup->GetMenuFlags(); + if (officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get()) + nMenuFlags &= ~MenuFlags::HideDisabledEntries; + else + nMenuFlags |= MenuFlags::HideDisabledEntries; + pPopup->SetMenuFlags(nMenuFlags); tools::Rectangle aRect = m_xToolBox->GetItemRect(nItemId); pPopup->Execute(m_xToolBox, aRect, PopupMenuFlags::ExecuteDown); } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 82d630742ab5..a0a03be455cb 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2863,9 +2863,12 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& pParentWin, tools::Rectang if (bRealExecute) nPopupModeFlags |= FloatWinPopupFlags::NewLevel; + // MenuFlags get clobbered in the Activate function. Restore them after calling. + MenuFlags nMenuFlagsSaved = GetMenuFlags(); bInCallback = true; // set it here, if Activate overridden Activate(); bInCallback = false; + SetMenuFlags(nMenuFlagsSaved); if (pParentWin->isDisposed()) return false; @@ -2884,13 +2887,6 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& pParentWin, tools::Rectang else nMenuFlags &= ~MenuFlags::HideDisabledEntries; } - else - { - if (officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get()) - nMenuFlags &= ~MenuFlags::HideDisabledEntries; - else - nMenuFlags |= MenuFlags::HideDisabledEntries; - } sal_uInt16 nVisibleEntries = ImplGetVisibleItemCount(); if ( !nVisibleEntries ) |