[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - vcl/inc vcl/unx

Thomas Viehmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 25 13:57:08 UTC 2020


 vcl/inc/unx/gtk/gtksalmenu.hxx  |    2 +-
 vcl/unx/gtk3/gtk3gtksalmenu.cxx |   22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 5270d6901ba69f411b595fa9e2d123169905ab72
Author:     Thomas Viehmann <tv at beamnet.de>
AuthorDate: Mon Nov 23 21:03:28 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Nov 25 14:56:33 2020 +0100

    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 at redhat.com>
    (cherry picked from commit cbc18cc904c652a936c4b68fba4d975bd89b5abd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106583

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());
     }
 }
 


More information about the Libreoffice-commits mailing list