Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=xcmenu.git;a=commitdiff;h=548aa1437f5bc98a924697ad7e942dabdd0cf932
commit 548aa1437f5bc98a924697ad7e942dabdd0cf932 Author: James Buren <[email protected]> Date: Thu Jan 8 09:46:38 2009 -0600 xcmenu.c * add a check for image height and a way to determine the required height automatically diff --git a/xcmenu.c b/xcmenu.c index 4bbef3e..d354194 100644 --- a/xcmenu.c +++ b/xcmenu.c @@ -21,6 +21,7 @@ static char path[BUFFER]; static char theme[BUFFER]; static char themefile[BUFFER]; static config_t cfg; +static unsigned int hg; static cairo_surface_t *bg; static cairo_surface_t *le; static cairo_surface_t *re; @@ -81,6 +82,17 @@ static int filechk(const char *filename) return(TRUE); } +/* check if a png file's height is sane */ +static void chkhg(cairo_surface_t *png) +{ + unsigned int height; + height = cairo_image_surface_get_height(png); + if (!hg) + hg = height; + else if (hg!=height) + error("All theme images must be of the same height.",NULL); +} + /* wrap cairo calls for my own uses :D */ static void load_png(const char *png,cairo_surface_t **ptr) { @@ -130,6 +142,14 @@ static void parse_theme() load_png(selectedbackground,&stbg); load_png(selectedleftend,&stle); load_png(selectedrightend,&stre); + chkhg(bg); + chkhg(le); + chkhg(re); + chkhg(la); + chkhg(ra); + chkhg(stbg); + chkhg(stle); + chkhg(stre); config_destroy(&cfg); } _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
