From d3709b893f6ba8657759ad981af79ac3740e1c71 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 1 Sep 2012 19:42:11 +0200 Subject: Fix bug in thumbnail generation when used with 'feh .' It used to save the thumbnail for /path/to/./pmage.png, now it is always /path/to/image.png --- ChangeLog | 7 +++++++ src/thumbnail.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 10d855c..ee6bb53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +git HEAD + + * Fix freedesktop.org Thumbnail Managing Standard implementation: + when running feh on the current working directory, '/path/to/./image.png' + was used for thumbnail name generation. Now it is always + '/path/to/image.png' + Tue, 28 Aug 2012 11:46:19 +0200 Daniel Friesel * Release v2.6 diff --git a/src/thumbnail.c b/src/thumbnail.c index b26dc7f..c1081f3 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -596,6 +596,9 @@ char *feh_thumbnail_get_name_uri(char *name) /* FIXME: add support for ~, need to investigate if it's expanded somewhere else before adding (unecessary) code */ if (name[0] != '/') { + /* work around /some/path/./image.ext */ + if ((strncmp(name, "./", 2)) == 0) + name += 2; cwd = getcwd(NULL, 0); uri = estrjoin("/", "file:/", cwd, name, NULL); free(cwd); -- cgit v1.2.3 From 31c67831736e4bde3ef0d4dedb7c11dfc6649fdf Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 12 Sep 2012 19:45:58 +0200 Subject: Proper workaround for broken gib_imlib_save_image_with_error_return --- src/feh.h | 2 ++ src/imlib.c | 26 ++++++++++++++++++++++++++ src/slideshow.c | 8 +------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/feh.h b/src/feh.h index 2b0369f..2202617 100644 --- a/src/feh.h +++ b/src/feh.h @@ -158,6 +158,8 @@ void real_loadables_mode(int loadable); void feh_reload_image(winwidget w, int resize, int force_new); void feh_filelist_image_remove(winwidget winwid, char do_delete); void slideshow_save_image(winwidget win); +void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file, + Imlib_Load_Error * error_return); void feh_edit_inplace(winwidget w, int orientation); void feh_edit_inplace_lossless(winwidget w, int orientation); gib_list *feh_wrap_string(char *text, int wrap_width, Imlib_Font fn, gib_style * style); diff --git a/src/imlib.c b/src/imlib.c index af7acdd..5e423f3 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -129,6 +129,32 @@ int feh_load_image_char(Imlib_Image * im, char *filename) return(i); } +/* + * XXX gib_imlib_save_image_with_error_return breaks with *.END and + * similar because it tries to set the image format, which only works + * with .end . + * So we leave that part out. + */ +void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file, + Imlib_Load_Error * error_return) +{ + char *tmp; + imlib_context_set_image(im); + tmp = strrchr(file, '.'); + if (tmp) { + char *p, *pp; + p = gib_estrdup(tmp + 1); + pp = p; + while(*pp) { + *pp = tolower(*pp); + pp++; + } + imlib_image_set_format(p); + gib_efree(p); + } + imlib_save_image_with_error_return(file, error_return); +} + int feh_load_image(Imlib_Image * im, feh_file * file) { Imlib_Load_Error err; diff --git a/src/slideshow.c b/src/slideshow.c index cec146c..2e9c417 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -594,13 +594,7 @@ void slideshow_save_image(winwidget win) if (opt.verbose) printf("saving image to filename '%s'\n", tmpname); - /* XXX gib_imlib_save_image_with_error_return breaks with *.XXX and - * similar because it tries to set the image format, which only works - * with .xxx . - * So we leave that part out. - */ - imlib_context_set_image(win->im); - imlib_save_image_with_error_return(tmpname, &err); + ungib_imlib_save_image_with_error_return(win->im, tmpname, &err); if (err) im_weprintf(win, "Can't save image %s:", tmpname); -- cgit v1.2.3 From ed5b2d5aaf3024d23b131e008d92c7844858373c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 12 Sep 2012 20:02:52 +0200 Subject: Fix lossless rotate error message for non-JPEG images --- ChangeLog | 1 + src/imlib.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ee6bb53..53b6457 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ git HEAD when running feh on the current working directory, '/path/to/./image.png' was used for thumbnail name generation. Now it is always '/path/to/image.png' + * Show error message if lossless rotate / flip failed on non-JPEG image Tue, 28 Aug 2012 11:46:19 +0200 Daniel Friesel diff --git a/src/imlib.c b/src/imlib.c index 5e423f3..d89a5a4 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1000,6 +1000,7 @@ void feh_edit_inplace(winwidget w, int op) { int ret; Imlib_Image old; + Imlib_Load_Error err; if (!w->file || !w->file->data || !FEH_FILE(w->file->data)->filename) return; @@ -1019,8 +1020,11 @@ void feh_edit_inplace(winwidget w, int op) imlib_image_flip_horizontal(); } else gib_imlib_image_orientate(old, op); - gib_imlib_save_image(old, FEH_FILE(w->file->data)->filename); + ungib_imlib_save_image_with_error_return(old, + FEH_FILE(w->file->data)->filename, &err); gib_imlib_free_image(old); + if (err) + im_weprintf(w, "Failed to save image after operation"); feh_reload_image(w, 1, 1); } else { im_weprintf(w, "failed to load image from disk to edit it in place"); -- cgit v1.2.3 From 3e4d9f98c3c154b9c9aa6082b3d498e59dcb1e2e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 12 Sep 2012 20:24:42 +0200 Subject: show error message if -o / -O failed to save image --- ChangeLog | 1 + src/index.c | 8 ++++++-- src/thumbnail.c | 8 ++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53b6457..4f12946 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ git HEAD was used for thumbnail name generation. Now it is always '/path/to/image.png' * Show error message if lossless rotate / flip failed on non-JPEG image + * Show error message if -O / -o failed to save image Tue, 28 Aug 2012 11:46:19 +0200 Daniel Friesel diff --git a/src/index.c b/src/index.c index 023cba0..e5a93a4 100644 --- a/src/index.c +++ b/src/index.c @@ -35,6 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* TODO s/bit/lot */ void init_index_mode(void) { + Imlib_Load_Error err; Imlib_Image im_main; Imlib_Image im_temp; int w = 800, h = 600, ww = 0, hh = 0, www, hhh, xxx, yyy; @@ -326,8 +327,11 @@ void init_index_mode(void) else strncpy(output_buf, opt.output_file, 1024); - gib_imlib_save_image(im_main, output_buf); - if (opt.verbose) { + ungib_imlib_save_image_with_error_return(im_main, output_buf, &err); + if (err) { + weprintf("Cannot save image to %s", output_buf); + } + else if (opt.verbose) { int tw, th; tw = gib_imlib_image_get_width(im_main); diff --git a/src/thumbnail.c b/src/thumbnail.c index c1081f3..c622b07 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -55,6 +55,7 @@ void init_thumbnail_mode(void) int max_column_w = 0; */ + Imlib_Load_Error err; Imlib_Image im_temp; int ww = 0, hh = 0, www, hhh, xxx, yyy; int orig_w, orig_h; @@ -381,8 +382,11 @@ void init_thumbnail_mode(void) snprintf(output_buf, 1024, "%s/%s", opt.output_dir, opt.output_file); else strncpy(output_buf, opt.output_file, 1024); - gib_imlib_save_image(td.im_main, output_buf); - if (opt.verbose) { + ungib_imlib_save_image_with_error_return(td.im_main, output_buf, &err); + if (err) { + weprintf("Cannot save image to %s", output_buf); + } + else if (opt.verbose) { int tw, th; tw = gib_imlib_image_get_width(td.im_main); -- cgit v1.2.3 From 290b5964ef857ea52d85edf846edd82392d9a716 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 12 Sep 2012 20:46:15 +0200 Subject: print imlib2 error strings when save failed --- src/feh.h | 1 + src/imlib.c | 102 ++++++++++++++++++++++++++++++-------------------------- src/index.c | 2 +- src/slideshow.c | 2 +- src/thumbnail.c | 2 +- 5 files changed, 58 insertions(+), 51 deletions(-) diff --git a/src/feh.h b/src/feh.h index 2202617..cd730e9 100644 --- a/src/feh.h +++ b/src/feh.h @@ -157,6 +157,7 @@ void feh_display_status(char stat); void real_loadables_mode(int loadable); void feh_reload_image(winwidget w, int resize, int force_new); void feh_filelist_image_remove(winwidget winwid, char do_delete); +void feh_imlib_print_load_error(char *file, winwidget w, Imlib_Load_Error err); void slideshow_save_image(winwidget win); void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file, Imlib_Load_Error * error_return); diff --git a/src/imlib.c b/src/imlib.c index d89a5a4..3ffc538 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -155,6 +155,57 @@ void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file, imlib_save_image_with_error_return(file, error_return); } +void feh_imlib_print_load_error(char *file, winwidget w, Imlib_Load_Error err) +{ + if (err == IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS) + eprintf("%s - Out of file descriptors while loading", file); + else if (!opt.quiet || w) { + switch (err) { + case IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST: + im_weprintf(w, "%s - File does not exist", file); + break; + case IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY: + im_weprintf(w, "%s - Directory specified for image filename", file); + break; + case IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ: + im_weprintf(w, "%s - No read access", file); + break; + case IMLIB_LOAD_ERROR_UNKNOWN: + case IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT: + im_weprintf(w, "%s - No Imlib2 loader for that file format", file); + break; + case IMLIB_LOAD_ERROR_PATH_TOO_LONG: + im_weprintf(w, "%s - Path specified is too long", file); + break; + case IMLIB_LOAD_ERROR_PATH_COMPONENT_NON_EXISTANT: + im_weprintf(w, "%s - Path component does not exist", file); + break; + case IMLIB_LOAD_ERROR_PATH_COMPONENT_NOT_DIRECTORY: + im_weprintf(w, "%s - Path component is not a directory", file); + break; + case IMLIB_LOAD_ERROR_PATH_POINTS_OUTSIDE_ADDRESS_SPACE: + im_weprintf(w, "%s - Path points outside address space", file); + break; + case IMLIB_LOAD_ERROR_TOO_MANY_SYMBOLIC_LINKS: + im_weprintf(w, "%s - Too many levels of symbolic links", file); + break; + case IMLIB_LOAD_ERROR_OUT_OF_MEMORY: + im_weprintf(w, "While loading %s - Out of memory", file); + break; + case IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_WRITE: + im_weprintf(w, "%s - Cannot write to directory", file); + break; + case IMLIB_LOAD_ERROR_OUT_OF_DISK_SPACE: + im_weprintf(w, "%s - Cannot write - out of disk space", file); + break; + default: + im_weprintf(w, "While loading %s - Unknown error (%d)", + file, err); + break; + } + } +} + int feh_load_image(Imlib_Image * im, feh_file * file) { Imlib_Load_Error err; @@ -208,53 +259,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) fputs("\n", stdout); reset_output = 1; } - if (err == IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS) - eprintf("%s - Out of file descriptors while loading", file->filename); - else if (!opt.quiet) { - switch (err) { - case IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST: - weprintf("%s - File does not exist", file->filename); - break; - case IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY: - weprintf("%s - Directory specified for image filename", file->filename); - break; - case IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ: - weprintf("%s - No read access", file->filename); - break; - case IMLIB_LOAD_ERROR_UNKNOWN: - case IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT: - weprintf("%s - No Imlib2 loader for that file format", file->filename); - break; - case IMLIB_LOAD_ERROR_PATH_TOO_LONG: - weprintf("%s - Path specified is too long", file->filename); - break; - case IMLIB_LOAD_ERROR_PATH_COMPONENT_NON_EXISTANT: - weprintf("%s - Path component does not exist", file->filename); - break; - case IMLIB_LOAD_ERROR_PATH_COMPONENT_NOT_DIRECTORY: - weprintf("%s - Path component is not a directory", file->filename); - break; - case IMLIB_LOAD_ERROR_PATH_POINTS_OUTSIDE_ADDRESS_SPACE: - weprintf("%s - Path points outside address space", file->filename); - break; - case IMLIB_LOAD_ERROR_TOO_MANY_SYMBOLIC_LINKS: - weprintf("%s - Too many levels of symbolic links", file->filename); - break; - case IMLIB_LOAD_ERROR_OUT_OF_MEMORY: - weprintf("While loading %s - Out of memory", file->filename); - break; - case IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_WRITE: - weprintf("%s - Cannot write to directory", file->filename); - break; - case IMLIB_LOAD_ERROR_OUT_OF_DISK_SPACE: - weprintf("%s - Cannot write - out of disk space", file->filename); - break; - default: - weprintf("While loading %s - Unknown error (%d)", - file->filename, err); - break; - } - } + feh_imlib_print_load_error(file->filename, NULL, err) D(("Load *failed*\n")); return(0); } @@ -1024,7 +1029,8 @@ void feh_edit_inplace(winwidget w, int op) FEH_FILE(w->file->data)->filename, &err); gib_imlib_free_image(old); if (err) - im_weprintf(w, "Failed to save image after operation"); + feh_imlib_print_load_error(FEH_FILE(w->file->data)->filename, + w, err); feh_reload_image(w, 1, 1); } else { im_weprintf(w, "failed to load image from disk to edit it in place"); diff --git a/src/index.c b/src/index.c index e5a93a4..5d4ed39 100644 --- a/src/index.c +++ b/src/index.c @@ -329,7 +329,7 @@ void init_index_mode(void) ungib_imlib_save_image_with_error_return(im_main, output_buf, &err); if (err) { - weprintf("Cannot save image to %s", output_buf); + feh_imlib_print_load_error(output_buf, im_main, err); } else if (opt.verbose) { int tw, th; diff --git a/src/slideshow.c b/src/slideshow.c index 2e9c417..60bd99c 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -597,7 +597,7 @@ void slideshow_save_image(winwidget win) ungib_imlib_save_image_with_error_return(win->im, tmpname, &err); if (err) - im_weprintf(win, "Can't save image %s:", tmpname); + feh_imlib_print_load_error(tmpname, win, err); free(tmpname); return; diff --git a/src/thumbnail.c b/src/thumbnail.c index c622b07..fbe2ce0 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -384,7 +384,7 @@ void init_thumbnail_mode(void) strncpy(output_buf, opt.output_file, 1024); ungib_imlib_save_image_with_error_return(td.im_main, output_buf, &err); if (err) { - weprintf("Cannot save image to %s", output_buf); + feh_imlib_print_load_error(output_buf, td.im_main, err); } else if (opt.verbose) { int tw, th; -- cgit v1.2.3 From 3a1b07272aeff6397f74014cdeae2c129d608a94 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 13 Sep 2012 12:05:55 +0200 Subject: Show error message if normal load failed (broken by 2.4) + update tests --- ChangeLog | 4 +++- src/imlib.c | 8 +------- test/feh.t | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f12946..af57063 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -git HEAD +Thu, 13 Sep 2012 12:00:06 +0200 Daniel Friesel * Fix freedesktop.org Thumbnail Managing Standard implementation: when running feh on the current working directory, '/path/to/./image.png' @@ -6,6 +6,8 @@ git HEAD '/path/to/image.png' * Show error message if lossless rotate / flip failed on non-JPEG image * Show error message if -O / -o failed to save image + * Show error message if load failed and magick is disabled (was broken + by feh 2.4) Tue, 28 Aug 2012 11:46:19 +0200 Daniel Friesel diff --git a/src/imlib.c b/src/imlib.c index 3ffc538..b3abc8a 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -234,10 +234,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) tmpname = feh_magick_load_image(file->filename); } - if (image_source != SRC_IMLIB) { - if (tmpname == NULL) - return 0; - + if ((image_source != SRC_IMLIB) && tmpname) { *im = imlib_load_image_with_error_return(tmpname, &err); if (im) { real_filename = file->filename; @@ -336,9 +333,6 @@ static char *feh_magick_load_image(char *filename) if (WIFSIGNALED(status)) weprintf("%s - Conversion took too long, skipping", filename); - else - weprintf("%s - No loader for that file format", - filename); } /* diff --git a/test/feh.t b/test/feh.t index 8746362..1d5576b 100644 --- a/test/feh.t +++ b/test/feh.t @@ -33,7 +33,7 @@ if (length($feh_name) == 0) { } my $re_warning = - qr{${feh_name} WARNING: test/fail/... \- No loader for that file format\n}; + qr{${feh_name} WARNING: test/fail/... \- No Imlib2 loader for that file format\n}; my $re_loadable = qr{test/ok/...}; my $re_unloadable = qr{test/fail/...}; my $re_list_action = qr{test/ok/... 16x16}; -- cgit v1.2.3 From 7979f76dcd5d5e2340956f6ec3b9009e64648fc1 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 17 Sep 2012 15:20:47 +0200 Subject: Fix EXIF orientation tag after lossless rotate --- ChangeLog | 7 +++++++ man/feh.pre | 14 +++++++++++++- src/imlib.c | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index af57063..6cefc73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +git HEAD + + * Set EXIF orientation tag to 1 ("0,0 is top left" aka normal) after + running jpegtran. Previously, when doing a lossless rotate, the image + was rotated but the corresponding EXIF tag not updated, resulting in + wrong image display in programs aware of this EXIF tag. + Thu, 13 Sep 2012 12:00:06 +0200 Daniel Friesel * Fix freedesktop.org Thumbnail Managing Standard implementation: diff --git a/man/feh.pre b/man/feh.pre index e047286..5199151 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1106,6 +1106,16 @@ away. See .Xr jpegtran 1 for more about lossless JPEG rotation. . +.Em Note: +jpegtran does not update EXIF orientation tags. However, +.Nm +assumes that you use the feature to normalize image orientation and want it to +be displayed this way everywhere. After every rotation, it will unconditionally +set the EXIF orientation to 1 +.Pq Qq 0,0 is top left . +Should you need to reverse this, see +.Xr jpegexiforient 1 . +. .It _ Bq flip . In place editing - vertical flip @@ -1487,7 +1497,9 @@ but without the flickering. .Nm requires the .Cm jpegtran -binary +and +.Cm jpegexiforient +binaries .Pq usually distributed in Qo libjpeg-progs Qc or similar for lossless rotation. . diff --git a/src/imlib.c b/src/imlib.c index b3abc8a..f247bf7 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1137,6 +1137,7 @@ void feh_edit_inplace_lossless(winwidget w, int op) int len = strlen(filename) + 1; char *file_str = emalloc(len); int pid, status; + int devnull = -1; char op_name[] = "rotate"; /* message */ char op_op[] = "-rotate"; /* jpegtran option */ char op_value[] = "horizontal"; /* jpegtran option's value */ @@ -1156,14 +1157,16 @@ void feh_edit_inplace_lossless(winwidget w, int op) if ((pid = fork()) < 0) { im_weprintf(w, "lossless %s: fork failed:", op_name); exit(1); - } else if (pid == 0) { + } + else if (pid == 0) { execlp("jpegtran", "jpegtran", "-copy", "all", op_op, op_value, "-outfile", file_str, file_str, NULL); im_weprintf(w, "lossless %s: Is 'jpegtran' installed? Failed to exec:", op_name); exit(1); - } else { + } + else { waitpid(pid, &status, 0); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { @@ -1176,6 +1179,31 @@ void feh_edit_inplace_lossless(winwidget w, int op) return; } } + if ((pid = fork()) < 0) { + im_weprintf(w, "lossless %s: cannot fix rotation: fork:", op_name); + exit(1); + } + else if (pid == 0) { + + /* discard normal output */ + devnull = open("/dev/null", O_WRONLY); + dup2(devnull, 1); + + execlp("jpegexiforient", "jpegexiforient", "-1", file_str, NULL); + im_weprintf(w, "lossless %s: Failed to exec jpegexiforient:", op_name); + exit(1); + } + else { + waitpid(pid, &status, 0); + + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { + im_weprintf(w, + "lossless %s: Got exitcode %d from jpegexiforient", + status >> 8); + free(file_str); + return; + } + } free(file_str); } -- cgit v1.2.3 From b4838c78ac9336d2ec3c7e97df6153b6e6553826 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 21 Sep 2012 00:31:33 +0200 Subject: feh.1: Fix spelling --- man/feh.pre | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/man/feh.pre b/man/feh.pre index 5199151..fc45a3d 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -31,7 +31,7 @@ $MAN_XINERAMA$, builtin EXIF support $MAN_EXIF$$MAN_DEBUG$ .Sh DESCRIPTION . .Nm -is a mode-based image viewer. It is especially aimed at commandline users who +is a mode-based image viewer. It is especially aimed at command line users who need a fast image viewer without huge GUI dependencies, though it can also be started by .Pq graphical @@ -61,7 +61,7 @@ However, if you compile feh with exif=1, you can also display it directly. .Sh MODES . .Nm -is based on various modes, which are selected at startup by comandline +is based on various modes, which are selected at startup by command line options. . .Pp @@ -158,7 +158,7 @@ multiwindow mode, the window will be closed. . .It Cm --action1 No .. Cm --action9 . -Extra actions which can be set and triggered using the appropiate number key. +Extra actions which can be set and triggered using the appropriate number key. . .It Cm -Z , --auto-zoom . @@ -192,7 +192,7 @@ the caption will be looked for in Don't display images, print image info according to .Ar format instead. See -.Sx FORMAT SPECIFIEDRS . +.Sx FORMAT SPECIFIERS . . .It Cm --cycle-once . @@ -246,7 +246,7 @@ will be saved to .Ar file when .Nm -exits. You can add files to filelists by specifying them on the commandline +exits. You can add files to filelists by specifying them on the command line when also specifying the list. . .Pp @@ -287,7 +287,7 @@ Enables . Note: This option needs to load all images to calculate the dimensions of the .Nm -window, so when using it with many files it will ake a while before a +window, so when using it with many files it will take a while before a .Nm window is visible. Use .Cm --preload @@ -329,7 +329,7 @@ Accepted values: checks (default), white, black. .It Cm -i , --index . Enable Index mode. Index mode is similar to montage mode, and accepts the -same options. It creates an index print of thumbails, printing the image +same options. It creates an index print of thumbnails, printing the image name beneath each thumbnail. Index mode enables certain other options, see .Sx INDEX MODE OPTIONS and @@ -377,7 +377,7 @@ in the name. . .It Cm -l , --list . -Don't display images. Analyse them and display an +Don't display images. Analyze them and display an .Xr ls 1 - No style listing. Useful in scripts to hunt out images of a certain size/resolution/type etc. @@ -662,7 +662,7 @@ without displaying it. . Normally, if an image is smaller than the specified thumbnail size, it will not be enlarged. If this option is set, the image will be scaled up to fit -the thumnail size. Aspect ratio will be maintained unles +the thumbnail size. Aspect ratio will be maintained unless .Cm --ignore-aspect is specified. . @@ -715,7 +715,7 @@ can also be used as a background setter. Unless you pass the .Cm --no-fehbg option, it will store the command line necessary to set the background in .Pa ~/.fehbg , -so to have your background restored everytime you start X, you can add +so to have your background restored every time you start X, you can add .Qq eval $(cat ~/.fehbg) to your X startup script .Pq like Pa ~/.xinitrc . @@ -821,7 +821,7 @@ Number of image pixels . .It \&%P . -Numbor of image pixels +Number of image pixels .Pq kilopixels / megapixels . .It %r -- cgit v1.2.3 From 4c8120cb44c99a6488077688647ef192d455b2e7 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 21 Sep 2012 14:57:32 +0200 Subject: imlib.c: Fix debug builds (add missing semicolon) --- src/imlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imlib.c b/src/imlib.c index f247bf7..a2bd4ac 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -256,7 +256,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) fputs("\n", stdout); reset_output = 1; } - feh_imlib_print_load_error(file->filename, NULL, err) + feh_imlib_print_load_error(file->filename, NULL, err); D(("Load *failed*\n")); return(0); } -- cgit v1.2.3 From bf42f8df28abd8acbd115ffbd99fc2aefcb68ebf Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 21 Sep 2012 15:00:06 +0200 Subject: config.mk: Use -O0 for debug builds --- config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mk b/config.mk index 501ec89..ffbecfd 100644 --- a/config.mk +++ b/config.mk @@ -32,7 +32,7 @@ else endif ifeq (${debug},1) - CFLAGS += -DDEBUG + CFLAGS += -DDEBUG -O0 MAN_DEBUG = . This is a debug build. else MAN_DEBUG = -- cgit v1.2.3 From 8b47be4338c3d9e502838d7f67fe9003e17bb5b9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 22 Sep 2012 06:37:47 +0200 Subject: changelog --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6cefc73..2c4929b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ git HEAD running jpegtran. Previously, when doing a lossless rotate, the image was rotated but the corresponding EXIF tag not updated, resulting in wrong image display in programs aware of this EXIF tag. + * Fix spelling in feh(1) + * Compile debug builds with -O0 Thu, 13 Sep 2012 12:00:06 +0200 Daniel Friesel -- cgit v1.2.3 From 5f49aad473d97bdbdcfa70d78757d43d745f941e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 26 Sep 2012 17:07:06 +0200 Subject: version bump --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2c4929b..b05d7c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -git HEAD +Wed, 26 Sep 2012 17:06:50 +0200 Daniel Friesel * Set EXIF orientation tag to 1 ("0,0 is top left" aka normal) after running jpegtran. Previously, when doing a lossless rotate, the image -- cgit v1.2.3 From b928208c102a1b45ef82019c6e73b2577592381e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 27 Sep 2012 17:15:50 +0200 Subject: Fix lossless rotation if jpegexiforient is unavailable (closes #100) --- ChangeLog | 5 +++++ src/imlib.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b05d7c3..6cfe1aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu, 27 Sep 2012 16:48:48 +0200 Daniel Friesel + + * Fix segfault when doing lossless mirror/rotate and jpegexiforient is + not present + Wed, 26 Sep 2012 17:06:50 +0200 Daniel Friesel * Set EXIF orientation tag to 1 ("0,0 is top left" aka normal) after diff --git a/src/imlib.c b/src/imlib.c index a2bd4ac..e9f92ad 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1198,10 +1198,9 @@ void feh_edit_inplace_lossless(winwidget w, int op) if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { im_weprintf(w, - "lossless %s: Got exitcode %d from jpegexiforient", - status >> 8); - free(file_str); - return; + "lossless %s: Failed to update EXIF orientation tag:" + " jpegexiforient returned %d", + op_name, status >> 8); } } free(file_str); -- cgit v1.2.3 From 8caf865bf7468e335559218305a202425fa99162 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 13 Oct 2012 13:36:18 +0200 Subject: options.c: sort options by hexcode --- src/options.c | 410 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 205 insertions(+), 205 deletions(-) diff --git a/src/options.c b/src/options.c index 09ae5cc..5976c10 100644 --- a/src/options.c +++ b/src/options.c @@ -306,71 +306,65 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) /* (*name, has_arg, *flag, val) See: struct option in getopts.h */ static struct option lopts[] = { - {"help" , 0, 0, 'h'}, - {"version" , 0, 0, 'v'}, - {"montage" , 0, 0, 'm'}, - {"collage" , 0, 0, 'c'}, - {"index" , 0, 0, 'i'}, - {"fullindex" , 0, 0, 'I'}, - {"verbose" , 0, 0, 'V'}, - {"borderless" , 0, 0, 'x'}, - {"keep-http" , 0, 0, 'k'}, - {"stretch" , 0, 0, 's'}, - {"multiwindow" , 0, 0, 'w'}, - {"recursive" , 0, 0, 'r'}, - {"randomize" , 0, 0, 'z'}, - {"list" , 0, 0, 'l'}, - {"quiet" , 0, 0, 'q'}, - {"loadable" , 0, 0, 'U'}, - {"unloadable" , 0, 0, 'u'}, - {"no-menus" , 0, 0, 'N'}, + {"menu-bg" , 1, 0, ')'}, + {"debug" , 0, 0, '+'}, + {"scale-down" , 0, 0, '.'}, + {"title-font" , 1, 0, '@'}, + {"action" , 1, 0, 'A'}, + {"image-bg" , 1, 0, 'B'}, + {"fontpath" , 1, 0, 'C'}, + {"slideshow-delay",1, 0, 'D'}, + {"thumb-height" , 1, 0, 'E'}, {"full-screen" , 0, 0, 'F'}, /* deprecated */ {"fullscreen" , 0, 0, 'F'}, - {"auto-zoom" , 0, 0, 'Z'}, - {"ignore-aspect" , 0, 0, 'X'}, - {"draw-filename" , 0, 0, 'd'}, - {"preload" , 0, 0, 'p'}, - {"reverse" , 0, 0, 'n'}, - {"thumbnails" , 0, 0, 't'}, - {"scale-down" , 0, 0, '.'}, - {"no-jump-on-resort", 0, 0, 220}, - {"hide-pointer" , 0, 0, 'Y'}, {"draw-actions" , 0, 0, 'G'}, - {"cache-thumbnails", 0, 0, 'P'}, - {"cycle-once" , 0, 0, 224}, - {"no-xinerama" , 0, 0, 225}, - {"draw-tinted" , 0, 0, 229}, -#ifdef HAVE_LIBEXIF - {"draw-exif" , 0, 0, 223}, -#endif - - {"output" , 1, 0, 'o'}, - {"output-only" , 1, 0, 'O'}, - {"action" , 1, 0, 'A'}, - {"limit-width" , 1, 0, 'W'}, {"limit-height" , 1, 0, 'H'}, + {"fullindex" , 0, 0, 'I'}, + {"thumb-redraw" , 1, 0, 'J'}, + {"caption-path" , 1, 0, 'K'}, + {"customlist" , 1, 0, 'L'}, + {"menu-font" , 1, 0, 'M'}, + {"no-menus" , 0, 0, 'N'}, + {"output-only" , 1, 0, 'O'}, + {"cache-thumbnails", 0, 0, 'P'}, {"reload" , 1, 0, 'R'}, - {"alpha" , 1, 0, 'a'}, {"sort" , 1, 0, 'S'}, {"theme" , 1, 0, 'T'}, + {"loadable" , 0, 0, 'U'}, + {"verbose" , 0, 0, 'V'}, + {"limit-width" , 1, 0, 'W'}, + {"ignore-aspect" , 0, 0, 'X'}, + {"hide-pointer" , 0, 0, 'Y'}, + {"auto-zoom" , 0, 0, 'Z'}, + {"title" , 1, 0, '^'}, + {"alpha" , 1, 0, 'a'}, + {"bg" , 1, 0, 'b'}, + {"collage" , 0, 0, 'c'}, + {"draw-filename" , 0, 0, 'd'}, + {"font" , 1, 0, 'e'}, {"filelist" , 1, 0, 'f'}, - {"customlist" , 1, 0, 'L'}, {"geometry" , 1, 0, 'g'}, - {"menu-font" , 1, 0, 'M'}, + {"help" , 0, 0, 'h'}, + {"index" , 0, 0, 'i'}, + {"output-dir" , 1, 0, 'j'}, + {"keep-http" , 0, 0, 'k'}, + {"list" , 0, 0, 'l'}, + {"montage" , 0, 0, 'm'}, + {"reverse" , 0, 0, 'n'}, + {"output" , 1, 0, 'o'}, + {"preload" , 0, 0, 'p'}, + {"quiet" , 0, 0, 'q'}, + {"recursive" , 0, 0, 'r'}, + {"stretch" , 0, 0, 's'}, + {"thumbnails" , 0, 0, 't'}, + {"unloadable" , 0, 0, 'u'}, + {"version" , 0, 0, 'v'}, + {"multiwindow" , 0, 0, 'w'}, + {"borderless" , 0, 0, 'x'}, {"thumb-width" , 1, 0, 'y'}, - {"thumb-height" , 1, 0, 'E'}, - {"slideshow-delay",1, 0, 'D'}, - {"font" , 1, 0, 'e'}, - {"title-font" , 1, 0, '@'}, - {"title" , 1, 0, '^'}, - {"thumb-title" , 1, 0, '~'}, - {"bg" , 1, 0, 'b'}, - {"fontpath" , 1, 0, 'C'}, - {"menu-bg" , 1, 0, ')'}, - {"image-bg" , 1, 0, 'B'}, + {"randomize" , 0, 0, 'z'}, {"start-at" , 1, 0, '|'}, - {"debug" , 0, 0, '+'}, - {"output-dir" , 1, 0, 'j'}, + {"thumb-title" , 1, 0, '~'}, {"bg-tile" , 0, 0, 200}, {"bg-center" , 0, 0, 201}, {"bg-scale" , 0, 0, 202}, @@ -378,7 +372,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"no-screen-clip", 0, 0, 206}, {"index-info" , 1, 0, 207}, {"magick-timeout", 1, 0, 208}, - {"caption-path" , 1, 0, 'K'}, {"action1" , 1, 0, 209}, {"action2" , 1, 0, 210}, {"action3" , 1, 0, 211}, @@ -390,7 +383,13 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"action9" , 1, 0, 217}, {"bg-fill" , 0, 0, 218}, {"bg-max" , 0, 0, 219}, - {"thumb-redraw" , 1, 0, 'J'}, + {"no-jump-on-resort", 0, 0, 220}, +#ifdef HAVE_LIBEXIF + {"draw-exif" , 0, 0, 223}, +#endif + {"cycle-once" , 0, 0, 224}, + {"no-xinerama" , 0, 0, 225}, + {"draw-tinted" , 0, 0, 229}, {"info" , 1, 0, 234}, {"force-aliasing", 0, 0, 235}, {"no-fehbg" , 0, 0, 236}, @@ -405,32 +404,65 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) switch (optch) { case 0: break; - case 'h': - show_usage(); + case ')': + free(opt.menu_bg); + opt.menu_bg = estrdup(optarg); + weprintf("The --menu-bg option is deprecated and will be removed by 2012"); break; - case 'v': - show_version(); + case '+': + opt.debug = 1; break; - case 'm': - opt.index = 1; + case '.': + opt.scale_down = 1; break; - case 'c': - opt.collage = 1; + case '@': + opt.title_font = estrdup(optarg); break; - case 'i': - opt.index = 1; - opt.index_info = estrdup("%n"); + case 'A': + opt.actions[0] = estrdup(optarg); break; - case '.': - opt.scale_down = 1; + case 'B': + 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 'C': + D(("adding fontpath %s\n", optarg)); + imlib_add_path_to_font_path(optarg); + break; + case 'D': + opt.slideshow_delay = atof(optarg); + if (opt.slideshow_delay < 0.0) { + opt.slideshow_delay *= (-1); + opt.paused = 1; + } + break; + case 'E': + opt.thumb_h = atoi(optarg); + break; + case 'F': + opt.full_screen = 1; + break; + case 'G': + opt.draw_actions = 1; + break; + case 'H': + opt.limit_h = atoi(optarg); break; case 'I': opt.index = 1; opt.index_info = estrdup("%n\n%S\n%wx%h"); break; - case 'l': - opt.list = 1; - opt.display = 0; + case 'J': + opt.thumb_redraw = atoi(optarg); + break; + case 'K': + opt.caption_path = estrdup(optarg); break; case 'L': opt.customlist = estrdup(optarg); @@ -440,64 +472,19 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) free(opt.menu_font); opt.menu_font = estrdup(optarg); break; - case '+': - opt.debug = 1; - break; - case 'n': - opt.reverse = 1; - break; - case 'g': - opt.geom_flags = XParseGeometry(optarg, &opt.geom_x, &opt.geom_y, &opt.geom_w, &opt.geom_h); - break; case 'N': opt.no_menus = 1; break; - case 'V': - opt.verbose = 1; - break; - case 'q': - opt.quiet = 1; - break; - case 'x': - opt.borderless = 1; - break; - case 'k': - opt.keep_http = 1; - break; - case 's': - opt.stretch = 1; - break; - case 'w': - opt.multiwindow = 1; - break; - case 'r': - opt.recursive = 1; - break; - case 'z': - opt.randomize = 1; - break; - case 'd': - opt.draw_filename = 1; - break; - case 'F': - opt.full_screen = 1; - break; - case 'Z': - opt.zoom_mode = ZOOM_MODE_MAX; - break; - case 'U': - opt.loadables = 1; - opt.display = 0; - break; - case 'u': - opt.unloadables = 1; + case 'O': + opt.output = 1; + opt.output_file = estrdup(optarg); opt.display = 0; break; - case 'p': - opt.preload = 1; + case 'P': + opt.cache_thumbnails = 1; break; - case 'X': - opt.aspect = 0; + case 'R': + opt.reload = atof(optarg); break; case 'S': if (!strcasecmp(optarg, "name")) @@ -520,97 +507,125 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.sort = SORT_FILENAME; } break; - case 'o': - opt.output = 1; - opt.output_file = estrdup(optarg); + case 'T': + theme = estrdup(optarg); break; - case 'O': - opt.output = 1; - opt.output_file = estrdup(optarg); + case 'U': + opt.loadables = 1; opt.display = 0; break; - case 'T': - theme = estrdup(optarg); + case 'V': + opt.verbose = 1; break; - case 'C': - D(("adding fontpath %s\n", optarg)); - imlib_add_path_to_font_path(optarg); + case 'W': + opt.limit_w = atoi(optarg); break; - case 'e': - opt.font = estrdup(optarg); + case 'X': + opt.aspect = 0; break; - case '@': - opt.title_font = estrdup(optarg); + case 'Y': + opt.hide_pointer = 1; + break; + case 'Z': + opt.zoom_mode = ZOOM_MODE_MAX; break; case '^': opt.title = estrdup(optarg); break; - case '~': - opt.thumb_title = estrdup(optarg); + case 'a': + opt.alpha = 1; + opt.alpha_level = 255 - atoi(optarg); break; case 'b': opt.bg = 1; opt.bg_file = estrdup(optarg); break; - case 'A': - opt.actions[0] = estrdup(optarg); + case 'c': + opt.collage = 1; break; - case 'W': - opt.limit_w = atoi(optarg); + case 'd': + opt.draw_filename = 1; break; - case 'H': - opt.limit_h = atoi(optarg); + case 'e': + opt.font = estrdup(optarg); break; - case 'y': - opt.thumb_w = atoi(optarg); + case 'f': + if (!strcmp(optarg, "-")) + opt.filelistfile = estrdup("/dev/stdin"); + else + opt.filelistfile = estrdup(optarg); break; - case 'E': - opt.thumb_h = atoi(optarg); + case 'g': + opt.geom_flags = XParseGeometry(optarg, &opt.geom_x, + &opt.geom_y, &opt.geom_w, &opt.geom_h); break; - case ')': - free(opt.menu_bg); - opt.menu_bg = estrdup(optarg); - weprintf("The --menu-bg option is deprecated and will be removed by 2012"); + case 'h': + show_usage(); break; - case 'B': - 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); + case 'i': + opt.index = 1; + opt.index_info = estrdup("%n"); break; - case 'D': - opt.slideshow_delay = atof(optarg); - if (opt.slideshow_delay < 0.0) { - opt.slideshow_delay *= (-1); - opt.paused = 1; - } + case 'j': + opt.output_dir = estrdup(optarg); break; - case 'R': - opt.reload = atof(optarg); + case 'k': + opt.keep_http = 1; break; - case 'a': - opt.alpha = 1; - opt.alpha_level = 255 - atoi(optarg); + case 'l': + opt.list = 1; + opt.display = 0; break; - case 'f': - if (!strcmp(optarg, "-")) - opt.filelistfile = estrdup("/dev/stdin"); - else - opt.filelistfile = estrdup(optarg); + case 'm': + opt.index = 1; break; - case '|': - opt.start_list_at = estrdup(optarg); + case 'n': + opt.reverse = 1; + break; + case 'o': + opt.output = 1; + opt.output_file = estrdup(optarg); + break; + case 'p': + opt.preload = 1; + break; + case 'q': + opt.quiet = 1; + break; + case 'r': + opt.recursive = 1; + break; + case 's': + opt.stretch = 1; break; case 't': opt.thumbs = 1; opt.index_info = estrdup("%n"); break; - case 'j': - opt.output_dir = estrdup(optarg); + case 'u': + opt.unloadables = 1; + opt.display = 0; + break; + case 'v': + show_version(); + break; + case 'w': + opt.multiwindow = 1; + break; + case 'x': + opt.borderless = 1; + break; + case 'y': + opt.thumb_w = atoi(optarg); + break; + case 'z': + opt.randomize = 1; + break; + case '|': + opt.start_list_at = estrdup(optarg); + break; + case '~': + opt.thumb_title = estrdup(optarg); break; case 200: opt.bgmode = BG_MODE_TILE; @@ -621,12 +636,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 202: opt.bgmode = BG_MODE_SCALE; break; - case 218: - opt.bgmode = BG_MODE_FILL; - break; - case 219: - opt.bgmode = BG_MODE_MAX; - break; case 205: if (!strcmp("fill", optarg)) opt.zoom_mode = ZOOM_MODE_FILL; @@ -644,9 +653,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 208: opt.magick_timeout = atoi(optarg); break; - case 'K': - opt.caption_path = estrdup(optarg); - break; case 209: opt.actions[1] = estrdup(optarg); break; @@ -674,17 +680,14 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 217: opt.actions[9] = estrdup(optarg); break; - case 220: - opt.jump_on_resort = 0; - break; - case 'Y': - opt.hide_pointer = 1; + case 218: + opt.bgmode = BG_MODE_FILL; break; - case 'G': - opt.draw_actions = 1; + case 219: + opt.bgmode = BG_MODE_MAX; break; - case 'P': - opt.cache_thumbnails = 1; + case 220: + opt.jump_on_resort = 0; break; #ifdef HAVE_LIBEXIF case 223: @@ -700,9 +703,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 229: opt.text_bg = TEXT_BG_TINTED; break; - case 'J': - opt.thumb_redraw = atoi(optarg); - break; case 234: opt.info_cmd = estrdup(optarg); opt.draw_info = 1; -- cgit v1.2.3 From 906ec657cdd958b25a6833f644a57bcf08c3a38b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 13 Oct 2012 16:26:53 +0200 Subject: Add --min-dimension and --max-dimension options (closes #101) --- ChangeLog | 5 +++++ man/feh.pre | 22 ++++++++++++++++++++++ src/filelist.c | 10 +++++++++- src/options.c | 13 +++++++++++-- src/options.h | 2 ++ test/feh.t | 31 ++++++++++++++++++++++++++++--- test/no-loadable-files | 2 ++ 7 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 test/no-loadable-files diff --git a/ChangeLog b/ChangeLog index 6cfe1aa..0f2e77a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +git HEAD + + * Add --min-dim and --max-dim options to only process images with certain + dimensions + Thu, 27 Sep 2012 16:48:48 +0200 Daniel Friesel * Fix segfault when doing lossless mirror/rotate and jpegexiforient is diff --git a/man/feh.pre b/man/feh.pre index fc45a3d..8ef5318 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -397,6 +397,15 @@ of zero causes .Nm to try indefinitely. By default, magick support is disabled. . +.It Cm --max-dimension Ar width No x Ar height +. +Only show images with width <= +.Ar width +and height <= +.Ar height . +If you only care about one parameter, set the other to either something large +or -1. +. .It Cm -M , --menu-font Ar font . Use @@ -404,6 +413,14 @@ Use .Pq truetype, with size, like Qq yudit/12 as menu font. . +.It Cm --min-dimension Ar width No x Ar height +. +Only show images with width >= +.Ar width +and height >= +.Ar height . +If you only care about one parameter, set the other to 0. +. .It Cm -m , --montage . Enable montage mode. Montage mode creates a new image consisting of a grid of @@ -1463,6 +1480,11 @@ Same as above . Show some EXIF information, extracted by exifprobe/exifgrep . +.It feh --action 'rm %F' -rl --max-dim 1000x800 +. +Resursively remove all images with dimensions below or equal to 1000x800 pixels +from the current directory. +. .El . . diff --git a/src/filelist.c b/src/filelist.c index 920a5ef..542dbdf 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -281,6 +281,13 @@ gib_list *feh_file_info_preload(gib_list * list) remove_list = gib_list_add_front(remove_list, l); if (opt.verbose) feh_display_status('x'); + } else if (((unsigned int)file->info->width < opt.min_width) + || ((unsigned int)file->info->width > opt.max_width) + || ((unsigned int)file->info->height < opt.min_height) + || ((unsigned int)file->info->height > opt.max_height)) { + remove_list = gib_list_add_front(remove_list, l); + if (opt.verbose) + feh_display_status('s'); } else if (opt.verbose) feh_display_status('.'); } @@ -375,7 +382,8 @@ int feh_cmp_format(void *file1, void *file2) void feh_prepare_filelist(void) { if (opt.list || opt.customlist || (opt.sort > SORT_FILENAME) - || opt.preload) { + || opt.preload || opt.min_width || opt.min_height + || (opt.max_width != UINT_MAX) || (opt.max_height != UINT_MAX)) { /* For these sort options, we have to preload images */ filelist = feh_file_info_preload(filelist); if (!gib_list_length(filelist)) diff --git a/src/options.c b/src/options.c index 5976c10..240b0d6 100644 --- a/src/options.c +++ b/src/options.c @@ -60,6 +60,7 @@ void init_parse_options(int argc, char **argv) opt.menu_font = estrdup(DEFAULT_MENU_FONT); opt.font = NULL; opt.menu_bg = estrdup(PREFIX "/share/feh/images/menubg_default.png"); + opt.max_height = opt.max_width = UINT_MAX; opt.start_list_at = NULL; opt.jump_on_resort = 1; @@ -300,15 +301,18 @@ static void feh_getopt_theme(int argc, char **argv) static void feh_parse_option_array(int argc, char **argv, int finalrun) { + int discard; static char stropts[] = "a:A:b:B:cC:dD:e:E:f:Fg:GhH:iIj:J:kK:lL:mM:nNo:O:pPqrR:sS:tT:uUvVwW:xXy:YzZ" - ".@:^:~:):|:+:"; + ".@:^:~:):|:+:<:>:"; /* (*name, has_arg, *flag, val) See: struct option in getopts.h */ static struct option lopts[] = { {"menu-bg" , 1, 0, ')'}, {"debug" , 0, 0, '+'}, {"scale-down" , 0, 0, '.'}, + {"max-dimension" , 1, 0, '<'}, + {"min-dimension" , 1, 0, '>'}, {"title-font" , 1, 0, '@'}, {"action" , 1, 0, 'A'}, {"image-bg" , 1, 0, 'B'}, @@ -398,7 +402,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) }; int optch = 0, cmdx = 0; - /* Now to pass some optionarinos */ while ((optch = getopt_long(argc, argv, stropts, lopts, &cmdx)) != EOF) { D(("Got option, getopt calls it %d, or %c\n", optch, optch)); switch (optch) { @@ -412,6 +415,12 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case '+': opt.debug = 1; break; + case '<': + XParseGeometry(optarg, &discard, &discard, &opt.max_width, &opt.max_height); + break; + case '>': + XParseGeometry(optarg, &discard, &discard, &opt.min_width, &opt.min_height); + break; case '.': opt.scale_down = 1; break; diff --git a/src/options.h b/src/options.h index a763642..d30c396 100644 --- a/src/options.h +++ b/src/options.h @@ -109,6 +109,8 @@ struct __fehoptions { int zoom_mode; unsigned char adjust_reload; + unsigned int min_width, min_height, max_width, max_height; + unsigned char mode; unsigned char paused; diff --git a/test/feh.t b/test/feh.t index 1d5576b..8f415f3 100644 --- a/test/feh.t +++ b/test/feh.t @@ -2,13 +2,14 @@ use strict; use warnings; use 5.010; -use Test::Command tests => 59; +use Test::Command tests => 71; $ENV{HOME} = 'test'; my $feh = "src/feh"; -my $images = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm ' - . 'test/fail/gif test/fail/jpg test/fail/png test/fail/pnm'; +my $images_ok = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm'; +my $images_fail = 'test/fail/gif test/fail/jpg test/fail/png test/fail/pnm'; +my $images = "${images_ok} ${images_fail}"; my $feh_name = $ENV{'PACKAGE'}; @@ -133,3 +134,27 @@ $cmd = Test::Command->new(cmd => $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/default'); $cmd->stderr_like($re_list_action); + +$cmd = Test::Command->new(cmd => "$feh --list --min-dimension 20x20 $images_ok"); + +$cmd->exit_is_num(1); +$cmd->stdout_is_eq(''); +$cmd->stderr_is_file('test/no-loadable-files'); + +$cmd = Test::Command->new(cmd => "$feh --list --max-dimension 10x10 $images_ok"); + +$cmd->exit_is_num(1); +$cmd->stdout_is_eq(''); +$cmd->stderr_is_file('test/no-loadable-files'); + +$cmd = Test::Command->new(cmd => "$feh --list --min-dimension 16x16 $images_ok"); + +$cmd->exit_is_num(0); +$cmd->stdout_is_file('test/list/default'); +$cmd->stderr_is_eq(''); + +$cmd = Test::Command->new(cmd => "$feh --list --max-dimension 16x16 $images_ok"); + +$cmd->exit_is_num(0); +$cmd->stdout_is_file('test/list/default'); +$cmd->stderr_is_eq(''); diff --git a/test/no-loadable-files b/test/no-loadable-files new file mode 100644 index 0000000..bc5871d --- /dev/null +++ b/test/no-loadable-files @@ -0,0 +1,2 @@ +feh: No loadable images specified. +See 'man feh' for detailed usage information -- cgit v1.2.3 From 4b64d3a827c38725d454964823abc69b8f77b7ef Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 16 Oct 2012 06:31:10 +0200 Subject: version bump --- ChangeLog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0f2e77a..84e6fc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,18 @@ -git HEAD +Tue, 16 Oct 2012 06:29:58 +0200 Daniel Friesel +* Release v2.7 * Add --min-dim and --max-dim options to only process images with certain dimensions Thu, 27 Sep 2012 16:48:48 +0200 Daniel Friesel +* Release v2.6.3 * Fix segfault when doing lossless mirror/rotate and jpegexiforient is not present Wed, 26 Sep 2012 17:06:50 +0200 Daniel Friesel +* Release v2.6.2 * Set EXIF orientation tag to 1 ("0,0 is top left" aka normal) after running jpegtran. Previously, when doing a lossless rotate, the image was rotated but the corresponding EXIF tag not updated, resulting in @@ -19,6 +22,7 @@ Wed, 26 Sep 2012 17:06:50 +0200 Daniel Friesel Thu, 13 Sep 2012 12:00:06 +0200 Daniel Friesel +* Release v2.6.1 * Fix freedesktop.org Thumbnail Managing Standard implementation: when running feh on the current working directory, '/path/to/./image.png' was used for thumbnail name generation. Now it is always -- cgit v1.2.3 From 16654adff8ebd584bc93c4798b4e997dd286976e Mon Sep 17 00:00:00 2001 From: Rob Cornish Date: Wed, 17 Oct 2012 19:24:31 +1100 Subject: Add --image-bg option for wallpaper border Previously feh would set a black background around wallpaper images, with no option to change. This commit extends the functionality offered by the --image-bg option, which is available for regular image viewing, to centered and max'ed feh backgrounds. Essentially, this means a white border can now be chosen in addition to a black one. --- src/wallpaper.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/wallpaper.c b/src/wallpaper.c index 8a4cafb..df78303 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -257,6 +257,8 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, char *home; char filbuf[4096]; char fehbg_xinerama[] = "--no-xinerama"; + char *bgfill = NULL; + bgfill = opt.image_bg == IMAGE_BG_WHITE ? "--image-bg white" : "--image-bg black" ; /* local display to set closedownmode on */ Display *disp2; @@ -326,7 +328,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, D(("centering\n")); pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); - gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); + if (opt.image_bg == IMAGE_BG_WHITE) + gcval.foreground = WhitePixel(disp, DefaultScreen(disp)); + else + gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); gc = XCreateGC(disp, root, GCForeground, &gcval); XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height); @@ -343,7 +348,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XFreeGC(disp, gc); - fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-center", filbuf, NULL); + fehbg = estrjoin(" ", "feh", fehbg_xinerama, bgfill, "--bg-center", filbuf, NULL); } else if (filled == 1) { @@ -366,6 +371,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XGCValues gcval; pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); + if (opt.image_bg == IMAGE_BG_WHITE) + gcval.foreground = WhitePixel(disp, DefaultScreen(disp)); + else + gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); gc = XCreateGC(disp, root, GCForeground, &gcval); XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height); @@ -383,7 +392,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XFreeGC(disp, gc); - fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-max", filbuf, NULL); + fehbg = estrjoin(" ", "feh", fehbg_xinerama, bgfill, "--bg-max", filbuf, NULL); } else { if (use_filelist) -- cgit v1.2.3 From 7c00adf853acc76520d43a12eb63ec151924d5ab Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 23 Oct 2012 17:42:12 +0200 Subject: Do not apply --scale-down to a thumbnail window (#106) --- man/feh.pre | 6 ++++-- src/winwidget.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/man/feh.pre b/man/feh.pre index 8ef5318..c60e15a 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -558,8 +558,10 @@ theme. Same as Index mode, but the thumbnails are clickable image launchers. Note that .Cm --fullscreen -does not affect the thumbnail window. It does, however, work for the image -windows launched from thumbnail mode. +and +.Cm --scale-down +do not affect the thumbnail window. They do, however, work for image windows +launched from thumbnail mode. Also supports .Sx MONTAGE MODE OPTIONS . . diff --git a/src/winwidget.c b/src/winwidget.c index 0a9adc8..2f543df 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -402,6 +402,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) if (!winwid->full_screen && opt.scale_down && ((winwid->w < winwid->im_w) || (winwid->h < winwid->im_h)) && + (winwid->type != WIN_TYPE_THUMBNAIL) && (winwid->old_zoom == 1.0)) { D(("scaling down image %dx%d\n", winwid->w, winwid->h)); @@ -512,7 +513,8 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) winwid->im_y = (int) (max_h - (winwid->im_h * winwid->zoom)) >> 1; } } - else if (need_center && !winwid->full_screen && opt.scale_down) { + else if (need_center && !winwid->full_screen && opt.scale_down + && (winwid->type != WIN_TYPE_THUMBNAIL)) { winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1; winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1; } -- cgit v1.2.3 From 96d57781be7171d29c7ea0ecbbddc48ad374885c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 26 Oct 2012 17:17:43 +0200 Subject: changelog --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 84e6fc1..9645aaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +git HEAD + + * Do not apply --scale-down to the thumbnail window. It will be applied + to windows opened from this, though. + * Patch by Rob Cornish: Respect --image-bg when setting a wallpaper + Tue, 16 Oct 2012 06:29:58 +0200 Daniel Friesel * Release v2.7 -- cgit v1.2.3