Mercurial > MadButterfly
diff src/graph_engine_cairo.c @ 1110:851a062368bd
Change signature of mbe_win_surface_create() by using format argument
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 08 Dec 2010 18:31:39 +0800 |
parents | e1a76d10953e |
children |
line wrap: on
line diff
--- a/src/graph_engine_cairo.c Tue Dec 07 12:42:41 2010 +0800 +++ b/src/graph_engine_cairo.c Wed Dec 08 18:31:39 2010 +0800 @@ -1,5 +1,6 @@ // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- // vim: sw=4:ts=8:sts=4 +#include <X11/Xlib.h> #include <fontconfig/fontconfig.h> #include <cairo-ft.h> #include "mb_graph_engine_cairo.h" @@ -82,6 +83,23 @@ } +extern mbe_surface_t * +mbe_win_surface_create(void *display, void *drawable, + int fmt, int width, int height) { + XWindowAttributes attrs; + mbe_surface_t *surf; + int r; + + r = XGetWindowAttributes((Display *)display, (Drawable)drawable, &attrs); + if(r == 0) + return NULL; + + surf = cairo_xlib_surface_create((Display *)display, (Drawable)drawable, + attrs.visual, width, height); + + return surf; +} + /*! \brief Find out a font face for a pattern specified. * * The pattern, here, is a vector of family, slant, and weight.