Avoid X errors when running against servers which implement XRender < 0.4.

2005-01-18  Matthias Clasen  <mclasen@redhat.com>

	Avoid X errors when running against servers which
	implement XRender < 0.4.  (#164427, Albert Chin)

	* gdk/x11/gdkprivate-x11.h:
	* gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render_with_trapezoids):
	New function to check for trapezoid support in XRender.
	(gdk_x11_draw_trapezoids, _gdk_x11_drawable_draw_xtrapezoids):
	Use it here.

	* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a
	separate have_render_with_trapezoids field.

	* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Initialize it.
This commit is contained in:
Matthias Clasen 2005-01-18 15:19:53 +00:00 committed by Matthias Clasen
parent 220946ed7d
commit 014a347f00
7 changed files with 85 additions and 3 deletions

View File

@ -1,3 +1,19 @@
2005-01-18 Matthias Clasen <mclasen@redhat.com>
Avoid X errors when running against servers which
implement XRender < 0.4. (#164427, Albert Chin)
* gdk/x11/gdkprivate-x11.h:
* gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render_with_trapezoids):
New function to check for trapezoid support in XRender.
(gdk_x11_draw_trapezoids, _gdk_x11_drawable_draw_xtrapezoids):
Use it here.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a
separate have_render_with_trapezoids field.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Initialize it.
2005-01-17 Matthias Clasen <mclasen@redhat.com> 2005-01-17 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Remove debug output. (#164376, Jens Finke) * gtk/gtkiconview.c: Remove debug output. (#164376, Jens Finke)

View File

@ -1,3 +1,19 @@
2005-01-18 Matthias Clasen <mclasen@redhat.com>
Avoid X errors when running against servers which
implement XRender < 0.4. (#164427, Albert Chin)
* gdk/x11/gdkprivate-x11.h:
* gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render_with_trapezoids):
New function to check for trapezoid support in XRender.
(gdk_x11_draw_trapezoids, _gdk_x11_drawable_draw_xtrapezoids):
Use it here.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a
separate have_render_with_trapezoids field.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Initialize it.
2005-01-17 Matthias Clasen <mclasen@redhat.com> 2005-01-17 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Remove debug output. (#164376, Jens Finke) * gtk/gtkiconview.c: Remove debug output. (#164376, Jens Finke)

View File

@ -1,3 +1,19 @@
2005-01-18 Matthias Clasen <mclasen@redhat.com>
Avoid X errors when running against servers which
implement XRender < 0.4. (#164427, Albert Chin)
* gdk/x11/gdkprivate-x11.h:
* gdk/x11/gdkdrawable-x11.c (_gdk_x11_have_render_with_trapezoids):
New function to check for trapezoid support in XRender.
(gdk_x11_draw_trapezoids, _gdk_x11_drawable_draw_xtrapezoids):
Use it here.
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add a
separate have_render_with_trapezoids field.
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Initialize it.
2005-01-17 Matthias Clasen <mclasen@redhat.com> 2005-01-17 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Remove debug output. (#164376, Jens Finke) * gtk/gtkiconview.c: Remove debug output. (#164376, Jens Finke)

View File

@ -206,6 +206,7 @@ gdk_display_open (const gchar *display_name)
display_x11->leader_window_title_set = FALSE; display_x11->leader_window_title_set = FALSE;
display_x11->have_render = GDK_UNKNOWN; display_x11->have_render = GDK_UNKNOWN;
display_x11->have_render_with_trapezoids = GDK_UNKNOWN;
#ifdef HAVE_XFIXES #ifdef HAVE_XFIXES
if (XFixesQueryExtension (display_x11->xdisplay, if (XFixesQueryExtension (display_x11->xdisplay,

View File

@ -78,6 +78,7 @@ struct _GdkDisplayX11
gboolean use_xshm; gboolean use_xshm;
gboolean have_shm_pixmaps; gboolean have_shm_pixmaps;
GdkTristate have_render; GdkTristate have_render;
GdkTristate have_render_with_trapezoids;
gboolean have_xfixes; gboolean have_xfixes;
gint xfixes_event_base; gint xfixes_event_base;

View File

@ -321,6 +321,36 @@ _gdk_x11_have_render (GdkDisplay *display)
return x11display->have_render == GDK_YES; return x11display->have_render == GDK_YES;
} }
gboolean
_gdk_x11_have_render_with_trapezoids (GdkDisplay *display)
{
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
GdkDisplayX11 *x11display = GDK_DISPLAY_X11 (display);
if (x11display->have_render_with_trapezoids == GDK_UNKNOWN)
if (!_gdk_x11_have_render (display))
x11display->have_render_with_trapezoids = GDK_NO;
else
{
/*
* Require protocol >= 0.4 for CompositeTrapezoids support.
*/
int major_version, minor_version;
#define XRENDER_TETRAPEZOIDS_MAJOR 0
#define XRENDER_TETRAPEZOIDS_MINOR 4
if (XRenderQueryVersion (xdisplay, &major_version,
&minor_version))
if ((major_version < XRENDER_TETRAPEZOIDS_MAJOR) ||
((major_version == XRENDER_TETRAPEZOIDS_MAJOR) &&
(minor_version < XRENDER_TETRAPEZOIDS_MINOR)))
x11display->have_render_with_trapezoids = GDK_NO;
}
return x11display->have_render_with_trapezoids == GDK_YES;
}
static XftDraw * static XftDraw *
gdk_x11_drawable_get_xft_draw (GdkDrawable *drawable) gdk_x11_drawable_get_xft_draw (GdkDrawable *drawable)
{ {
@ -1496,7 +1526,7 @@ gdk_x11_draw_trapezoids (GdkDrawable *drawable,
XTrapezoid *xtrapezoids; XTrapezoid *xtrapezoids;
gint i; gint i;
if (!_gdk_x11_have_render (display)) if (!_gdk_x11_have_render_with_trapezoids (display))
{ {
GdkDrawable *wrapper = GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper; GdkDrawable *wrapper = GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper;
GDK_DRAWABLE_CLASS (parent_class)->draw_trapezoids (wrapper, gc, GDK_DRAWABLE_CLASS (parent_class)->draw_trapezoids (wrapper, gc,
@ -1603,7 +1633,7 @@ _gdk_x11_drawable_draw_xtrapezoids (GdkDrawable *drawable,
XftDraw *draw; XftDraw *draw;
if (!_gdk_x11_have_render (display)) if (!_gdk_x11_have_render_with_trapezoids (display))
{ {
/* This is the case of drawing the borders of the unknown glyph box /* This is the case of drawing the borders of the unknown glyph box
* without render on the display, we need to feed it back to * without render on the display, we need to feed it back to

View File

@ -108,7 +108,9 @@ gint _gdk_send_xevent (GdkDisplay *display,
GType _gdk_gc_x11_get_type (void); GType _gdk_gc_x11_get_type (void);
gboolean _gdk_x11_have_render (GdkDisplay *display); gboolean _gdk_x11_have_render (GdkDisplay *display);
gboolean _gdk_x11_have_render_with_trapezoids (GdkDisplay *display);
Picture _gdk_x11_gc_get_fg_picture (GdkGC *gc); Picture _gdk_x11_gc_get_fg_picture (GdkGC *gc);
void _gdk_gc_x11_get_fg_xft_color (GdkGC *gc, void _gdk_gc_x11_get_fg_xft_color (GdkGC *gc,
XftColor *xftcolor); XftColor *xftcolor);