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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 09:12:58 UTC 2019


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

New commits:
commit 1ba990fc26fde5e34b05981a2202b9f96f4475df
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 8 20:40:37 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 9 11:11:37 2019 +0200

    get SAL_USE_VCLPLUGIN=gtk3 make screenshot to work
    
    for the "known dialog" cases of make screenshot which instantiate the
    real dialog, which are native in this scenario, and get snapshot of them.
    
    the rest of the dialogs still currently are visualized via the VclBuilder
    fallback
    
    Change-Id: Ic255c3aae2661829c5e6dba392a88f1c0e40e882
    Reviewed-on: https://gerrit.libreoffice.org/80496
    Tested-by: Jenkins
    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 bc5a7047915b..6d055257a055 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4124,6 +4124,21 @@ public:
 
     virtual void draw(VirtualDevice& rOutput) override
     {
+        // detect if we have to manually setup its size
+        bool bAlreadyRealized = gtk_widget_get_realized(GTK_WIDGET(m_pDialog));
+        // has to be visible for draw to work
+        bool bAlreadyVisible = gtk_widget_get_visible(GTK_WIDGET(m_pDialog));
+        if (!bAlreadyVisible)
+            gtk_widget_show(GTK_WIDGET(m_pDialog));
+
+        if (!bAlreadyRealized)
+        {
+            GtkAllocation allocation;
+            gtk_widget_realize(GTK_WIDGET(m_pDialog));
+            gtk_widget_get_allocation(GTK_WIDGET(m_pDialog), &allocation);
+            gtk_widget_size_allocate(GTK_WIDGET(m_pDialog), &allocation);
+        }
+
         rOutput.SetOutputSizePixel(get_size());
         cairo_surface_t* pSurface = get_underlying_cairo_surface(rOutput);
         cairo_t* cr = cairo_create(pSurface);
@@ -4141,6 +4156,11 @@ public:
         gtk_widget_draw(GTK_WIDGET(m_pDialog), cr);
 
         cairo_destroy(cr);
+
+        if (!bAlreadyVisible)
+            gtk_widget_hide(GTK_WIDGET(m_pDialog));
+        if (!bAlreadyRealized)
+            gtk_widget_unrealize(GTK_WIDGET(m_pDialog));
     }
 
     virtual weld::ScreenShotCollection collect_screenshot_data() override


More information about the Libreoffice-commits mailing list