diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-02-07 17:53:40 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-02-15 12:08:07 +0000 |
commit | 2abdcfd641883f246fe78f2fbe38499c9382c059 (patch) | |
tree | afbe57205258c7371f732389deb33c33cd49d639 /vcl/source | |
parent | 7347248254595c082682180f7a1cfe768f5509a6 (diff) |
tdf#97665 Let's hope that over activation isn't really needed
- MenuBarManager::Activate has a check for duplicate activation,
which makes the second activation attempt fail. Removing this
check or deactivating after each activation will likely affect
performance even more, but on the other hand should solve
lp#1296715, which was the main reason of the over activation
in the first place. So let's activate only one menu at a time,
and do full activation only on the initial update.
- Unfortunately the HUD activation callback doesn't work, so
we still have to keep active status listener for all menu
items. (Which is BTW against the recommendation in
XPopupMenuController::updatePopupMenu IDL doc. Fortunately
the performance problem hardly noticeable on modern hw.)
Change-Id: I96affa72412f3f38160fdca4b6efd20ca68d059f
Reviewed-on: https://gerrit.libreoffice.org/22369
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/window/menu.cxx | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 3be6868a9117..b6b1ce5db7f9 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2309,6 +2309,12 @@ bool Menu::HasValidEntries( bool bCheckPopups ) return bValidEntries; } +void Menu::UpdateNativeMenu() +{ + if ( ImplGetSalMenu() ) + ImplGetSalMenu()->Update(); +} + void Menu::MenuBarKeyInput(const KeyEvent&) { } @@ -3221,44 +3227,4 @@ ImplMenuDelData::~ImplMenuDelData() const_cast< Menu* >( mpMenu )->ImplRemoveDel( *this ); } -namespace vcl { namespace MenuInvalidator { - -struct MenuInvalidateListeners : public vcl::DeletionNotifier -{ - std::vector<Link<LinkParamNone*,void>> m_aListeners; -}; - -static MenuInvalidateListeners* pMenuInvalidateListeners = nullptr; - -void AddMenuInvalidateListener(const Link<LinkParamNone*,void>& rLink) -{ - if(!pMenuInvalidateListeners) - pMenuInvalidateListeners = new MenuInvalidateListeners(); - // ensure uniqueness - auto& rListeners = pMenuInvalidateListeners->m_aListeners; - if (std::find(rListeners.begin(), rListeners.end(), rLink) == rListeners.end()) - rListeners.push_back( rLink ); -} - -void Invalidated() -{ - if(!pMenuInvalidateListeners) - return; - - vcl::DeletionListener aDel( pMenuInvalidateListeners ); - - auto& rYieldListeners = pMenuInvalidateListeners->m_aListeners; - // Copy the list, because this can be destroyed when calling a Link... - std::vector<Link<LinkParamNone*,void>> aCopy( rYieldListeners ); - for( Link<LinkParamNone*,void>& rLink : aCopy ) - { - if (aDel.isDeleted()) break; - // check this hasn't been removed in some re-enterancy scenario fdo#47368 - if( std::find(rYieldListeners.begin(), rYieldListeners.end(), rLink) != rYieldListeners.end() ) - rLink.Call( nullptr ); - } -}; - -} } // namespace vcl::MenuInvalidator - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |