From 6100cb477a08cecace1f8150a1f97c255fc58303 Mon Sep 17 00:00:00 2001 From: Ramiro Polla Date: Fri, 15 Jun 2007 20:40:14 +0000 Subject: Allow user to specify rgb.txt for imlib2 vhook Originally committed as revision 9326 to svn://svn.ffmpeg.org/ffmpeg/trunk --- vhook/imlib2.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'vhook') diff --git a/vhook/imlib2.c b/vhook/imlib2.c index 4e6ffb67c0..98ccaf8c4b 100644 --- a/vhook/imlib2.c +++ b/vhook/imlib2.c @@ -15,6 +15,10 @@ * * Options: * + * -C The filename to read RGB color names from + * Defaults if none specified: + * /usr/share/X11/rgb.txt + * /usr/lib/X11/rgb.txt * -c The color of the text * -F The font face and size * -t The text @@ -176,6 +180,7 @@ int Configure(void **ctxp, int argc, char *argv[]) { int c; ContextInfo *ci; + char *rgbtxt = 0; char *font = "LucidaSansDemiBold/16"; char *fp = getenv("FONTPATH"); char *color = 0; @@ -203,8 +208,11 @@ int Configure(void **ctxp, int argc, char *argv[]) imlib_add_path_to_font_path(fp); - while ((c = getopt(argc, argv, "c:f:F:t:x:y:i:")) > 0) { + while ((c = getopt(argc, argv, "C:c:f:F:t:x:y:i:")) > 0) { switch (c) { + case 'C': + rgbtxt = optarg; + break; case 'c': color = optarg; break; @@ -246,11 +254,16 @@ int Configure(void **ctxp, int argc, char *argv[]) char buff[256]; int done = 0; + if (rgbtxt) + f = fopen(rgbtxt, "r"); + else + { f = fopen("/usr/share/X11/rgb.txt", "r"); if (!f) f = fopen("/usr/lib/X11/rgb.txt", "r"); + } if (!f) { - fprintf(stderr, "Failed to find rgb.txt\n"); + fprintf(stderr, "Failed to find RGB color names file\n"); return -1; } while (fgets(buff, sizeof(buff), f)) { -- cgit v1.2.3