vcl/unx/gtk3/gtkinst.cxx |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

New commits:
commit 36d5e26549b273118cea8969c43ef5ad3845f8df
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Sep 30 12:20:42 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Sep 30 16:26:59 2021 +0200

    tdf#141633 multiple line entry font size/zoom not taking effect
    
    The "sample db" example (Mockup.odb) has multiline entries used in its
    "Journal Entry" column. Those are painted by taking snapshots of a
    never-really-shown textview widget.  But the textview is always drawn
    using its original default font size and changing the page zoom and/or
    font size had no effect on the size of text in the "Journal Entry"
    column.
    
    explicitly emit style_updated to get the GtkTextView to sync its font
    size from the css changed by the set_font
    
    Change-Id: Ic7d644b13c28f30a2c646b9d4098ea6e7f0dab81
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122889
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 913494fb47bd..b05cc4747caf 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -3265,6 +3265,16 @@ private:
                                        
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+    static void update_style(GtkWidget* pWidget, gpointer pData)
+    {
+        if (GTK_IS_CONTAINER(pWidget))
+            gtk_container_foreach(GTK_CONTAINER(pWidget), update_style, pData);
+        GtkWidgetClass* pWidgetClass = GTK_WIDGET_GET_CLASS(pWidget);
+        pWidgetClass->style_updated(pWidget);
+    }
+#endif
+
 public:
     GtkInstanceWidget(GtkWidget* pWidget, GtkInstanceBuilder* pBuilder, bool 
bTakeOwnership)
         : m_pWidget(pWidget)
@@ -4321,7 +4331,20 @@ public:
         bool bAlreadyMapped = gtk_widget_get_mapped(m_pWidget);
 
         if (!bAlreadyRealized)
+        {
+#if !GTK_CHECK_VERSION(4, 0, 0)
+            /*
+               tdf#141633 The "sample db" example (Mockup.odb) has multiline
+               entries used in its "Journal Entry" column. Those are painted by
+               taking snapshots of a never-really-shown textview widget.
+               Without this style_updated then the textview is always drawn
+               using its original default font size and changing the page zoom
+               has no effect on the size of text in the "Journal Entry" column.
+            */
+            update_style(m_pWidget, nullptr);
+#endif
             gtk_widget_realize(m_pWidget);
+        }
         if (!bAlreadyVisible)
             gtk_widget_show(m_pWidget);
         if (!bAlreadyMapped)

Reply via email to