[gnome-settings-daemon] fontconfig-monitor: do not recreate configuration every event



commit f1b8257a504dad2bfb4025f409f393d1227a3dab
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Wed Oct 26 12:23:49 2016 -0700

    fontconfig-monitor: do not recreate configuration every event
    
    Currently, the fontconfig monitor will call FcInitReinitialize() for
    every event triggered by the file monitor on the fontconfig
    configuration directories.
    
    For large font files this creates a situation where the configuration is
    reinitialized before the file has been fully copied and available for
    use in fontconfig. The result is that the cache mtime for that directory
    will be updated to use the current modification time, with the new font
    file not registered in the cache yet, preventing the new font to be
    avaialble to applications until the fontconfig cache is forcefully
    recreated.
    
    We can fix this by ignoring CREATED and CHANGED events from the file
    monitor; in both those cases we will receive a CHANGES_DONE_HINT event
    when the file is completely copied in the directory.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773556

 plugins/xsettings/fontconfig-monitor.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/plugins/xsettings/fontconfig-monitor.c b/plugins/xsettings/fontconfig-monitor.c
index 0159351..e3548be 100644
--- a/plugins/xsettings/fontconfig-monitor.c
+++ b/plugins/xsettings/fontconfig-monitor.c
@@ -103,11 +103,18 @@ static void
 stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED,
                GFile *file G_GNUC_UNUSED,
                GFile *other_file G_GNUC_UNUSED,
-               GFileMonitorEvent event_type G_GNUC_UNUSED,
+               GFileMonitorEvent event_type,
                gpointer data)
 {
         fontconfig_monitor_handle_t *handle = data;
 
+        /* Wait for G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT before notifying
+         * fontconfig.
+         */
+        if (event_type == G_FILE_MONITOR_EVENT_CHANGED ||
+            event_type == G_FILE_MONITOR_EVENT_CREATED)
+                return;
+
         gboolean notify = FALSE;
 
         if (fontconfig_cache_update ()) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]