From d9a982165dc3ecc66937ab0a67692cdc3526e3eb Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 14 Jan 2008 18:09:32 +0000 Subject: [PATCH] [cairo-xlib] Fixup --disable-xlib-xrender Fixup the headers and boilerplate to compile and run correctly when configured with --disable-xlib-xrender. --- boilerplate/Makefile.am | 2 +- boilerplate/cairo-boilerplate-xlib-private.h | 2 + boilerplate/cairo-boilerplate-xlib.c | 27 ++++++++++++++----------- boilerplate/cairo-boilerplate.c | 2 +- src/cairo-freelist-private.h | 3 +- src/cairo-xlib-private.h | 5 +--- src/cairo-xlib-surface-private.h | 1 + src/cairo-xlib-surface.c | 2 + src/cairo-xlib-xrender-private.h | 2 - src/cairo-xlib-xrender.h | 6 +--- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am index 7dd9c4d..1d9c342 100644 --- a/boilerplate/Makefile.am +++ b/boilerplate/Makefile.am @@ -77,7 +77,7 @@ libcairoboilerplate_la_SOURCES += cairo-boilerplate-xcb.c libcairoboilerplate_la_SOURCES += cairo-boilerplate-xcb-private.h endif -if CAIRO_HAS_XLIB_XRENDER_SURFACE +if CAIRO_HAS_XLIB_SURFACE libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib.c libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib.h libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib-private.h diff --git a/boilerplate/cairo-boilerplate-xlib-private.h b/boilerplate/cairo-boilerplate-xlib-private.h index 65da947..54c631c 100644 --- a/boilerplate/cairo-boilerplate-xlib-private.h +++ b/boilerplate/cairo-boilerplate-xlib-private.h @@ -27,6 +27,7 @@ #ifndef _CAIRO_BOILERPLATE_XLIB_PRIVATE_H_ #define _CAIRO_BOILERPLATE_XLIB_PRIVATE_H_ +#if CAIRO_HAS_XLIB_XRENDER_SURFACE cairo_surface_t * _cairo_boilerplate_xlib_create_surface (const char *name, cairo_content_t content, @@ -34,6 +35,7 @@ _cairo_boilerplate_xlib_create_surface (const char *name, int height, cairo_boilerplate_mode_t mode, void **closure); +#endif cairo_surface_t * _cairo_boilerplate_xlib_fallback_create_surface (const char *name, diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c index 28d1a2e..7e0f4dc 100644 --- a/boilerplate/cairo-boilerplate-xlib.c +++ b/boilerplate/cairo-boilerplate-xlib.c @@ -28,9 +28,12 @@ #include "cairo-boilerplate-xlib.h" #include "cairo-boilerplate-xlib-private.h" +#include #include #include +#include /* for XDestroyImage */ + typedef struct _xlib_target_closure { Display *dpy; @@ -50,6 +53,17 @@ _cairo_boilerplate_xlib_synchronize (void *closure) XDestroyImage (ximage); } +static cairo_bool_t +_cairo_boilerplate_xlib_check_screen_size (Display *dpy, + int screen, + int width, + int height) +{ + Screen *scr = XScreenOfDisplay (dpy, screen); + return width <= WidthOfScreen (scr) && height <= HeightOfScreen (scr); +} + +#if CAIRO_HAS_XLIB_XRENDER_SURFACE /* For the xlib backend we distinguish between TEST and PERF mode in a * couple of ways. * @@ -110,18 +124,6 @@ _cairo_boilerplate_xlib_test_create_surface (Display *dpy, width, height); } - -static cairo_bool_t -_cairo_boilerplate_xlib_check_screen_size (Display *dpy, - int screen, - int width, - int height) -{ - Screen *scr = XScreenOfDisplay (dpy, screen); - return width <= WidthOfScreen (scr) && height <= HeightOfScreen (scr); -} - - static cairo_surface_t * _cairo_boilerplate_xlib_perf_create_surface (Display *dpy, cairo_content_t content, @@ -210,6 +212,7 @@ _cairo_boilerplate_xlib_create_surface (const char *name, else /* mode == CAIRO_BOILERPLATE_MODE_PERF */ return _cairo_boilerplate_xlib_perf_create_surface (dpy, content, width, height, xtc); } +#endif /* The xlib-fallback target differs from the xlib target in two ways: * diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index e92e2a6..a4c2114 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -57,7 +57,7 @@ #if CAIRO_HAS_XCB_SURFACE #include "cairo-boilerplate-xcb-private.h" #endif -#if CAIRO_HAS_XLIB_XRENDER_SURFACE +#if CAIRO_HAS_XLIB_SURFACE #include "cairo-boilerplate-xlib-private.h" #endif diff --git a/src/cairo-freelist-private.h b/src/cairo-freelist-private.h index 7e2036c..0d02127 100644 --- a/src/cairo-freelist-private.h +++ b/src/cairo-freelist-private.h @@ -22,8 +22,7 @@ #ifndef CAIRO_FREELIST_H #define CAIRO_FREELIST_H -#include "cairoint.h" -#include +#include "cairo-types-private.h" /* Opaque implementation types. */ typedef struct _cairo_freelist cairo_freelist_t; diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h index 05c7d0e..34db4c6 100644 --- a/src/cairo-xlib-private.h +++ b/src/cairo-xlib-private.h @@ -33,17 +33,14 @@ #ifndef CAIRO_XLIB_PRIVATE_H #define CAIRO_XLIB_PRIVATE_H -#include "cairoint.h" - #include "cairo-xlib.h" #include "cairo-compiler-private.h" #include "cairo-freelist-private.h" +#include "cairo-mutex-private.h" #include "cairo-reference-count-private.h" #include "cairo-xlib-xrender-private.h" -#include /* for XDestroyImage */ - typedef struct _cairo_xlib_display cairo_xlib_display_t; typedef struct _cairo_xlib_hook cairo_xlib_hook_t; typedef struct _cairo_xlib_job cairo_xlib_job_t; diff --git a/src/cairo-xlib-surface-private.h b/src/cairo-xlib-surface-private.h index 3bbf43e..6a05862 100644 --- a/src/cairo-xlib-surface-private.h +++ b/src/cairo-xlib-surface-private.h @@ -34,6 +34,7 @@ #define CAIRO_XLIB_SURFACE_PRIVATE_H #include "cairo-xlib.h" +#include "cairo-xlib-private.h" #include "cairo-surface-private.h" diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 129277c..7973035 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -42,6 +42,8 @@ #include "cairo-xlib-surface-private.h" #include "cairo-clip-private.h" +#include /* for XDestroyImage */ + /* Xlib doesn't define a typedef, so define one ourselves */ typedef int (*cairo_xlib_error_func_t) (Display *display, XErrorEvent *event); diff --git a/src/cairo-xlib-xrender-private.h b/src/cairo-xlib-xrender-private.h index db27c24..47e1b70 100644 --- a/src/cairo-xlib-xrender-private.h +++ b/src/cairo-xlib-xrender-private.h @@ -33,8 +33,6 @@ #ifndef CAIRO_XLIB_XRENDER_PRIVATE_H #define CAIRO_XLIB_XRENDER_PRIVATE_H -#include "cairoint.h" - #if CAIRO_HAS_XLIB_XRENDER_SURFACE #include "cairo-xlib-xrender.h" diff --git a/src/cairo-xlib-xrender.h b/src/cairo-xlib-xrender.h index f5c35dc..7d833a3 100644 --- a/src/cairo-xlib-xrender.h +++ b/src/cairo-xlib-xrender.h @@ -39,7 +39,7 @@ #include -#if CAIRO_HAS_XLIB_SURFACE +#if CAIRO_HAS_XLIB_XRENDER_SURFACE #include #include @@ -56,8 +56,6 @@ cairo_xlib_surface_create_with_xrender_format (Display *dpy, CAIRO_END_DECLS -#else /* CAIRO_HAS_XLIB_SURFACE */ -# error Cairo was not compiled with support for the xlib backend -#endif /* CAIRO_HAS_XLIB_SURFACE */ +#endif /* CAIRO_HAS_XLIB_XRENDER_SURFACE */ #endif /* CAIRO_XLIB_XRENDER_H */ -- 1.5.3.8