From 3cc2c50bb8422fc738a5875048c06758af6ded76 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 31 May 2010 09:39:56 +0200 Subject: major --thumbnails speed impromevents, new --thumb-redraw option See ChangeLog / man/feh.1 "--thumb-redraw" for more --- src/options.c | 6 ++++++ src/options.h | 1 + src/thumbnail.c | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/options.c b/src/options.c index f967456..1f3ec76 100644 --- a/src/options.c +++ b/src/options.c @@ -52,6 +52,7 @@ void init_parse_options(int argc, char **argv) opt.slideshow_delay = -1.0; opt.thumb_w = 60; opt.thumb_h = 60; + opt.thumb_redraw = 10; opt.menu_font = estrdup(DEFAULT_MENU_FONT); opt.font = estrdup(DEFAULT_FONT); opt.image_bg = estrdup("default"); @@ -395,6 +396,7 @@ static void feh_parse_option_array(int argc, char **argv) {"index-name", 1, 0, 230}, {"index-size", 1, 0, 231}, {"index-dim", 1, 0, 232}, + {"thumb-redraw", 1, 0, 233}, {0, 0, 0, 0} }; int optch = 0, cmdx = 0; @@ -738,6 +740,9 @@ static void feh_parse_option_array(int argc, char **argv) case 232: opt.index_show_dim = atoi(optarg); break; + case 233: + opt.thumb_redraw = atoi(optarg); + break; default: break; } @@ -963,6 +968,7 @@ void show_usage(void) " a new viewing window\n" " --cache-thumbnails Enable thumbnail caching for thumbnail mode.\n" " Only works with thumbnails <= 256x256 pixels\n" +" --thumb-redraw N Redraw thumbnail window every N images\n" " -~, --thumb-title STRING Set window title for images opened from thumbnail mode.\n" " Supports format specifiers, see there.\n" " -I, --fullindex Same as index mode, but below each thumbnail you\n" diff --git a/src/options.h b/src/options.h index 4a275e9..5d11816 100644 --- a/src/options.h +++ b/src/options.h @@ -109,6 +109,7 @@ struct __fehoptions { int thumb_h; int limit_w; int limit_h; + unsigned int thumb_redraw; int reload; int sort; int debug_level; diff --git a/src/thumbnail.c b/src/thumbnail.c index fe36213..aa45688 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -71,6 +71,7 @@ void init_thumbnail_mode(void) int index_image_width, index_image_height; int x_offset_name = 0, x_offset_dim = 0, x_offset_size = 0; char *s; + unsigned int thumb_counter = 0; /* initialize thumbnail mode data */ td.im_main = NULL; @@ -350,11 +351,19 @@ void init_thumbnail_mode(void) last = l; } if (opt.display) { - winwidget_render_image(winwid, 0, 0); + /* thumb_counter is unsigned, so no need to catch overflows */ + if (++thumb_counter == opt.thumb_redraw) { + winwidget_render_image(winwid, 0, 0); + thumb_counter = 0; + } if (!feh_main_iteration(0)) exit(0); } } + + if (thumb_counter != 0) + winwidget_render_image(winwid, 0, 0); + if (opt.verbose) fprintf(stdout, "\n"); -- cgit v1.2.3