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

Caolán McNamara caolanm at redhat.com
Wed Feb 1 17:34:47 UTC 2017


 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(-)

New commits:
commit 0861cb6d72f0d718928a1998c8a0e2c690e8b09f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 1 17:24:26 2017 +0000

    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

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index e92932f..a0c86b3 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -348,6 +348,7 @@ public:
     cairo_surface_t*                m_pSurface;
     DamageHandler                   m_aDamageHandler;
     int                             m_nGrabLevel;
+    bool                            m_bSalObjectSetPosSize;
 #endif
     GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
     GtkSalFrame( SystemParentData* pSysData );
@@ -425,6 +426,7 @@ public:
     void addGrabLevel();
     void removeGrabLevel();
 
+    void nopaint_container_resize_children(GtkContainer*);
 #endif
     virtual ~GtkSalFrame() override;
 
diff --git a/vcl/inc/unx/gtk/gtkobject.hxx b/vcl/inc/unx/gtk/gtkobject.hxx
index 12a9ff3..1f30095 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 16bca09..a74555f 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -985,6 +985,7 @@ void GtkSalFrame::InitCommon()
 {
     m_pSurface = nullptr;
     m_nGrabLevel = 0;
+    m_bSalObjectSetPosSize = false;
 
     m_aDamageHandler.handle = this;
     m_aDamageHandler.damaged = ::damaged;
@@ -2895,6 +2896,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();
 }
 
@@ -4298,4 +4301,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 039a4ba..4a8d0fd 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));
     }
 }
 


More information about the Libreoffice-commits mailing list