diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-08-02 17:50:09 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-08-02 17:50:09 +0000 |
commit | 88c1c94651750789dcad613ee8b09024df142ba2 (patch) | |
tree | c7ee5d339304d0b75d98d79a0b9bfd25918ed25a /gdk/x11 | |
parent | c466752212dc8aed884aa00877c5d32ecb081f12 (diff) | |
download | gtk+-88c1c94651750789dcad613ee8b09024df142ba2.tar.gz |
Requires glib-2.3.0, pango-1.2.0.
Sat Aug 2 12:53:16 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Requires glib-2.3.0, pango-1.2.0.
* configure.in: Require Xft version 2,
remove code for handling older versions of pango and Xft.
Many miscellaneous improvements to X checks
* acinclude.m4: Add GTK_ADD_LIB() macro for adding
a library to a variable, avoiding dups.
* gdk/x11/gdkfont-x11.c (gdk_font_from_description_for_display):
Always load "fixed"
* gdk/x11/gdk*-x11.[ch]: Remove support for Xft1 and
for pangox.
Diffstat (limited to 'gdk/x11')
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 1 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.h | 2 | ||||
-rw-r--r-- | gdk/x11/gdkdrawable-x11.c | 123 | ||||
-rw-r--r-- | gdk/x11/gdkdrawable-x11.h | 7 | ||||
-rw-r--r-- | gdk/x11/gdkfont-x11.c | 36 | ||||
-rw-r--r-- | gdk/x11/gdkgc-x11.c | 5 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkpango-x11.c | 33 | ||||
-rw-r--r-- | gdk/x11/gdkpixmap-x11.c | 15 | ||||
-rw-r--r-- | gdk/x11/gdkprivate-x11.h | 6 | ||||
-rw-r--r-- | gdk/x11/gdkscreen-x11.c | 5 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 18 |
12 files changed, 19 insertions, 234 deletions
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 9227e943d3..dea04722d0 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -153,7 +153,6 @@ gdk_display_open (const gchar *display_name) display = g_object_new (GDK_TYPE_DISPLAY_X11, NULL); display_x11 = GDK_DISPLAY_X11 (display); - display_x11->use_xft = -1; display_x11->use_xshm = TRUE; display_x11->xdisplay = xdisplay; diff --git a/gdk/x11/gdkdisplay-x11.h b/gdk/x11/gdkdisplay-x11.h index d8e37cc2ec..a455303f89 100644 --- a/gdk/x11/gdkdisplay-x11.h +++ b/gdk/x11/gdkdisplay-x11.h @@ -135,8 +135,6 @@ struct _GdkDisplayX11 gchar *input_gxid_host; gint input_gxid_port; - gint use_xft; - /* Startup notification */ gchar *startup_notification_id; diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index 306504c2b3..8444f0eead 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -27,12 +27,9 @@ #include "gdkx.h" #include "gdkregion-generic.h" -#include <pango/pangox.h> #include <config.h> -#if HAVE_XFT #include <pango/pangoxft.h> -#endif #include <stdlib.h> #include <string.h> /* for memcpy() */ @@ -122,7 +119,6 @@ static void gdk_x11_draw_image (GdkDrawable *drawable, gint ydest, gint width, gint height); -#ifdef HAVE_XFT static void gdk_x11_draw_pixbuf (GdkDrawable *drawable, GdkGC *gc, GdkPixbuf *pixbuf, @@ -135,7 +131,6 @@ static void gdk_x11_draw_pixbuf (GdkDrawable *drawable, GdkRgbDither dither, gint x_dither, gint y_dither); -#endif /* HAVE_XFT */ static void gdk_x11_set_colormap (GdkDrawable *drawable, GdkColormap *colormap); @@ -201,9 +196,7 @@ gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass) drawable_class->draw_lines = gdk_x11_draw_lines; drawable_class->draw_glyphs = gdk_x11_draw_glyphs; drawable_class->draw_image = gdk_x11_draw_image; -#ifdef HAVE_XFT drawable_class->draw_pixbuf = gdk_x11_draw_pixbuf; -#endif /* HAVE_XFT */ drawable_class->set_colormap = gdk_x11_set_colormap; drawable_class->get_colormap = gdk_x11_get_colormap; @@ -223,7 +216,6 @@ gdk_drawable_impl_x11_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } -#ifdef HAVE_XFT static void try_pixmap (Display *xdisplay, int screen, @@ -312,7 +304,6 @@ _gdk_x11_have_render (GdkDisplay *display) return x11display->have_render == GDK_YES; } -#ifdef HAVE_XFT2 static XftDraw * gdk_x11_drawable_get_xft_draw (GdkDrawable *drawable) { @@ -381,81 +372,6 @@ gdk_x11_drawable_update_xft_clip (GdkDrawable *drawable, } } -#else /* !HAVE_XFT2 */ - -static Picture -gdk_x11_drawable_get_picture (GdkDrawable *drawable) -{ - GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable); - - if (!_gdk_x11_have_render (gdk_drawable_get_display (drawable))) - return None; - - if (impl->picture == None) - { - GdkVisual *visual = gdk_drawable_get_visual (drawable); - XRenderPictFormat *format; - - if (!visual) - { - g_warning ("Using Xft rendering requires the drawable argument to\n" - "have a specified colormap. All windows have a colormap,\n" - "however, pixmaps only have colormap by default if they\n" - "were created with a non-NULL window argument. Otherwise\n" - "a colormap must be set on them with gdk_drawable_set_colormap"); - return None; - } - - format = XRenderFindVisualFormat (GDK_SCREEN_XDISPLAY (impl->screen), - gdk_x11_visual_get_xvisual(visual)); - if (format) - impl->picture = XRenderCreatePicture (GDK_SCREEN_XDISPLAY (impl->screen), - impl->xid, format, 0, NULL); - } - - return impl->picture; -} - -static void -gdk_x11_drawable_update_xft_clip (GdkDrawable *drawable, - GdkGC *gc) -{ - GdkGCX11 *gc_private = gc ? GDK_GC_X11 (gc) : NULL; - GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable); - Picture picture = gdk_x11_drawable_get_picture (drawable); - - if (gc && gc_private->clip_region) - { - GdkRegionBox *boxes = gc_private->clip_region->rects; - gint n_boxes = gc_private->clip_region->numRects; - XRectangle *rects = g_new (XRectangle, n_boxes); - int i; - - for (i=0; i < n_boxes; i++) - { - rects[i].x = CLAMP (boxes[i].x1 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT); - rects[i].y = CLAMP (boxes[i].y1 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT); - rects[i].width = CLAMP (boxes[i].x2 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT) - rects[i].x; - rects[i].height = CLAMP (boxes[i].y2 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT) - rects[i].y; - } - - XRenderSetPictureClipRectangles (GDK_SCREEN_XDISPLAY (impl->screen), - picture, 0, 0, rects, n_boxes); - - g_free (rects); - } - else - { - XRenderPictureAttributes pa; - pa.clip_mask = None; - XRenderChangePicture (GDK_SCREEN_XDISPLAY (impl->screen), - picture, CPClipMask, &pa); - } -} -#endif /* HAVE_XFT2 */ - -#endif /* HAVE_XFT */ - /***************************************************** * X11 specific implementations of generic functions * *****************************************************/ @@ -847,42 +763,19 @@ gdk_x11_draw_glyphs (GdkDrawable *drawable, PangoGlyphString *glyphs) { GdkDrawableImplX11 *impl; + XftColor color; + XftDraw *draw; impl = GDK_DRAWABLE_IMPL_X11 (drawable); -#if HAVE_XFT - if (PANGO_XFT_IS_FONT (font)) - { -#ifdef HAVE_XFT2 - XftColor color; - XftDraw *draw; + g_return_if_fail (PANGO_XFT_IS_FONT (font)); - _gdk_gc_x11_get_fg_xft_color (gc, &color); - - gdk_x11_drawable_update_xft_clip (drawable, gc); - draw = gdk_x11_drawable_get_xft_draw (drawable); - - pango_xft_render (draw, &color, font, glyphs, x, y); -#else /* !HAVE_XFT2 */ - Picture src_picture; - Picture dest_picture; - - src_picture = _gdk_x11_gc_get_fg_picture (gc); + _gdk_gc_x11_get_fg_xft_color (gc, &color); - gdk_x11_drawable_update_xft_clip (drawable, gc); - dest_picture = gdk_x11_drawable_get_picture (drawable); + gdk_x11_drawable_update_xft_clip (drawable, gc); + draw = gdk_x11_drawable_get_xft_draw (drawable); - pango_xft_picture_render (GDK_SCREEN_XDISPLAY (impl->screen), - src_picture, dest_picture, - font, glyphs, x, y); -#endif /* HAVE_XFT2 */ - } - else -#endif /* HAVE_XFT */ - pango_x_render (GDK_SCREEN_XDISPLAY (impl->screen), - impl->xid, - GDK_GC_GET_XGC (gc), - font, glyphs, x, y); + pango_xft_render (draw, &color, font, glyphs, x, y); } static void @@ -999,7 +892,6 @@ gdk_x11_drawable_get_xid (GdkDrawable *drawable) * what's the fastest depending on the available picture formats, * whether we can used shared pixmaps, etc. */ -#ifdef HAVE_XFT typedef enum { FORMAT_NONE, FORMAT_EXACT_MASK, @@ -1524,4 +1416,3 @@ gdk_x11_draw_pixbuf (GdkDrawable *drawable, rowstride, dest_x, dest_y, width, height); } -#endif /* HAVE_XFT */ diff --git a/gdk/x11/gdkdrawable-x11.h b/gdk/x11/gdkdrawable-x11.h index 0d4185b6f1..ea99938b3c 100644 --- a/gdk/x11/gdkdrawable-x11.h +++ b/gdk/x11/gdkdrawable-x11.h @@ -32,10 +32,7 @@ #include <gdk/gdkdrawable.h> #include <X11/Xlib.h> - -#ifdef HAVE_XFT #include <X11/Xft/Xft.h> -#endif #ifdef __cplusplus extern "C" { @@ -65,11 +62,7 @@ struct _GdkDrawableImplX11 Window xid; GdkScreen *screen; -#ifdef HAVE_XFT2 XftDraw *xft_draw; -#elif defined (HAVE_XFT) - Picture picture; -#endif }; struct _GdkDrawableImplX11Class diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c index 37bb517d72..5c65b145b7 100644 --- a/gdk/x11/gdkfont-x11.c +++ b/gdk/x11/gdkfont-x11.c @@ -30,8 +30,6 @@ #include <X11/Xos.h> #include <locale.h> -#include <pango/pangox.h> - #include "gdkx.h" #include "gdkfont.h" #include "gdkprivate-x11.h" @@ -285,42 +283,12 @@ GdkFont * gdk_font_from_description_for_display (GdkDisplay *display, PangoFontDescription *font_desc) { - PangoFontMap *font_map; - PangoFont *font; - GdkFont *result = NULL; + GdkFont *result; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (font_desc != NULL, NULL); - font_map = pango_x_font_map_for_display (GDK_DISPLAY_XDISPLAY (display)); - font = pango_font_map_load_font (font_map, NULL, font_desc); - - if (font) - { - gchar *charset = gdk_font_charset_for_locale (); - gint n_subfonts; - PangoXSubfont *subfont_ids; - gint *subfont_charsets; - - n_subfonts = pango_x_list_subfonts (font, &charset, 1, - &subfont_ids, &subfont_charsets); - if (n_subfonts > 0) - { - gchar *xlfd = pango_x_font_subfont_xlfd (font, subfont_ids[0]); - result = gdk_font_load_for_display (display, xlfd); - - g_free (xlfd); - } - - g_free (subfont_ids); - - g_free (subfont_charsets); - - g_free (charset); - g_object_unref (font); - } - - return result; + return gdk_font_load_for_display (display, "fixed"); } /** diff --git a/gdk/x11/gdkgc-x11.c b/gdk/x11/gdkgc-x11.c index 9874c7ea83..52d460b5c3 100644 --- a/gdk/x11/gdkgc-x11.c +++ b/gdk/x11/gdkgc-x11.c @@ -109,10 +109,8 @@ gdk_gc_x11_finalize (GObject *object) if (x11_gc->clip_region) gdk_region_destroy (x11_gc->clip_region); -#if HAVE_XFT if (x11_gc->fg_picture != None) XRenderFreePicture (GDK_GC_XDISPLAY (x11_gc), x11_gc->fg_picture); -#endif XFreeGC (GDK_GC_XDISPLAY (x11_gc), GDK_GC_XGC (x11_gc)); @@ -816,7 +814,6 @@ gdk_x11_gc_get_xgc (GdkGC *gc) return gc_x11->xgc; } -#ifdef HAVE_XFT /* Various bits of the below are roughly cribbed from XFree86 * lib/Xft/xftdraw.c, Copyright 2000, Keith Packard */ @@ -942,5 +939,3 @@ _gdk_gc_x11_get_fg_xft_color (GdkGC *gc, xftcolor->color.blue = color.blue; xftcolor->color.alpha = 0xffff; } - -#endif /* HAVE_XFT */ diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 3c5f7de8af..3f8462f0a4 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -49,8 +49,6 @@ #include "gdkregion-generic.h" #include "gdkinputprivate.h" -#include <pango/pangox.h> - typedef struct _GdkPredicate GdkPredicate; typedef struct _GdkErrorTrap GdkErrorTrap; diff --git a/gdk/x11/gdkpango-x11.c b/gdk/x11/gdkpango-x11.c index 4645651887..b4bf0cf290 100644 --- a/gdk/x11/gdkpango-x11.c +++ b/gdk/x11/gdkpango-x11.c @@ -23,10 +23,7 @@ #include "gdkx.h" #include "gdkdisplay-x11.h" #include "gdkpango.h" -#include <pango/pangox.h> -#ifdef HAVE_XFT #include <pango/pangoxft.h> -#endif /** * gdk_pango_context_get_for_screen: @@ -48,40 +45,14 @@ PangoContext * gdk_pango_context_get_for_screen (GdkScreen *screen) { PangoContext *context; - GdkDisplayX11 *display_x11; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); if (screen->closed) return NULL; - display_x11 = GDK_DISPLAY_X11 (GDK_SCREEN_DISPLAY (screen)); - -#ifdef HAVE_XFT - if (display_x11->use_xft == -1) - { - const char *val = g_getenv ("GDK_USE_XFT"); - - /* Version 2 of Xft supports rendering FreeType fonts via - * the core X protocol, so we default to it everywhere. - * - * For Xft1, we only enable Xft if the user explicitely - * specifies it, and we have the RENDER extension - */ -# ifdef HAVE_XFT2 - display_x11->use_xft = !val || (atoi (val) != 0); -# else - display_x11->use_xft = val && (atoi (val) != 0) && - _gdk_x11_have_render (GDK_SCREEN_DISPLAY (screen)); -# endif /* HAVE_XFT2 */ - } - - if (display_x11->use_xft) - context = pango_xft_get_context (GDK_SCREEN_XDISPLAY (screen), - GDK_SCREEN_X11 (screen)->screen_num); - else -#endif /* HAVE_XFT */ - context = pango_x_get_context (GDK_SCREEN_XDISPLAY (screen)); + context = pango_xft_get_context (GDK_SCREEN_XDISPLAY (screen), + GDK_SCREEN_X11 (screen)->screen_num); g_object_set_data (G_OBJECT (context), "gdk-pango-screen", screen); diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c index 06d19cd8a9..f28ad72af5 100644 --- a/gdk/x11/gdkpixmap-x11.c +++ b/gdk/x11/gdkpixmap-x11.c @@ -129,19 +129,10 @@ gdk_pixmap_impl_x11_finalize (GObject *object) if (!display->closed) { -#ifdef HAVE_XFT - { - GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (impl); + GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (impl); -#ifdef HAVE_XFT2 - if (draw_impl->xft_draw) - XftDrawDestroy (draw_impl->xft_draw); -#else /* !HAVE_XFT2 */ - if (draw_impl->picture) - XRenderFreePicture (GDK_DISPLAY_XDISPLAY (display), draw_impl->picture); -#endif /* HAVE_XFT2 */ - } -#endif /* HAVE_XFT */ + if (draw_impl->xft_draw) + XftDrawDestroy (draw_impl->xft_draw); if (!impl->is_foreign) XFreePixmap (GDK_DISPLAY_XDISPLAY (display), GDK_PIXMAP_XID (wrapper)); diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 93d226a71f..5ffe3982ef 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -41,9 +41,7 @@ #include <config.h> -#if HAVE_XFT #include <X11/extensions/Xrender.h> -#endif #define GDK_TYPE_GC_X11 (_gdk_gc_x11_get_type ()) #define GDK_GC_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_X11, GdkGCX11)) @@ -67,10 +65,8 @@ struct _GdkGCX11 guint16 dirty_mask; guint have_clip_mask : 1; -#ifdef HAVE_XFT Picture fg_picture; XRenderColor fg_picture_color; -#endif gulong fg_pixel; }; @@ -106,12 +102,10 @@ gint _gdk_send_xevent (GdkDisplay *display, GType _gdk_gc_x11_get_type (void); -#ifdef HAVE_XFT gboolean _gdk_x11_have_render (GdkDisplay *display); Picture _gdk_x11_gc_get_fg_picture (GdkGC *gc); void _gdk_gc_x11_get_fg_xft_color (GdkGC *gc, XftColor *xftcolor); -#endif /* HAVE_XFT */ GdkGC *_gdk_x11_gc_new (GdkDrawable *drawable, GdkGCValues *values, diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 21d66f25d5..16c650cade 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -32,11 +32,6 @@ #include "gdkdisplay-x11.h" #include "gdkx.h" -#ifdef HAVE_XFT -#include <pango/pangoxft.h> -#endif -#include <pango/pangox.h> - #ifdef HAVE_SOLARIS_XINERAMA #include <X11/extensions/xinerama.h> #endif diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 7b99ee9bf2..bf098e1e15 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -890,6 +890,7 @@ _gdk_windowing_window_destroy (GdkWindow *window, { GdkWindowObject *private = (GdkWindowObject *)window; GdkToplevelX11 *toplevel; + GdkDrawableImplX11 *draw_impl; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -902,19 +903,10 @@ _gdk_windowing_window_destroy (GdkWindow *window, if (toplevel) gdk_toplevel_x11_free_contents (toplevel); -#ifdef HAVE_XFT - { - GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl); - -#ifdef HAVE_XFT2 - if (draw_impl->xft_draw) - XftDrawDestroy (draw_impl->xft_draw); -#else /* !HAVE_XFT2 */ - if (draw_impl->picture) - XRenderFreePicture (GDK_DRAWABLE_XDISPLAY (window), draw_impl->picture); -#endif /* HAVE_XFT2 */ - } -#endif /* HAVE_XFT */ + draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl); + + if (draw_impl->xft_draw) + XftDrawDestroy (draw_impl->xft_draw); if (private->window_type == GDK_WINDOW_FOREIGN) { |