mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
135 lines
5.8 KiB
Diff
135 lines
5.8 KiB
Diff
|
From 29c55564070aa1fa7846448a6ca90fe47c38bd0a Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||
|
Date: Mon, 19 Sep 2016 09:26:22 +0100
|
||
|
Subject: Related: rhbz#1373933 gtk3 emits a lot of style-updateds signals
|
||
|
|
||
|
so don't throw away font settings every time, check if the font settings
|
||
|
changed and only emit FontChanged if they differ from the last seen settings.
|
||
|
|
||
|
Change-Id: I129887e3e866f395da3b906a38cf568abea5de8e
|
||
|
|
||
|
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
|
||
|
index 490cf69..514b13f 100644
|
||
|
--- a/vcl/inc/unx/gtk/gtkinst.hxx
|
||
|
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
|
||
|
@@ -242,6 +242,8 @@ public:
|
||
|
#endif
|
||
|
|
||
|
virtual const cairo_font_options_t* GetCairoFontOptions() override;
|
||
|
+ const cairo_font_options_t* GetLastSeenCairoFontOptions();
|
||
|
+ void ResetLastSeenCairoFontOptions();
|
||
|
|
||
|
void RemoveTimer (SalTimer *pTimer);
|
||
|
|
||
|
@@ -248,6 +248,7 @@ private:
|
||
|
std::vector<GtkSalTimer *> m_aTimers;
|
||
|
bool IsTimerExpired();
|
||
|
bool bNeedsInit;
|
||
|
+ cairo_font_options_t* m_pLastCairoFontOptions;
|
||
|
|
||
|
mutable std::shared_ptr<vcl::unx::GtkPrintWrapper> m_xPrintWrapper;
|
||
|
};
|
||
|
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
|
||
|
index 0f62467..9a535f0 100644
|
||
|
--- a/vcl/unx/gtk/gtkinst.cxx
|
||
|
+++ b/vcl/unx/gtk/gtkinst.cxx
|
||
|
@@ -155,6 +155,7 @@ GtkInstance::GtkInstance( SalYieldMutex* pMutex )
|
||
|
: X11SalInstance( pMutex )
|
||
|
#endif
|
||
|
, bNeedsInit(true)
|
||
|
+ , m_pLastCairoFontOptions(nullptr)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
@@ -200,6 +201,7 @@ GtkInstance::~GtkInstance()
|
||
|
while( !m_aTimers.empty() )
|
||
|
delete *m_aTimers.begin();
|
||
|
DeInitAtkBridge();
|
||
|
+ ResetLastSeenCairoFontOptions();
|
||
|
}
|
||
|
|
||
|
SalFrame* GtkInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle )
|
||
|
@@ -483,7 +485,24 @@ GtkInstance::getPrintWrapper() const
|
||
|
|
||
|
const cairo_font_options_t* GtkInstance::GetCairoFontOptions()
|
||
|
{
|
||
|
- return gdk_screen_get_font_options(gdk_screen_get_default());
|
||
|
+ const cairo_font_options_t* pCairoFontOptions = gdk_screen_get_font_options(gdk_screen_get_default());
|
||
|
+ if (!m_pLastCairoFontOptions && pCairoFontOptions)
|
||
|
+ m_pLastCairoFontOptions = cairo_font_options_copy(pCairoFontOptions);
|
||
|
+ return pCairoFontOptions;
|
||
|
+}
|
||
|
+
|
||
|
+const cairo_font_options_t* GtkInstance::GetLastSeenCairoFontOptions()
|
||
|
+{
|
||
|
+ return m_pLastCairoFontOptions;
|
||
|
+}
|
||
|
+
|
||
|
+void GtkInstance::ResetLastSeenCairoFontOptions()
|
||
|
+{
|
||
|
+ if (m_pLastCairoFontOptions)
|
||
|
+ {
|
||
|
+ cairo_font_options_destroy(m_pLastCairoFontOptions);
|
||
|
+ 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 0d872cf..9167a3f 100644
|
||
|
--- a/vcl/unx/gtk/gtksalframe.cxx
|
||
|
+++ b/vcl/unx/gtk/gtksalframe.cxx
|
||
|
@@ -3235,7 +3235,21 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram
|
||
|
// so post user event to safely dispatch the SalEvent::SettingsChanged
|
||
|
// note: settings changed for multiple frames is avoided in winproc.cxx ImplHandleSettings
|
||
|
GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::SettingsChanged );
|
||
|
- GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged );
|
||
|
+
|
||
|
+ // fire off font-changed when the system cairo font hints change
|
||
|
+ GtkInstance *pInstance = static_cast<GtkInstance*>(GetSalData()->m_pInstance);
|
||
|
+ const cairo_font_options_t* pLastCairoFontOptions = pInstance->GetLastSeenCairoFontOptions();
|
||
|
+ const cairo_font_options_t* pCurrentCairoFontOptions = gdk_screen_get_font_options(gdk_screen_get_default());
|
||
|
+ bool bFontSettingsChanged = true;
|
||
|
+ if (pLastCairoFontOptions && pCurrentCairoFontOptions)
|
||
|
+ bFontSettingsChanged = !cairo_font_options_equal(pLastCairoFontOptions, pCurrentCairoFontOptions);
|
||
|
+ else if (!pLastCairoFontOptions && !pCurrentCairoFontOptions)
|
||
|
+ bFontSettingsChanged = false;
|
||
|
+ if (bFontSettingsChanged)
|
||
|
+ {
|
||
|
+ pInstance->ResetLastSeenCairoFontOptions();
|
||
|
+ GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged );
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
/* #i64117# gtk sets a nice background pixmap
|
||
|
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
|
||
|
index 49bce84..3d3fc9e 100644
|
||
|
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
|
||
|
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
|
||
|
@@ -3107,7 +3107,21 @@ void GtkSalFrame::signalStyleUpdated(GtkWidget*, gpointer frame)
|
||
|
|
||
|
// note: settings changed for multiple frames is avoided in winproc.cxx ImplHandleSettings
|
||
|
GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::SettingsChanged );
|
||
|
- GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged );
|
||
|
+
|
||
|
+ // fire off font-changed when the system cairo font hints change
|
||
|
+ GtkInstance *pInstance = static_cast<GtkInstance*>(GetSalData()->m_pInstance);
|
||
|
+ const cairo_font_options_t* pLastCairoFontOptions = pInstance->GetLastSeenCairoFontOptions();
|
||
|
+ const cairo_font_options_t* pCurrentCairoFontOptions = gdk_screen_get_font_options(gdk_screen_get_default());
|
||
|
+ bool bFontSettingsChanged = true;
|
||
|
+ if (pLastCairoFontOptions && pCurrentCairoFontOptions)
|
||
|
+ bFontSettingsChanged = !cairo_font_options_equal(pLastCairoFontOptions, pCurrentCairoFontOptions);
|
||
|
+ else if (!pLastCairoFontOptions && !pCurrentCairoFontOptions)
|
||
|
+ bFontSettingsChanged = false;
|
||
|
+ if (bFontSettingsChanged)
|
||
|
+ {
|
||
|
+ pInstance->ResetLastSeenCairoFontOptions();
|
||
|
+ GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged );
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
gboolean GtkSalFrame::signalWindowState( GtkWidget*, GdkEvent* pEvent, gpointer frame )
|
||
|
--
|
||
|
cgit v0.10.2
|
||
|
|