diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-08-09 03:54:26 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-08-09 03:54:26 +0000 |
commit | 50d73d06b9fe6c3c1affd79c6bb88712bc83ed3d (patch) | |
tree | d6f980715820986eb7ee833aba9e451d81bf2b40 /pango/pangox-fontmap.c | |
parent | ceb74567faa000289bae9f4110ae7752d762f597 (diff) | |
download | pango-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/pangox-fontmap.c')
-rw-r--r-- | pango/pangox-fontmap.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index 52db3e77..9ff8ee93 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -27,6 +27,9 @@ #include <X11/Xatom.h> +/* For XExtSetCloseDisplay */ +#include <X11/Xlibint.h> + #include "pango-fontmap.h" #include "pango-utils.h" #include "pangox-private.h" @@ -215,6 +218,39 @@ pango_x_font_map_class_init (PangoFontMapClass *class) class->list_families = pango_x_font_map_list_families; } +/* + * Hackery to set up notification when a Display is closed + */ +static GSList *registered_displays; + +static int +close_display_cb (Display *display, + XExtCodes *extcodes) +{ + pango_x_shutdown_display (display); + 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); +} + static GList *fontmaps = NULL; /** @@ -285,6 +321,8 @@ pango_x_font_map_for_display (Display *display) xfontmap->resolution = (PANGO_SCALE * 72.27 / 25.4) * ((double) DisplayWidthMM (xfontmap->display, screen) / DisplayWidth (xfontmap->display, screen)); + register_display (xfontmap->display); + return PANGO_FONT_MAP (xfontmap); } |