diff options
author | Daniel Friesel <derf@finalrewind.org> | 2012-09-12 19:45:58 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2012-09-12 19:45:58 +0200 |
commit | 31c67831736e4bde3ef0d4dedb7c11dfc6649fdf (patch) | |
tree | cfbbb0904d41d8ac80aac3ab55f46a53f42be20c | |
parent | d3709b893f6ba8657759ad981af79ac3740e1c71 (diff) |
Proper workaround for broken gib_imlib_save_image_with_error_return
-rw-r--r-- | src/feh.h | 2 | ||||
-rw-r--r-- | src/imlib.c | 26 | ||||
-rw-r--r-- | src/slideshow.c | 8 |
3 files changed, 29 insertions, 7 deletions
@@ -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); |