summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2011-07-03 13:13:37 +0200
committerUli Schlachter <psychon@znc.in>2011-07-03 15:16:23 +0200
commitb6c972897b9d7cb898fb08363115e721a3ff758c (patch)
tree2dc1c28fbe65cab3971433cef6afba4a79fccc6d /boilerplate
parenteea31cc4ee02f81554f04c3db60ab371c1cb212f (diff)
Xlib: Fix boilerplate to work with xlib-xcb
Xlib boilerplate includes cairo-xlib-surface-private.h, so that it can cast the xlib cairo_surface_t to cairo_xlib_surface_t and then mess with some internals of that struct. However, xlib-xcb doesn't use that struct and thus this results in random memory corruption. "Luckily", all the fields that this messes with don't corrupt any fields in cairo_xlib_xcb_surface_t, but instead this writes past the end of the buffer that was returned from malloc. This commit just adds an #if to disable this code section since I have no idea what a proper fix would be. This means that the xlib-fallback backend doesn't actually test any fallbacks with xlib-xcb, however it never did so anyway. If you have any idea how to fix xlib-fallback with xlib-xcb, please speak up. Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-xlib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index 797fe972..6818cafd 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -412,6 +412,11 @@ _cairo_boilerplate_xlib_window_create_surface (const char *name,
cairo_status_t
cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface)
{
+ /* The following stunt doesn't work with xlib-xcb because it doesn't use
+ * cairo_xlib_surface_t for its surfaces. Sadly, there is no sane
+ * alternative, so we can't disable render with xlib-xcb.
+ * FIXME: Find an alternative. */
+#if !CAIRO_HAS_XLIB_XCB_FUNCTIONS
cairo_xlib_surface_t *surface = (cairo_xlib_surface_t*) abstract_surface;
if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_XLIB)
@@ -434,6 +439,7 @@ cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface
#if CAIRO_XLIB_SURFACE_HAS_BUGGY_REPEAT
surface->buggy_repeat = TRUE;
#endif
+#endif
return CAIRO_STATUS_SUCCESS;
}