diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2011-09-13 17:42:16 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2011-09-13 17:42:16 +0200 | 
| commit | 2e017bbfbf3e9554bd54b98d11c5532d55b02f6c (patch) | |
| tree | 46ad0f48dfcc71d01163f4361449f55fa4e60642 | |
| parent | af2a44237a7b5cebbf0d03375ed742809da15a59 (diff) | |
Use enum for opt.image_bg, rename --image-bg default to --image-bg checks
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | src/feh.h | 2 | ||||
| -rw-r--r-- | src/options.c | 11 | ||||
| -rw-r--r-- | src/options.h | 2 | ||||
| -rw-r--r-- | src/winwidget.c | 6 | ||||
| -rwxr-xr-x | test/feh-scr.i | 2 | 
6 files changed, 16 insertions, 8 deletions
| @@ -3,6 +3,7 @@ git HEAD      * Fix useless memory use when using feh --reload on HTTP URLs        (fun fact: strictly speaking, this was not a memory leak)        <https://github.com/derf/feh/issues/62> +    * "--image-bg default" was renamed to "--image-bg checks"  Sun, 11 Sep 2011 12:46:50 +0200  Daniel Friesel <derf@finalrewind.org> @@ -102,6 +102,8 @@ enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_RAND, SLIDE_FIRST, SLIDE_LAST,  	SLIDE_JUMP_BACK  }; +enum image_bg { IMAGE_BG_CHECKS = 0, IMAGE_BG_BLACK, IMAGE_BG_WHITE }; +  #define INPLACE_EDIT_FLIP   -1  #define INPLACE_EDIT_MIRROR -2 diff --git a/src/options.c b/src/options.c index fe0cf87..cf32bb0 100644 --- a/src/options.c +++ b/src/options.c @@ -58,7 +58,6 @@ void init_parse_options(int argc, char **argv)  	opt.thumb_redraw = 10;  	opt.menu_font = estrdup(DEFAULT_MENU_FONT);  	opt.font = NULL; -	opt.image_bg = estrdup("default");  	opt.menu_bg = estrdup(PREFIX "/share/feh/images/menubg_default.png");  	opt.menu_style = estrdup(PREFIX "/share/feh/fonts/menu.style"); @@ -606,8 +605,14 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)  			weprintf("The --menu-bg option is deprecated and will be removed by 2012");  			break;  		case 'B': -			free(opt.image_bg); -			opt.image_bg = estrdup(optarg); +			if (!strcmp(optarg, "checks")) +				opt.image_bg = IMAGE_BG_CHECKS; +			else if (!strcmp(optarg, "white")) +				opt.image_bg = IMAGE_BG_WHITE; +			else if (!strcmp(optarg, "black")) +				opt.image_bg = IMAGE_BG_BLACK; +			else +				weprintf("Unknown argument to --image-bg: %s", optarg);  			break;  		case 'D':  			opt.slideshow_delay = atof(optarg); diff --git a/src/options.h b/src/options.h index 2ca655e..ae3a707 100644 --- a/src/options.h +++ b/src/options.h @@ -70,6 +70,7 @@ struct __fehoptions {  	unsigned char cycle_once;  	unsigned char hold_actions[10];  	unsigned char text_bg; +	unsigned char image_bg;  	char *output_file;  	char *output_dir; @@ -84,7 +85,6 @@ struct __fehoptions {  	char *menu_font;  	char *customlist;  	char *menu_bg; -	char *image_bg;  	char *menu_style;  	char *caption_path;  	char *start_list_at; diff --git a/src/winwidget.c b/src/winwidget.c index 8851f90..bc530ee 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -350,7 +350,7 @@ void winwidget_setup_pixmaps(winwidget winwid)  			if (winwid->gc == None) {  				XGCValues gcval; -				if (!strcmp(opt.image_bg, "white")) +				if (opt.image_bg == IMAGE_BG_WHITE)  					gcval.foreground = WhitePixel(disp, DefaultScreen(disp));  				else  					gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); @@ -626,9 +626,9 @@ Pixmap feh_create_checks(void)  		if (!checks)  			eprintf("Unable to create a teeny weeny imlib image. I detect problems"); -		if (strncmp(opt.image_bg, "white", 5) == 0) +		if (opt.image_bg == IMAGE_BG_WHITE)  			gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 255, 255, 255, 255); -		else if (strncmp(opt.image_bg, "black", 5) == 0) +		else if (opt.image_bg == IMAGE_BG_BLACK)  			gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 0, 0, 0, 255);  		else {  			gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 144, 144, 144, 255); diff --git a/test/feh-scr.i b/test/feh-scr.i index 037f42c..c677088 100755 --- a/test/feh-scr.i +++ b/test/feh-scr.i @@ -312,7 +312,7 @@ feh_start(q{}, 'test/bg/transparency');  test_scr('feh_ibg_default');  feh_stop(); -feh_start('--image-bg default', 'test/bg/transparency'); +feh_start('--image-bg checks', 'test/bg/transparency');  test_scr('feh_ibg_default');  feh_stop(); | 
