gtk+ r20324 - in trunk: . gdk/x11 gtk
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r20324 - in trunk: . gdk/x11 gtk
- Date: Fri, 6 Jun 2008 16:39:38 +0000 (UTC)
Author: behdad
Date: Fri Jun 6 16:39:37 2008
New Revision: 20324
URL: http://svn.gnome.org/viewvc/gtk+?rev=20324&view=rev
Log:
2008-06-06 Behdad Esfahbod <behdad gnome org>
Bug 536185 â monitor font configuration
* configure.in:
* gdk/x11/gdksettings.c:
* gtk/gtksettings.c (gtk_settings_class_init),
(gtk_settings_notify), (settings_update_fontconfig):
Monitor xsettings key Fontconfig/Timestamp and upon change,
reread fontconfig configuration, clear Pango's caches, and
redraw all widgets.
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/gdk/x11/gdksettings.c
trunk/gtk/gtksettings.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Fri Jun 6 16:39:37 2008
@@ -1677,6 +1677,9 @@
fi
GTK_PACKAGES="atk cairo gio-2.0"
+if test "x$gdktarget" = "xx11"; then
+ GTK_PACKAGES="$GTK_PACKAGES pangoft2"
+fi
GTK_EXTRA_LIBS=
GTK_EXTRA_CFLAGS=
GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
Modified: trunk/gdk/x11/gdksettings.c
==============================================================================
--- trunk/gdk/x11/gdksettings.c (original)
+++ trunk/gdk/x11/gdksettings.c Fri Jun 6 16:39:37 2008
@@ -69,7 +69,8 @@
"Gtk/EnableAccels\0" "gtk-enable-accels\0"
"Gtk/EnableMnemonics\0" "gtk-enable-mnemonics\0"
"Gtk/ScrolledWindowPlacement\0" "gtk-scrolled-window-placement\0"
- "Gtk/IMModule\0" "gtk-im-module\0";
+ "Gtk/IMModule\0" "gtk-im-module\0"
+ "Fontconfig/Timestamp\0" "gtk-fontconfig-timestamp\0";
static const struct
@@ -116,5 +117,6 @@
{ 1326, 1343 },
{ 1361, 1381 },
{ 1402, 1430 },
- { 1460, 1473 }
+ { 1460, 1473 },
+ { 1487, 1508 }
};
Modified: trunk/gtk/gtksettings.c
==============================================================================
--- trunk/gtk/gtksettings.c (original)
+++ trunk/gtk/gtksettings.c Fri Jun 6 16:39:37 2008
@@ -16,6 +16,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#define PANGO_ENABLE_BACKEND /* for pango_fc_font_map_cache_clear() */
+
#include <config.h>
#include <string.h>
@@ -30,6 +32,7 @@
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
+#include <pango/pangofc-fontmap.h>
#endif
#define DEFAULT_TIMEOUT_INITIAL 200
@@ -108,7 +111,8 @@
PROP_ENABLE_ACCELS,
PROP_RECENT_FILES_LIMIT,
PROP_IM_MODULE,
- PROP_RECENT_FILES_MAX_AGE
+ PROP_RECENT_FILES_MAX_AGE,
+ PROP_FONTCONFIG_TIMESTAMP
};
@@ -134,6 +138,7 @@
static void settings_update_cursor_theme (GtkSettings *settings);
static void settings_update_resolution (GtkSettings *settings);
static void settings_update_font_options (GtkSettings *settings);
+static gboolean settings_update_fontconfig (GtkSettings *settings);
#endif
static void settings_update_color_scheme (GtkSettings *settings);
@@ -841,6 +846,17 @@
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_RECENT_FILES_MAX_AGE);
+
+ result = settings_install_property_parser (class,
+ g_param_spec_int ("gtk-fontconfig-timestamp",
+ P_("Fontconfig configuration timestamp"),
+ P_("Timestamp of current fontconfig configuration"),
+ G_MININT, G_MAXINT, 0,
+ GTK_PARAM_READWRITE),
+ NULL);
+
+ g_assert (result == PROP_FONTCONFIG_TIMESTAMP);
+
}
static void
@@ -1054,6 +1070,10 @@
settings_update_font_options (settings);
gtk_rc_reset_styles (GTK_SETTINGS (object));
break;
+ case PROP_FONTCONFIG_TIMESTAMP:
+ if (settings_update_fontconfig (settings))
+ gtk_rc_reset_styles (GTK_SETTINGS (object));
+ break;
case PROP_CURSOR_THEME_NAME:
case PROP_CURSOR_THEME_SIZE:
settings_update_cursor_theme (settings);
@@ -1951,6 +1971,43 @@
cairo_font_options_destroy (options);
}
+#ifdef GDK_WINDOWING_X11
+static gboolean
+settings_update_fontconfig (GtkSettings *settings)
+{
+ static guint last_update_timestamp;
+ static gboolean last_update_needed;
+
+ gint timestamp;
+
+ g_object_get (settings,
+ "gtk-fontconfig-timestamp", ×tamp,
+ NULL);
+
+ /* if timestamp is the same as last_update_timestamp, we already have
+ * updated fontconig on this timestamp (another screen requested it perhaps?),
+ * just return the cached result.*/
+
+ if (timestamp != last_update_timestamp)
+ {
+ PangoFontMap *fontmap = pango_cairo_font_map_get_default ();
+ gboolean update_needed = FALSE;
+
+ if (PANGO_IS_FC_FONT_MAP (fontmap) &&
+ !FcConfigUptoDate (NULL) && FcInitReinitialize ())
+ {
+ update_needed = TRUE;
+ pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (fontmap));
+ }
+
+ last_update_timestamp = timestamp;
+ last_update_needed = update_needed;
+ }
+
+ return last_update_needed;
+}
+#endif /* GDK_WINDOWING_X11 */
+
static void
settings_update_resolution (GtkSettings *settings)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]