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

New commits:
commit dd1db430fe8009250253756573a1a19a45830c5f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Sep 14 10:57:51 2018 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Sep 14 14:00:30 2018 +0200

    Related: tdf#118038 use an intermediate GdkPixbuf under gtk < 3.20.0
    
    otherwise the GtkImage's width isn't right
    
    Change-Id: Id5e44749fb9925037d5777512e3123de8840d346
    Reviewed-on: https://gerrit.libreoffice.org/60484
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f93b59806cb7..1d5ca9e415ef 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3135,7 +3135,18 @@ public:
             gtk_widget_show(GTK_WIDGET(m_pImage));
         }
         if (pDevice)
-            gtk_image_set_from_surface(m_pImage, 
get_underlying_cairo_surface(*pDevice));
+        {
+            cairo_surface_t* surface = get_underlying_cairo_surface(*pDevice);
+            if (gtk_check_version(3, 20, 0) == nullptr)
+                gtk_image_set_from_surface(m_pImage, 
get_underlying_cairo_surface(*pDevice));
+            else
+            {
+                Size aSize(pDevice->GetOutputSizePixel());
+                GdkPixbuf* pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0, 
aSize.Width(), aSize.Height());
+                gtk_image_set_from_pixbuf(m_pImage, pixbuf);
+                g_object_unref(pixbuf);
+            }
+        }
         else
             gtk_image_set_from_surface(m_pImage, nullptr);
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to