+Fri Aug 2 00:43:15 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkdrawable-x11.[ch] gdk/x11/gdkgc-x11.c
+ gdk/x11/gdkpango-x11.c gdk/x11/gdkpixmap-x11.c
+ gdk/x11/gdkprivate-x11.h gdk/x11/gdkwindow-x11.c:
+ Switch back to using XftDraw so that we take
+ advantage of the draw-to-non-RENDER capabilities
+ of Xft2.
+
+ * demos/gtk-demo/changedisplay.c (query_for_toplevel):
+ Fix the case where the user clicks on the "click on
+ a window popup".
+
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
* demos/gtk-demo/changedisplay.c: New demo for
+Fri Aug 2 00:43:15 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkdrawable-x11.[ch] gdk/x11/gdkgc-x11.c
+ gdk/x11/gdkpango-x11.c gdk/x11/gdkpixmap-x11.c
+ gdk/x11/gdkprivate-x11.h gdk/x11/gdkwindow-x11.c:
+ Switch back to using XftDraw so that we take
+ advantage of the draw-to-non-RENDER capabilities
+ of Xft2.
+
+ * demos/gtk-demo/changedisplay.c (query_for_toplevel):
+ Fix the case where the user clicks on the "click on
+ a window popup".
+
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
* demos/gtk-demo/changedisplay.c: New demo for
+Fri Aug 2 00:43:15 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkdrawable-x11.[ch] gdk/x11/gdkgc-x11.c
+ gdk/x11/gdkpango-x11.c gdk/x11/gdkpixmap-x11.c
+ gdk/x11/gdkprivate-x11.h gdk/x11/gdkwindow-x11.c:
+ Switch back to using XftDraw so that we take
+ advantage of the draw-to-non-RENDER capabilities
+ of Xft2.
+
+ * demos/gtk-demo/changedisplay.c (query_for_toplevel):
+ Fix the case where the user clicks on the "click on
+ a window popup".
+
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
* demos/gtk-demo/changedisplay.c: New demo for
+Fri Aug 2 00:43:15 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkdrawable-x11.[ch] gdk/x11/gdkgc-x11.c
+ gdk/x11/gdkpango-x11.c gdk/x11/gdkpixmap-x11.c
+ gdk/x11/gdkprivate-x11.h gdk/x11/gdkwindow-x11.c:
+ Switch back to using XftDraw so that we take
+ advantage of the draw-to-non-RENDER capabilities
+ of Xft2.
+
+ * demos/gtk-demo/changedisplay.c (query_for_toplevel):
+ Fix the case where the user clicks on the "click on
+ a window popup".
+
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
* demos/gtk-demo/changedisplay.c: New demo for
+Fri Aug 2 00:43:15 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkdrawable-x11.[ch] gdk/x11/gdkgc-x11.c
+ gdk/x11/gdkpango-x11.c gdk/x11/gdkpixmap-x11.c
+ gdk/x11/gdkprivate-x11.h gdk/x11/gdkwindow-x11.c:
+ Switch back to using XftDraw so that we take
+ advantage of the draw-to-non-RENDER capabilities
+ of Xft2.
+
+ * demos/gtk-demo/changedisplay.c (query_for_toplevel):
+ Fix the case where the user clicks on the "click on
+ a window popup".
+
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
* demos/gtk-demo/changedisplay.c: New demo for
+Fri Aug 2 00:43:15 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/x11/gdkdrawable-x11.[ch] gdk/x11/gdkgc-x11.c
+ gdk/x11/gdkpango-x11.c gdk/x11/gdkpixmap-x11.c
+ gdk/x11/gdkprivate-x11.h gdk/x11/gdkwindow-x11.c:
+ Switch back to using XftDraw so that we take
+ advantage of the draw-to-non-RENDER capabilities
+ of Xft2.
+
+ * demos/gtk-demo/changedisplay.c (query_for_toplevel):
+ Fix the case where the user clicks on the "click on
+ a window popup".
+
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
* demos/gtk-demo/changedisplay.c: New demo for
AM_CONDITIONAL(HAVE_XFT, $have_xft)
+ if $PKG_CONFIG --exists xft ; then
+ AC_DEFINE(HAVE_XFT2, 1, [Define if we have Xft, version 2])
+ fi
+
#
# If Pango included the shared library dependencies from X11 in
# the pkg-config output, then we use that (to avoid duplicates).
&event_base, &error_base);
}
-static Picture
-gdk_x11_drawable_get_picture (GdkDrawable *drawable)
+static XftDraw *
+gdk_x11_drawable_get_xft_draw (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)
+ if (impl->xft_draw == NULL)
{
- GdkVisual *visual = gdk_drawable_get_visual (drawable);
- XRenderPictFormat *format;
+ GdkColormap *colormap = gdk_drawable_get_colormap (drawable);
+ GdkVisual *visual;
- if (!visual)
+ if (!colormap)
{
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;
+ return NULL;
}
- 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);
+ visual = gdk_colormap_get_visual (colormap);
+
+ impl->xft_draw = XftDrawCreate (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
+ GDK_VISUAL_XVISUAL (visual), GDK_COLORMAP_XCOLORMAP (colormap));
}
- return impl->picture;
+ return impl->xft_draw;
}
+static Picture
+gdk_x11_drawable_get_picture (GdkDrawable *drawable)
+{
+ XftDraw *draw = gdk_x11_drawable_get_xft_draw (drawable);
+
+ return draw ? XftDrawPicture (draw) : None;
+}
+
static void
-gdk_x11_drawable_update_picture_clip (GdkDrawable *drawable,
- GdkGC *gc)
+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);
+ XftDraw *xft_draw = gdk_x11_drawable_get_xft_draw (drawable);
if (gc && gc_private->clip_region)
{
GdkRegionBox *boxes = gc_private->clip_region->rects;
gint n_boxes = gc_private->clip_region->numRects;
+#if 0 /* Until XftDrawSetClipRectangles is there */
XRectangle *rects = g_new (XRectangle, n_boxes);
int i;
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);
+ XftDrawSetClipRectangles (xft_draw, 0, 0, rects, n_boxes);
g_free (rects);
+#else
+ Region xregion = XCreateRegion ();
+ int i;
+
+ for (i=0; i < n_boxes; i++)
+ {
+ XRectangle rect;
+
+ rect.x = CLAMP (boxes[i].x1 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT);
+ rect.y = CLAMP (boxes[i].y1 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT);
+ rect.width = CLAMP (boxes[i].x2 + gc->clip_x_origin, G_MINSHORT, G_MAXSHORT) - rect.x;
+ rect.height = CLAMP (boxes[i].y2 + gc->clip_y_origin, G_MINSHORT, G_MAXSHORT) - rect.y;
+
+ XUnionRectWithRegion (&rect, xregion, xregion);
+ }
+
+ XftDrawSetClip (xft_draw, xregion);
+ XDestroyRegion (xregion);
+#endif
}
else
{
- XRenderPictureAttributes pa;
- pa.clip_mask = None;
- XRenderChangePicture (GDK_SCREEN_XDISPLAY (impl->screen),
- picture, CPClipMask, &pa);
+ XftDrawSetClip (xft_draw, NULL);
}
}
#endif
#if HAVE_XFT
if (PANGO_XFT_IS_FONT (font))
{
- Picture src_picture;
- Picture dest_picture;
-
- src_picture = _gdk_x11_gc_get_fg_picture (gc);
-
- gdk_x11_drawable_update_picture_clip (drawable, gc);
- dest_picture = gdk_x11_drawable_get_picture (drawable);
+ XftColor color;
+ XftDraw *draw;
+
+ _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_picture_render (GDK_SCREEN_XDISPLAY (impl->screen),
- src_picture, dest_picture,
- font, glyphs, x, y);
+ pango_xft_render (draw, &color, font, glyphs, x, y);
}
else
#endif /* !HAVE_XFT */
return;
}
- gdk_x11_drawable_update_picture_clip (drawable, gc);
+ gdk_x11_drawable_update_xft_clip (drawable, gc);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
#include <X11/Xlib.h>
#ifdef HAVE_XFT
-#include <X11/extensions/Xrender.h>
+#include <X11/Xft/Xft.h>
#endif
#ifdef __cplusplus
GdkScreen *screen;
#ifdef HAVE_XFT
- Picture picture;
+ XftDraw *xft_draw;
#endif
};
_gdk_x11_gc_get_fg_picture (GdkGC *gc)
{
GdkGCX11 *x11_gc;
- GdkColormap *cmap = gdk_gc_get_colormap (gc);
+ GdkColormap *cmap;
gboolean new = FALSE;
GdkColor color;
return None;
x11_gc = GDK_GC_X11 (gc);
+ cmap = gdk_gc_get_colormap (gc);
if (x11_gc->fg_picture == None)
{
return x11_gc->fg_picture;
}
+
+/**
+ * _gdk_gc_x11_get_fg_xft_color:
+ * @gc: a #GdkGC
+ * @xftcolor: location to store the color
+ *
+ * Gets the foreground color of the GC as a XftColor.
+ **/
+void
+_gdk_gc_x11_get_fg_xft_color (GdkGC *gc,
+ XftColor *xftcolor)
+{
+ GdkGCX11 *x11_gc;
+ GdkColormap *cmap;
+ GdkColor color;
+
+ g_return_if_fail (GDK_IS_GC_X11 (gc));
+
+ x11_gc = GDK_GC_X11 (gc);
+ cmap = gdk_gc_get_colormap (gc);
+
+ xftcolor->pixel = x11_gc->fg_pixel;
+
+ gdk_colormap_query_color (cmap, xftcolor->pixel, &color);
+ xftcolor->color.red = color.red;
+ xftcolor->color.green = color.green;
+ xftcolor->color.blue = color.blue;
+ xftcolor->color.alpha = 0xffff;
+}
+
#endif /* 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)
{
GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (impl);
- if (draw_impl->picture)
- XRenderFreePicture (GDK_DISPLAY_XDISPLAY (display), draw_impl->picture);
+ if (draw_impl->xft_draw)
+ XftDrawDestroy (draw_impl->xft_draw);
}
#endif /* HAVE_XFT */
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);
+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,
{
GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
- if (draw_impl->picture)
- XRenderFreePicture (GDK_WINDOW_XDISPLAY (window), draw_impl->picture);
+ if (draw_impl->xft_draw)
+ XftDrawDestroy (draw_impl->xft_draw);
}
#endif /* HAVE_XFT */