summaryrefslogtreecommitdiff
path: root/pango/pangoxft-fontmap.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-08-09 03:54:26 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-08-09 03:54:26 +0000
commit50d73d06b9fe6c3c1affd79c6bb88712bc83ed3d (patch)
treed6f980715820986eb7ee833aba9e451d81bf2b40 /pango/pangoxft-fontmap.c
parentceb74567faa000289bae9f4110ae7752d762f597 (diff)
downloadpango-50d73d06b9fe6c3c1affd79c6bb88712bc83ed3d.tar.gz
use XAddExtension() magic to automatically clean up our information when
Thu Aug 8 23:14:27 2002 Owen Taylor <otaylor@redhat.com> * pango/pangox-fontmap.c pango/pangoxft-fontmap.c: use XAddExtension() magic to automatically clean up our information when XCloseDisplay() is called. * NEWS: Some updates for 1.1.x features. * README: Update a bit. * configure.in: Print Xft for the Xft backend, not Xft2 when printing summary.
Diffstat (limited to 'pango/pangoxft-fontmap.c')
-rw-r--r--pango/pangoxft-fontmap.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c
index 84249f0e..5fe720f0 100644
--- a/pango/pangoxft-fontmap.c
+++ b/pango/pangoxft-fontmap.c
@@ -26,6 +26,9 @@
#include "pangoxft-private.h"
#include "modules.h"
+/* For XExtSetCloseDisplay */
+#include <X11/Xlibint.h>
+
/* Number of freed fonts */
#define MAX_FREED_FONTS 128
@@ -260,6 +263,50 @@ pango_xft_find_font_map (Display *display,
return NULL;
}
+/*
+ * Hackery to set up notification when a Display is closed
+ */
+static GSList *registered_displays;
+
+static int
+close_display_cb (Display *display,
+ XExtCodes *extcodes)
+{
+ GSList *tmp_list;
+
+ tmp_list = fontmaps;
+ while (tmp_list)
+ {
+ PangoXftFontMap *xfontmap = tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ if (xfontmap->display == display)
+ pango_xft_shutdown_display (display, xfontmap->screen);
+ }
+
+ registered_displays = g_slist_remove (registered_displays, display);
+
+ return 0;
+}
+
+static void
+register_display (Display *display)
+{
+ XExtCodes *extcodes;
+ GSList *tmp_list;
+
+ for (tmp_list = registered_displays; tmp_list; tmp_list = tmp_list->next)
+ {
+ if (tmp_list->data == display)
+ return;
+ }
+
+ registered_displays = g_slist_prepend (registered_displays, display);
+
+ extcodes = XAddExtension (display);
+ XESetCloseDisplay (display, extcodes->extension, close_display_cb);
+}
+
/**
* pango_xft_get_font_map:
* @display: an X display
@@ -313,6 +360,8 @@ pango_xft_get_font_map (Display *display,
(GDestroyNotify)pango_coverage_unref);
xfontmap->freed_fonts = g_queue_new ();
+ register_display (display);
+
fontmaps = g_slist_prepend (fontmaps, xfontmap);
return PANGO_FONT_MAP (xfontmap);