diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-10-08 20:40:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-10-09 11:11:37 +0200 |
commit | 1ba990fc26fde5e34b05981a2202b9f96f4475df (patch) | |
tree | 22a101ac4526b64ec396e88ca00127c84ccc202b /vcl | |
parent | 173595f7c4ce8e2dc2fedfa78eedbff2f9efdb20 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
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 |