[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/inc vcl/unx

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jun 14 14:26:38 UTC 2018


 vcl/inc/unx/gtk/gtkinst.hxx   |    2 +-
 vcl/unx/gtk/gtkinst.cxx       |    9 +++++----
 vcl/unx/gtk/gtksalframe.cxx   |    2 +-
 vcl/unx/gtk3/gtk3gtkframe.cxx |    2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 5cdda2c5d62829e8bf5ebb6aa58f482182038342
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Jun 2 23:57:04 2018 -0400

    vcl: refresh font cache only on real change
    
    GTK3 emits way too many style-updated, which triggers font cache updates. The
    avoidance of unecessary font cache updates was first implemented in 29c55564.
    Unfortuantely, it seems that the current font-options was never set as
    last-seen font-options, so still to many fonts-changed were emitted
    
    Change-Id: I01a47d4d7fb033e335b1a49ffa6e1bb98f7fd28d
    Reviewed-on: https://gerrit.libreoffice.org/55423
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 8ab1ba98a1e3..2e0175765321 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -231,7 +231,7 @@ public:
 
     virtual const cairo_font_options_t* GetCairoFontOptions() override;
             const cairo_font_options_t* GetLastSeenCairoFontOptions();
-                                   void ResetLastSeenCairoFontOptions();
+                                   void ResetLastSeenCairoFontOptions(const cairo_font_options_t* pOptions);
 
     void                        RemoveTimer ();
 
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index ee03a340a12f..83c2525a335b 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -199,7 +199,7 @@ GtkInstance::~GtkInstance()
 {
     assert( nullptr == m_pTimer );
     DeInitAtkBridge();
-    ResetLastSeenCairoFontOptions();
+    ResetLastSeenCairoFontOptions(nullptr);
 }
 
 SalFrame* GtkInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle )
@@ -489,13 +489,14 @@ const cairo_font_options_t* GtkInstance::GetLastSeenCairoFontOptions()
     return m_pLastCairoFontOptions;
 }
 
-void GtkInstance::ResetLastSeenCairoFontOptions()
+void GtkInstance::ResetLastSeenCairoFontOptions(const cairo_font_options_t* pCairoFontOptions)
 {
     if (m_pLastCairoFontOptions)
-    {
         cairo_font_options_destroy(m_pLastCairoFontOptions);
+    if (pCairoFontOptions)
+        m_pLastCairoFontOptions = cairo_font_options_copy(pCairoFontOptions);
+    else
         m_pLastCairoFontOptions = nullptr;
-    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index d57ec7162d69..235c29e6e4b8 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -3203,7 +3203,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram
             bFontSettingsChanged = false;
         if (bFontSettingsChanged)
         {
-            pInstance->ResetLastSeenCairoFontOptions();
+            pInstance->ResetLastSeenCairoFontOptions(pCurrentCairoFontOptions);
             GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged );
         }
     }
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 40e1d1412d6a..2e4f447f69b5 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3251,7 +3251,7 @@ void GtkSalFrame::signalStyleUpdated(GtkWidget*, gpointer frame)
         bFontSettingsChanged = false;
     if (bFontSettingsChanged)
     {
-        pInstance->ResetLastSeenCairoFontOptions();
+        pInstance->ResetLastSeenCairoFontOptions(pCurrentCairoFontOptions);
         GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged );
     }
 }


More information about the Libreoffice-commits mailing list