diff options
author | Thomas Viehmann <tv@beamnet.de> | 2020-11-23 21:03:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-25 10:50:07 +0100 |
commit | cbc18cc904c652a936c4b68fba4d975bd89b5abd (patch) | |
tree | be577c0d914b7d8ce904d72279df628538775392 | |
parent | 2f13fcb67269f99b890f5bb4c63117805e375692 (diff) |
tdf#138425 vcl/gtk activate main menu in UpdateFull
VCL GTK (in contrast to X11 and apparently Windows) pre-activates popup
menus in GtkSalMenu::UpdateFull by calling GtkSalMenu::ActivateAllSubmenus.
Before this patch, this, called on the main menu, would not activate
the main menu itself (which does get activated in X11 eventually).
This patch changes the logic to also activate the main menu.
This patch deals only with gtk3. A followup patch would do the analogous
change in the VCL Qt5 plugin in Qt5Menu::DoFullMenuUpdate.
I haven't discovered yet where this type of functionality is currently
tested, so sadly I don't have an idea how to test this and so didn't include
a test case.
Change-Id: I6cd9929acfd3b3af731bbc62d649d643044ca692
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106454
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/inc/unx/gtk/gtksalmenu.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtksalmenu.cxx | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index d9aa403de9bd..d4857fe7e87a 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -112,7 +112,7 @@ public: bool PrepUpdate(); virtual void Update() override; // Update this menu only. // Update full menu hierarchy from this menu. - void UpdateFull () { ActivateAllSubmenus(mpVCLMenu); Update(); } + void UpdateFull () { ActivateAllSubmenus(mpVCLMenu); } // Clear ActionGroup and MenuModel from full menu hierarchy void ClearActionGroupAndMenuModel(); GtkSalMenu* GetTopLevel(); diff --git a/vcl/unx/gtk3/gtk3gtksalmenu.cxx b/vcl/unx/gtk3/gtk3gtksalmenu.cxx index 195e8ce071d2..72ad6e40d6bd 100644 --- a/vcl/unx/gtk3/gtk3gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtk3gtksalmenu.cxx @@ -1205,23 +1205,23 @@ void GtkSalMenu::DispatchCommand(const gchar *pCommand) void GtkSalMenu::ActivateAllSubmenus(Menu* pMenuBar) { - for (GtkSalMenuItem* pSalItem : maItems) + // We can re-enter this method via the new event loop that gets created + // in GtkClipboardTransferable::getTransferDataFlavorsAsVector, so use the InActivateCallback + // flag to detect that and skip some startup work. + if (!mbInActivateCallback) { - if ( pSalItem->mpSubMenu != nullptr ) + mbInActivateCallback = true; + pMenuBar->HandleMenuActivateEvent(GetMenu()); + mbInActivateCallback = false; + for (GtkSalMenuItem* pSalItem : maItems) { - // We can re-enter this method via the new event loop that gets created - // in GtkClipboardTransferable::getTransferDataFlavorsAsVector, so use the InActivateCallback - // flag to detect that and skip some startup work. - if (!pSalItem->mpSubMenu->mbInActivateCallback) + if ( pSalItem->mpSubMenu != nullptr ) { - pSalItem->mpSubMenu->mbInActivateCallback = true; - pMenuBar->HandleMenuActivateEvent(pSalItem->mpSubMenu->GetMenu()); - pSalItem->mpSubMenu->mbInActivateCallback = false; pSalItem->mpSubMenu->ActivateAllSubmenus(pMenuBar); - pSalItem->mpSubMenu->Update(); - pMenuBar->HandleMenuDeActivateEvent(pSalItem->mpSubMenu->GetMenu()); } } + Update(); + pMenuBar->HandleMenuDeActivateEvent(GetMenu()); } } |