summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-06-18 18:01:30 +0100
committerNoel Power <noel.power@suse.com>2013-06-20 09:54:35 +0000
commit60d26eab97ec50a92f19994a3694f3f1d2d61038 (patch)
tree20e883e678780eff2a33fc6701af935ccef2920a /vcl/unx/gtk
parent58c910eda00d1f3751ac1054ef2fcafe4a90abde (diff)
fdo#60565 - re-read font data on GtkSettings fontconfig-timestamp notify.
Change-Id: If1c4d3a7754cc35208e40494828a799f94f26afc Reviewed-on: https://gerrit.libreoffice.org/4347 Reviewed-by: Noel Power <noel.power@suse.com> Tested-by: Noel Power <noel.power@suse.com> Reviewed-on: https://gerrit.libreoffice.org/4376
Diffstat (limited to 'vcl/unx/gtk')
-rwxr-xr-xvcl/unx/gtk/gdi/salnativewidgets-gtk.cxx37
1 files changed, 31 insertions, 6 deletions
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 145585031d74..e4bd038d6007 100755
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -3710,14 +3710,16 @@ void printStyleColors( GtkStyle* pStyle )
}
#endif
-void GtkSalGraphics::updateSettings( AllSettings& rSettings )
+void GtkSalGraphics::signalSettingsNotify( GObject *pSettings, GParamSpec *pSpec, gpointer )
{
- GdkScreen* pScreen = gtk_widget_get_screen( m_pWindow );
- gtk_widget_ensure_style( m_pWindow );
- GtkStyle* pStyle = gtk_widget_get_style( m_pWindow );
- GtkSettings* pSettings = gtk_widget_get_settings( m_pWindow );
- StyleSettings aStyleSet = rSettings.GetStyleSettings();
+ g_return_if_fail( pSpec != NULL );
+ if( !strcmp( pSpec->name, "gtk-fontconfig-timestamp" ) )
+ GtkSalGraphics::refreshFontconfig( GTK_SETTINGS( pSettings ) );
+}
+
+void GtkSalGraphics::refreshFontconfig( GtkSettings *pSettings )
+{
guint latest_fontconfig_timestamp = 0;
static guint our_fontconfig_timestamp = 0;
g_object_get( pSettings, "gtk-fontconfig-timestamp", &latest_fontconfig_timestamp, (char *)NULL );
@@ -3726,9 +3728,32 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
bool bFirstTime = our_fontconfig_timestamp == 0;
our_fontconfig_timestamp = latest_fontconfig_timestamp;
if (!bFirstTime)
+ {
psp::PrintFontManager::get().initialize();
+ }
+ }
+}
+
+void GtkSalGraphics::updateSettings( AllSettings& rSettings )
+{
+ GdkScreen* pScreen = gtk_widget_get_screen( m_pWindow );
+ gtk_widget_ensure_style( m_pWindow );
+ GtkStyle* pStyle = gtk_widget_get_style( m_pWindow );
+ GtkSettings* pSettings = gtk_widget_get_settings( m_pWindow );
+ StyleSettings aStyleSet = rSettings.GetStyleSettings();
+
+ // Listen for font changes
+ if( !g_object_get_data( G_OBJECT( pSettings ), "libo:listening" ) )
+ {
+ g_object_set_data( G_OBJECT( pSettings ), "libo:listening",
+ GUINT_TO_POINTER( 1 ) );
+ g_signal_connect_data( G_OBJECT( pSettings ), "notify",
+ G_CALLBACK( signalSettingsNotify ),
+ NULL, NULL, G_CONNECT_AFTER );
}
+ refreshFontconfig( pSettings );
+
// get the widgets in place
NWEnsureGTKMenu( m_nXScreen );
NWEnsureGTKMenubar( m_nXScreen );