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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jun 7 15:39:00 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 d2f5d382550b177e4eda73b6d39e7fef4ee4f9cd
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/55420
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 62cf55d20ce3..41ba5675df0b 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -237,7 +237,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 f7c41fff0f7d..42bb9e6e2423 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -194,7 +194,7 @@ GtkInstance::~GtkInstance()
 {
     assert( nullptr == m_pTimer );
     DeInitAtkBridge();
-    ResetLastSeenCairoFontOptions();
+    ResetLastSeenCairoFontOptions(nullptr);
 }
 
 SalFrame* GtkInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle )
@@ -484,13 +484,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 3f99b8c30d3d..16e716b16daa 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -3112,7 +3112,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 38cb6b8c087a..f71e8f5ab344 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3256,7 +3256,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