Basics 3 GHOSD Library BasicsCreation, rendering, destruction. Synopsis #include <ghosd/ghosd.h> Ghosd; void (*GhosdRenderFunc) (Ghosd *ghosd, cairo_t *cr, void *user_data); Ghosd* ghosd_new (void); void ghosd_set_transparent (Ghosd *ghosd, int transparent); #define GHOSD_COORD_CENTER void ghosd_set_position (Ghosd *ghosd, int x, int y, int width, int height); void ghosd_set_render (Ghosd *ghosd, GhosdRenderFunc render_func, void *data); void ghosd_render (Ghosd *ghosd); void ghosd_show (Ghosd *ghosd); Description Details <anchor id="Ghosd"/>Ghosd Ghosdtypedef struct _Ghosd Ghosd; An opaque Ghosd object. Think of it as the window that the content is displayed in. <anchor id="GhosdRenderFunc"/>GhosdRenderFunc () GhosdRenderFuncvoid (*GhosdRenderFunc) (Ghosd *ghosd, cairo_t *cr, void *user_data); The type of callback called when Ghosd needs to render the content. ghosd : A Ghosd object. cr : A cairo_t to draw on. user_data : User data that was passed to ghosd_set_render(). <anchor id="ghosd-new"/>ghosd_new () ghosd_newGhosd* ghosd_new (void); Create a new Ghosd object. Can return NULL if unable to connect to the X server. Returns : a new Ghosd object. <anchor id="ghosd-set-transparent"/>ghosd_set_transparent () ghosd_set_transparentvoid ghosd_set_transparent (Ghosd *ghosd, int transparent); Change the "transparent" setting. Setting transparent to FALSE is mostly useful for debugging. ghosd : a Ghosd object. transparent : a boolean indicating the transparent setting. <anchor id="GHOSD-COORD-CENTER:CAPS"/>GHOSD_COORD_CENTER GHOSD_COORD_CENTER#define GHOSD_COORD_CENTER MAXINT Pass this as a coordinate to ghosd_set_position() to center along that axis. <anchor id="ghosd-set-position"/>ghosd_set_position () ghosd_set_positionvoid ghosd_set_position (Ghosd *ghosd, int x, int y, int width, int height); Position the initial Ghosd. Must be called before ghosd_render() and ghosd_show(), and can only be called once. Positive x,y are interpreted as normal coordinates. Pass GHOSD_COORD_CENTER to center on a given dimension, and negative coordinates right-align (like CSS right). ghosd : a Ghosd object. x : x coordinate in screen pixels. y : y coordinate in screen pixels. width : width in screen pixels. height : width in screen pixels. <anchor id="ghosd-set-render"/>ghosd_set_render () ghosd_set_rendervoid ghosd_set_render (Ghosd *ghosd, GhosdRenderFunc render_func, void *data); Register a function to draw on the Ghosd. ghosd : a Ghosd object. render_func : a GhosdRenderFunc callback. data : user data to pass to the callback. <anchor id="ghosd-render"/>ghosd_render () ghosd_rendervoid ghosd_render (Ghosd *ghosd); Makes the Ghosd redraw itself. ghosd : a Ghosd object. <anchor id="ghosd-show"/>ghosd_show () ghosd_showvoid ghosd_show (Ghosd *ghosd); Show the Ghosd. ghosd : a Ghosd object.