[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 19 14:22:17 UTC 2021


 vcl/unx/gtk3/gtk3gtkinst.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 74e8f0b63894c921535d949fe0eebb43f7be52ed
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 19 11:52:29 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 19 15:21:31 2021 +0100

    detect if menubutton already has an image and reuse it
    
    Change-Id: Id8e48491ad27cd3bfac96817ae1bb4da751c38e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111210
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 470fae9387ea..5bbc0f125f3d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7586,6 +7586,17 @@ private:
         }
     }
 
+    static void find_image(GtkWidget *pWidget, gpointer user_data)
+    {
+        if (GTK_IS_IMAGE(pWidget))
+        {
+            GtkImage **ppImage = static_cast<GtkImage**>(user_data);
+            *ppImage = GTK_IMAGE(pWidget);
+        }
+        else if (GTK_IS_CONTAINER(pWidget))
+            gtk_container_forall(GTK_CONTAINER(pWidget), find_image, user_data);
+    }
+
 public:
     GtkInstanceMenuButton(GtkMenuButton* pMenuButton, GtkWidget* pMenuAlign, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
         : GtkInstanceToggleButton(GTK_TOGGLE_BUTTON(pMenuButton), pBuilder, bTakeOwnership)
@@ -7598,6 +7609,7 @@ public:
         , m_nSignalId(0)
     {
         m_pLabel = gtk_bin_get_child(GTK_BIN(m_pMenuButton));
+        find_image(GTK_WIDGET(m_pMenuButton), &m_pImage);
         m_pBox = formatMenuButton(m_pLabel);
     }
 


More information about the Libreoffice-commits mailing list