#ifndef INITCAIRO_H #define INITCAIRO_H #include #include #include #include #include #include #include #include #include #define STATUS_NOTHING 0 #define STATUS_REDRAW 1 #define STATUS_QUIT 2 typedef struct { cairo_matrix_t matrix; unsigned int width; unsigned int height; // these things will be written by updateDimensions() double scalefactor; double center_x; double center_y; double radius; } DimensionsInfo; typedef struct { Display *display; Window win; Colormap cmap; Atom wm_protocols; Atom wm_delete_window; cairo_surface_t *surface; cairo_t *front_context; cairo_surface_t *buffer_surface; cairo_t *buffer_context; unsigned char *buffer; struct timeval start_time; unsigned long frames; double elapsed, frametime; DimensionsInfo *dim; } GraphicsInfo; GraphicsInfo *initCairo(int screen, int mask, int width, int height, const char *name); void destroyCairo(GraphicsInfo *info); void startTimer(GraphicsInfo *info); void waitUpdateTimer(GraphicsInfo *info); int checkEvents(GraphicsInfo *info, int (*process)(GraphicsInfo*, XEvent*), void (*draw)(void *)); void updateDimensions(DimensionsInfo *ctx); #endif