summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-06-02 23:57:04 -0400
committerAndras Timar <andras.timar@collabora.com>2018-06-27 06:40:28 +0200
commite3305ad790274e312821e90c1f61a1efe92fd8f9 (patch)
tree917c7a0e3be58cc3648c9a6bdbd74d2036ac07e2 /vcl
parent12a9b5866815a75c8684433d82c460d79050c29d (diff)
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@redhat.com> (cherry picked from commit 5cdda2c5d62829e8bf5ebb6aa58f482182038342)
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/gtk/gtkinst.hxx2
-rw-r--r--vcl/unx/gtk/gtkinst.cxx9
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx2
4 files changed, 8 insertions, 7 deletions
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 );
}
}