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

Caolán McNamara caolanm at redhat.com
Wed Mar 7 20:19:34 UTC 2018


 vcl/unx/gtk3/gtk3gtkinst.cxx |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

New commits:
commit f2a8f440bf2e8ad9ad0d595d1ab0cecf08de4a5c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 6 17:27:05 2018 +0000

    workaround https://gitlab.gnome.org/GNOME/gtk/issues/70
    
    Change-Id: I9175543f691095b843acc97ec3ad7f8299458337
    Reviewed-on: https://gerrit.libreoffice.org/50879
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ef8060662269..4a8912594e45 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2545,10 +2545,32 @@ private:
     GtkExpander* m_pExpander;
     gulong m_nSignalId;
 
-    static void signalExpanded(GtkExpander*, GParamSpec *, gpointer widget)
+    static void signalExpanded(GtkExpander* pExpander, GParamSpec *, gpointer widget)
     {
         GtkInstanceExpander* pThis = static_cast<GtkInstanceExpander*>(widget);
         pThis->signal_expanded();
+
+        GtkWidget *pToplevel = gtk_widget_get_toplevel(GTK_WIDGET(pExpander));
+
+        // https://gitlab.gnome.org/GNOME/gtk/issues/70
+        // I imagine at some point a release with a fix will be available in which
+        // case this can be avoided depending on version number
+        if (pToplevel && GTK_IS_WINDOW(pToplevel) && gtk_widget_get_realized(pToplevel))
+        {
+            int nToplevelWidth, nToplevelHeight;
+            int nChildHeight;
+
+            GtkWidget* child = gtk_bin_get_child(GTK_BIN(pExpander));
+            gtk_widget_get_preferred_height(child, &nChildHeight, nullptr);
+            gtk_window_get_size(GTK_WINDOW(pToplevel), &nToplevelWidth, &nToplevelHeight);
+
+            if (pThis->get_expanded())
+                nToplevelHeight += nChildHeight;
+            else
+                nToplevelHeight -= nChildHeight;
+
+            gtk_window_resize(GTK_WINDOW(pToplevel), nToplevelWidth, nToplevelHeight);
+        }
     }
 
 public:


More information about the Libreoffice-commits mailing list