From fd59e15b6889ddc77bb1be09a2a97f54fe3b3a19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Wed, 1 Feb 2017 17:24:26 +0000
Subject: [PATCH] fix crash with gtk3, opengl and presentation console
PresenterSlideShowView::PaintInnerWindow has a mbIsForcedPaintPending flag
which is used to throw away the console canvas, but for other backends the
paint occurs at a much different time after a clear has a chance to get
triggered, while for gtk3 it happens as its being setup.
hack around this presenter console weirdness by skipping the initial
paint for this salsysobj case
Change-Id: If1b23600ef07241e52d92bd5eb38b9e90d9ed192
(cherry picked from commit 0861cb6d72f0d718928a1998c8a0e2c690e8b09f)
---
vcl/inc/unx/gtk/gtkframe.hxx | 2 ++
vcl/inc/unx/gtk/gtkobject.hxx | 1 +
vcl/unx/gtk3/gtk3gtkframe.cxx | 10 ++++++++++
vcl/unx/gtk3/gtk3gtkobject.cxx | 7 ++++---
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index c0f2350..874566d 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -354,6 +354,7 @@ public:
#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_t* m_pSurface;
DamageHandler m_aDamageHandler;
+ bool m_bSalObjectSetPosSize;
#endif
GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
GtkSalFrame( SystemParentData* pSysData );
@@ -431,6 +432,7 @@ public:
static void closePopup();
+ void nopaint_container_resize_children(GtkContainer*);
#endif
virtual ~GtkSalFrame();
diff --git a/vcl/inc/unx/gtk/gtkobject.hxx b/vcl/inc/unx/gtk/gtkobject.hxx
index 55896a2..1b048eb 100644
--- a/vcl/inc/unx/gtk/gtkobject.hxx
+++ b/vcl/inc/unx/gtk/gtkobject.hxx
@@ -30,6 +30,7 @@ class GtkSalObject : public SalObject
SystemEnvData m_aSystemData;
GtkWidget* m_pSocket;
#if GTK_CHECK_VERSION(3,0,0)
+ GtkSalFrame* m_pParent;
cairo_region_t* m_pRegion;
#else
GdkRegion* m_pRegion;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index b5f77c3..7f711ae 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -961,6 +961,7 @@ static void damaged(void *handle,
void GtkSalFrame::InitCommon()
{
m_pSurface = nullptr;
+ m_bSalObjectSetPosSize = false;
m_aDamageHandler.handle = this;
m_aDamageHandler.damaged = ::damaged;
@@ -2888,6 +2889,8 @@ void GtkSalFrame::sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, gpointer
pThis->maGeometry.nHeight = pAllocation->height;
pThis->AllocateFrame();
pThis->CallCallbackExc( SalEvent::Resize, nullptr );
+ if (pThis->m_bSalObjectSetPosSize)
+ return;
pThis->TriggerPaintEvent();
}
@@ -4299,4 +4302,11 @@ long GtkSalFrame::CallCallbackExc(SalEvent nEvent, const void* pEvent) const
return nRet;
}
+void GtkSalFrame::nopaint_container_resize_children(GtkContainer *pContainer)
+{
+ m_bSalObjectSetPosSize = true;
+ gtk_container_resize_children(pContainer);
+ m_bSalObjectSetPosSize = false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index b57c4dc..d86163a 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -30,8 +30,9 @@
#include <unx/gtk/gtkgdi.hxx>
GtkSalObject::GtkSalObject( GtkSalFrame* pParent, bool bShow )
- : m_pSocket( nullptr ),
- m_pRegion( nullptr )
+ : m_pSocket(nullptr)
+ , m_pParent(pParent)
+ , m_pRegion(nullptr)
{
if( pParent )
{
@@ -136,7 +137,7 @@ void GtkSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
GtkFixed* pContainer = GTK_FIXED(gtk_widget_get_parent(m_pSocket));
gtk_fixed_move( pContainer, m_pSocket, nX, nY );
gtk_widget_set_size_request( m_pSocket, nWidth, nHeight );
- gtk_container_resize_children( GTK_CONTAINER(pContainer) );
+ m_pParent->nopaint_container_resize_children(GTK_CONTAINER(pContainer));
}
}
--
2.9.3