Beispiel #1
0
static void
settings_update_fontmap (ClutterSettings *self,
                         guint            stamp)
{
  if (self->backend == NULL)
    return;

#ifdef HAVE_PANGO_FT2
  CLUTTER_NOTE (BACKEND, "Update fontmaps (stamp: %d)", stamp);

  if (self->last_fontconfig_timestamp != stamp)
    {
      ClutterMainContext *context;
      gboolean update_needed = FALSE;

      context = _clutter_context_get_default ();

      /* If there is no font map yet then we don't need to do anything
       * because the config for fontconfig will be read when it is
       * created */
      if (context->font_map)
        {
          PangoFontMap *fontmap = PANGO_FONT_MAP (context->font_map);

          if (PANGO_IS_FC_FONT_MAP (fontmap) &&
              !FcConfigUptoDate (NULL))
            {
              pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (fontmap));

              if (FcInitReinitialize ())
                update_needed = TRUE;
            }
        }

      self->last_fontconfig_timestamp = stamp;

      if (update_needed)
        g_signal_emit_by_name (self->backend, "font-changed");
    }
#endif /* HAVE_PANGO_FT2 */
}
Beispiel #2
0
static gboolean
xfce_xsettings_helper_fc_notify (gpointer data)
{
    XfceXSettingsHelper *helper = XFCE_XSETTINGS_HELPER (data);
    XfceXSetting        *setting;

    helper->fc_notify_timeout_id = 0;

    /* check if the font config setup changed */
    if (!FcConfigUptoDate (NULL) && FcInitReinitialize ())
    {
        /* stop the monitors */
        xfce_xsettings_helper_fc_free (helper);

        setting = g_hash_table_lookup (helper->settings, FC_PROPERTY);
        if (setting == NULL)
        {
            /* create new setting */
            setting = g_slice_new0 (XfceXSetting);
            setting->value = g_new0 (GValue, 1);
            g_value_init (setting->value, G_TYPE_INT);
            g_hash_table_insert (helper->settings, g_strdup (FC_PROPERTY), setting);
        }

        /* update setting */
        setting->last_change_serial = helper->serial;
        g_value_set_int (setting->value, time (NULL));

        xfsettings_dbg (XFSD_DEBUG_FONTCONFIG, "timestamp updated (time=%d)",
                        g_value_get_int (setting->value));

        /* schedule xsettings update */
        if (helper->notify_idle_id == 0)
            helper->notify_idle_id = g_idle_add (xfce_xsettings_helper_notify_idle, helper);

        /* restart monitoring */
        helper->fc_init_id = g_idle_add (xfce_xsettings_helper_fc_init, helper);
    }

    return FALSE;
}
Beispiel #3
0
FcBool
FcInitBringUptoDate (void)
{
    FcConfig	*config = FcConfigGetCurrent ();
    time_t	now;

    /*
     * rescanInterval == 0 disables automatic up to date
     */
    if (config->rescanInterval == 0)
	return FcTrue;
    /*
     * Check no more often than rescanInterval seconds
     */
    now = time (0);
    if (config->rescanTime + config->rescanInterval - now > 0)
	return FcTrue;
    /*
     * If up to date, don't reload configuration
     */
    if (FcConfigUptoDate (0))
	return FcTrue;
    return FcInitReinitialize ();
}
Beispiel #4
0
gboolean
FcCacheUpdate (void) {
    FcConfigDestroy(FcConfigGetCurrent());
    return !FcConfigUptoDate(NULL) && FcInitReinitialize();
}
gboolean
fontconfig_cache_update (void)
{
        return !FcConfigUptoDate (NULL) && FcInitReinitialize ();
}