vte r2367 - in trunk: . src



Author: behdad
Date: Sun Feb  1 06:18:43 2009
New Revision: 2367
URL: http://svn.gnome.org/viewvc/vte?rev=2367&view=rev

Log:
2009-02-01  Behdad Esfahbod  <behdad gnome org>

        * configure.in: Require GTK+ >= 2.14, for "gtk-fontconfig-timestamp" 
        settings property.

        * src/vte.c (vte_terminal_style_set),
        (vte_terminal_set_font_full_internal), (vte_terminal_init),
        (vte_terminal_class_init):  Use style_set class method instead of
        hooking to style-set signal.  Also, proceed to recreating the font
        even if neither description nor antialias setting changed.  This is 
        necessary to pick up fontconfig configuration changes as well as font
        install/uninstallations or GNOME font preferences changes.

        * src/vtepangocairo.c (font_info_destroy),
        (fontconfig_timestamp_quark),
        (vte_pango_cairo_set_fontconfig_timestamp),
        (vte_pango_cairo_get_fontconfig_timestamp), (context_hash),
        (context_equal), (font_info_create_for_context),
        (font_info_create_for_screen):
        Use fontconfig_timestamp in the font object hash, such that we respond
        to fontconfig configuration changes.



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/vte.c
   trunk/src/vteapp.c
   trunk/src/vtepangocairo.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sun Feb  1 06:18:43 2009
@@ -251,7 +251,7 @@
 
 GLIB_REQUIRED=2.18.0
 PANGO_REQUIRED=1.22.0
-GTK_REQUIRED=2.12.0
+GTK_REQUIRED=2.14.0
 AC_DEFINE(GDK_MULTIHEAD_SAFE,1,[Force use of GDK's multihead-safe APIs.])
 PKG_CHECK_MODULES(GLIB,[glib-2.0 > $GLIB_REQUIRED])
 PKG_CHECK_MODULES(GOBJECT,[glib-2.0 gobject-2.0])

Modified: trunk/src/vte.c
==============================================================================
--- trunk/src/vte.c	(original)
+++ trunk/src/vte.c	Sun Feb  1 06:18:43 2009
@@ -4685,9 +4685,9 @@
 	}
 }
 
-/* Handle a style-changed signal. */
 static void
-vte_terminal_style_changed(GtkWidget *widget, GtkStyle *style, gpointer data)
+vte_terminal_style_set (GtkWidget      *widget,
+			GtkStyle       *prev_style)
 {
 	VteTerminal *terminal;
 	if (!GTK_WIDGET_REALIZED(widget)) {
@@ -7512,7 +7512,7 @@
         VteTerminalPrivate *pvt;
         GObject *object;
 	PangoFontDescription *desc;
-        gboolean same_antialias, same_desc;
+        gboolean same_desc;
 
 	g_return_if_fail(VTE_IS_TERMINAL(terminal));
 
@@ -7538,13 +7538,13 @@
 				"Using default monospace font.\n");
 	}
 
-	/* check for any change */
-        same_antialias = antialias == pvt->fontantialias;
         same_desc = pvt->fontdesc && pango_font_description_equal (pvt->fontdesc, desc);
-	if (same_antialias && same_desc) {
-		pango_font_description_free(desc);
-		return;
-	}
+	
+	/* Note that we proceed to recreating the font even if the description
+	 * and antialias settings are the same.  This is because maybe screen
+	 * font options were changed, or new fonts installed.  Those will be
+	 * detected at font creation time and respected.
+	 */
 
         g_object_freeze_notify(object);
 
@@ -8149,11 +8149,6 @@
 			 G_CALLBACK(vte_terminal_hierarchy_changed),
 			 NULL);
 
-	/* Listen for style changes. */
-	g_signal_connect(terminal, "style-set",
-			 G_CALLBACK(vte_terminal_style_changed),
-			 NULL);
-
 #ifdef VTE_DEBUG
 	/* In debuggable mode, we always do this. */
 	/* gtk_widget_get_accessible(&terminal->widget); */
@@ -11329,6 +11324,7 @@
 	widget_class->visibility_notify_event = vte_terminal_visibility_notify;
 	widget_class->unrealize = vte_terminal_unrealize;
 	widget_class->style_set = NULL;
+	widget_class->style_set = vte_terminal_style_set;
 	widget_class->size_request = vte_terminal_size_request;
 	widget_class->size_allocate = vte_terminal_size_allocate;
 	widget_class->get_accessible = vte_terminal_get_accessible;

Modified: trunk/src/vteapp.c
==============================================================================
--- trunk/src/vteapp.c	(original)
+++ trunk/src/vteapp.c	Sun Feb  1 06:18:43 2009
@@ -438,7 +438,7 @@
 child_exit_cb(VteTerminal *terminal,
                  gpointer user_data)
 {
-  g_print("Child exited with status %x\n", vte_terminal_get_child_exit_status(terminal));
+  _vte_debug_print(VTE_DEBUG_MISC, "Child exited with status %x\n", vte_terminal_get_child_exit_status(terminal));
 }
 
 int

Modified: trunk/src/vtepangocairo.c
==============================================================================
--- trunk/src/vtepangocairo.c	(original)
+++ trunk/src/vtepangocairo.c	Sun Feb  1 06:18:43 2009
@@ -541,10 +541,6 @@
 	if (info->ref_count)
 		return;
 
-#if !GTK_CHECK_VERSION (2, 14, 0)
-#define gdk_threads_add_timeout_seconds(sec, func, data) gdk_threads_add_timeout ((sec) * 1000, (func), (data))
-#endif
-
 	/* Delay destruction by a few seconds, in case we need it again */
 	ensure_quit_handler ();
 	info->destroy_timeout = gdk_threads_add_timeout_seconds (FONT_CACHE_TIMEOUT,
@@ -552,13 +548,41 @@
 								 info);
 }
 
+static GQuark
+fontconfig_timestamp_quark (void)
+{
+	static GQuark quark;
+
+	if (G_UNLIKELY (!quark))
+		quark = g_quark_from_static_string ("vte-fontconfig-timestamp");
+
+	return quark;
+}
+
+static void
+vte_pango_cairo_set_fontconfig_timestamp (PangoContext *context,
+					  guint         fontconfig_timestamp)
+{
+	g_object_set_qdata ((GObject *) context,
+			    fontconfig_timestamp_quark (),
+			    GUINT_TO_POINTER (fontconfig_timestamp));
+}
+
+static guint
+vte_pango_cairo_get_fontconfig_timestamp (PangoContext *context)
+{
+	return GPOINTER_TO_UINT (g_object_get_qdata ((GObject *) context,
+						     fontconfig_timestamp_quark ()));
+}
+
 static guint
 context_hash (PangoContext *context)
 {
 	return pango_units_from_double (pango_cairo_context_get_resolution (context))
 	     ^ pango_font_description_hash (pango_context_get_font_description (context))
 	     ^ cairo_font_options_hash (pango_cairo_context_get_font_options (context))
-	     ^ GPOINTER_TO_UINT (pango_context_get_language (context));
+	     ^ GPOINTER_TO_UINT (pango_context_get_language (context))
+	     ^ vte_pango_cairo_get_fontconfig_timestamp (context);
 }
 
 static gboolean
@@ -568,7 +592,8 @@
 	return pango_cairo_context_get_resolution (a) == pango_cairo_context_get_resolution (b)
 	    && pango_font_description_equal (pango_context_get_font_description (a), pango_context_get_font_description (b))
 	    && cairo_font_options_equal (pango_cairo_context_get_font_options (a), pango_cairo_context_get_font_options (b))
-	    && pango_context_get_language (a) == pango_context_get_language (b);
+	    && pango_context_get_language (a) == pango_context_get_language (b)
+	    && vte_pango_cairo_get_fontconfig_timestamp (a) == vte_pango_cairo_get_fontconfig_timestamp (b);
 }
 
 static struct font_info *
@@ -601,7 +626,8 @@
 font_info_create_for_context (PangoContext               *context,
 			      const PangoFontDescription *desc,
 			      VteTerminalAntiAlias        antialias,
-			      PangoLanguage              *language)
+			      PangoLanguage              *language,
+			      guint                       fontconfig_timestamp)
 {
 	if (!PANGO_IS_CAIRO_FONT_MAP (pango_context_get_font_map (context))) {
 		/* Ouch, Gtk+ switched over to some drawing system?
@@ -611,6 +637,8 @@
 		context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
 	}
 
+	vte_pango_cairo_set_fontconfig_timestamp (context, fontconfig_timestamp);
+
 	pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
 
 	if (desc)
@@ -659,8 +687,11 @@
 			     VteTerminalAntiAlias        antialias,
 			     PangoLanguage              *language)
 {
+	GtkSettings *settings = gtk_settings_get_for_screen (screen);
+	int fontconfig_timestamp;
+	g_object_get (settings, "gtk-fontconfig-timestamp", &fontconfig_timestamp, NULL);
 	return font_info_create_for_context (gdk_pango_context_get_for_screen (screen),
-					     desc, antialias, language);
+					     desc, antialias, language, fontconfig_timestamp);
 }
 
 static struct font_info *



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