From 4eb72706ebd0635d23e96bdde7b6f9612d18d4c5 Mon Sep 17 00:00:00 2001 From: ulteq Date: Wed, 22 Aug 2018 10:56:17 +0200 Subject: Add an option to disable inplace edit --- src/imlib.c | 16 ++++++++++++++++ src/options.c | 4 ++++ src/options.h | 1 + 3 files changed, 21 insertions(+) (limited to 'src') diff --git a/src/imlib.c b/src/imlib.c index f41cdcd..91b635e 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1192,6 +1192,22 @@ void feh_edit_inplace(winwidget w, int op) if (!w->file || !w->file->data || !FEH_FILE(w->file->data)->filename) return; + if (opt.no_inplace_edit) { + imlib_context_set_image(w->im); + if (op == INPLACE_EDIT_FLIP) + imlib_image_flip_vertical(); + else if (op == INPLACE_EDIT_MIRROR) + imlib_image_flip_horizontal(); + else { + imlib_image_orientate(op); + tmp = w->im_w; + FEH_FILE(w->file->data)->info->width = w->im_w = w->im_h; + FEH_FILE(w->file->data)->info->height = w->im_h = tmp; + } + winwidget_render_image(w, 1, 0); + return; + } + if (!strcmp(gib_imlib_image_format(w->im), "jpeg") && !path_is_url(FEH_FILE(w->file->data)->filename)) { feh_edit_inplace_lossless(w, op); diff --git a/src/options.c b/src/options.c index af0f07d..d3066ef 100644 --- a/src/options.c +++ b/src/options.c @@ -418,6 +418,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"conversion-timeout" , 1, 0, 245}, {"version-sort" , 0, 0, 246}, {"offset" , 1, 0, 247}, + {"no-inplace-edit", 0, 0, 248}, {0, 0, 0, 0} }; int optch = 0, cmdx = 0; @@ -795,6 +796,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.offset_flags = XParseGeometry(optarg, &opt.offset_x, &opt.offset_y, (unsigned int *)&discard, (unsigned int *)&discard); break; + case 248: + opt.no_inplace_edit = 1; + break; default: break; } diff --git a/src/options.h b/src/options.h index 936b4bd..bd2dfad 100644 --- a/src/options.h +++ b/src/options.h @@ -105,6 +105,7 @@ struct __fehoptions { double reload; int sort; int version_sort; + int no_inplace_edit; int debug; int geom_enabled; int geom_flags; -- cgit v1.2.3 From ecb763d0f8d921d256772e40e5d6116344884346 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 17 Sep 2018 21:45:54 +0200 Subject: Release v2.28 --- ChangeLog | 14 ++++++++++++++ src/help.raw | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index 901afc0..3a5d884 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Mon, 17 Sep 2018 21:17:04 +0200 Daniel Friesel + +* Release v2.28 + * Decrease loading time for RAW images by utilizing dcraw to display the + embedded JPEG preview (patch by ) + * Rename --magick-timeout to --conversion-timeout. --magick-timeout is + now deprecated and will be removed in a future release + * Fix unintened aliasing in rotated images whose rotation is not a + multiple of 90 degrees (patch by ) + * New option: --on-last-slide=hold|quit|resume. + hold replaces --no-cycle (which is now deprecated), quit will cause feh + to quit after the last slide (patch by ), + resume is the default (continue at the first image) + Tue, 17 Jul 2018 17:33:10 +0200 Daniel Friesel * Release v2.27.1 diff --git a/src/help.raw b/src/help.raw index ebffae3..c8de3d7 100644 --- a/src/help.raw +++ b/src/help.raw @@ -91,8 +91,8 @@ OPTIONS --no-xinerama Disable Xinerama support --no-screen-clip Do not limit window size to screen size -Y, --hide-pointer Hide the pointer - --magick-timeout INT Load unknown files with ImageMagick, timeout after - INT seconds (0: no timeout) + --conversion-timeout INT Load unknown files with dcraw or ImageMagick, + timeout after INT seconds (0: no timeout) --min-dimension WxH Only show images with width >= W and height >= H --max-dimension WxH Only show images with width <= W and height <= H --scroll-step COUNT scroll COUNT pixels when movement key is pressed -- cgit v1.2.3 From a9d46da64d02561bf2f545b3271575b304eda913 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 20 Sep 2018 21:27:39 +0200 Subject: Handle SIGTERM, SIGINT, SIGQUIT during preload --- src/filelist.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/filelist.c b/src/filelist.c index b492965..fc9fa35 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -37,6 +37,7 @@ gib_list *original_file_items = NULL; /* original file items from argv */ int filelist_len = 0; gib_list *current_file = NULL; extern int errno; +extern int sig_exit; /* exit flag from signal handler */ static gib_list *rm_filelist = NULL; @@ -327,6 +328,10 @@ gib_list *feh_file_info_preload(gib_list * list) feh_display_status('s'); } else if (opt.verbose) feh_display_status('.'); + if (sig_exit) { + feh_display_status(0); + exit(sig_exit); + } } if (opt.verbose) feh_display_status(0); -- cgit v1.2.3 From fb1cfca824b9229e110386e35112a0ad8f552553 Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Tue, 2 Oct 2018 23:36:29 +0200 Subject: Actually remove collage mode after ~7 years. --- src/Makefile | 1 - src/collage.c | 208 --------------------------------------------------------- src/feh.h | 1 - src/filelist.c | 2 +- src/main.c | 2 - src/options.c | 12 +--- src/options.h | 1 - test/status | 2 - 8 files changed, 2 insertions(+), 227 deletions(-) delete mode 100644 src/collage.c (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 8a9f97e..ac4d2fe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,6 @@ include ../config.mk TARGETS = \ - collage.c \ events.c \ feh_png.c \ filelist.c \ diff --git a/src/collage.c b/src/collage.c deleted file mode 100644 index 2a4d9f9..0000000 --- a/src/collage.c +++ /dev/null @@ -1,208 +0,0 @@ -/* collage.c - -Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2018 Daniel Friesel. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies of the Software and its documentation and acknowledgment shall be -given in the documentation and software packages that this Software was -used. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ - -#include "feh.h" -#include "winwidget.h" -#include "filelist.h" -#include "options.h" - -void init_collage_mode(void) -{ - Imlib_Image im_main; - Imlib_Image im_temp; - int ww, hh, www, hhh, xxx, yyy; - int w = 800, h = 600; - int bg_w = 0, bg_h = 0; - winwidget winwid = NULL; - Imlib_Image bg_im = NULL, im_thumb = NULL; - feh_file *file = NULL; - unsigned char trans_bg = 0; - gib_list *l, *last = NULL; - - mode = "collage"; - - weprintf("the --collage option (aka collage mode) is deprecated\n" - "and will be removed soon\n"); - - /* Use bg image dimensions for default size */ - if (opt.bg && opt.bg_file) { - if (!strcmp(opt.bg_file, "trans")) - trans_bg = 1; - else { - - D(("Time to apply a background to blend onto\n")); - if (feh_load_image_char(&bg_im, opt.bg_file) != 0) { - bg_w = gib_imlib_image_get_width(bg_im); - bg_h = gib_imlib_image_get_height(bg_im); - } - } - } - - if (!opt.limit_w || !opt.limit_h) { - if (bg_im) { - if (opt.verbose) - fputs(PACKAGE - ": No size restriction specified for collage.\n" - " You did specify a background however, so the\n" - " collage size has defaulted to the size of the image\n", - stderr); - opt.limit_w = bg_w; - opt.limit_h = bg_h; - } else { - if (opt.verbose) - fputs(PACKAGE - ": No size restriction specified for collage.\n" - " - For collage mode, you need to specify width and height.\n" - " Using defaults (width 800, height 600)\n", - stderr); - opt.limit_w = 800; - opt.limit_h = 600; - } - } - - w = opt.limit_w; - h = opt.limit_h; - D(("Limiting width to %d and height to %d\n", w, h)); - - im_main = imlib_create_image(w, h); - - if (!im_main) - eprintf("Imlib error creating image"); - - if (bg_im) - gib_imlib_blend_image_onto_image(im_main, bg_im, - gib_imlib_image_has_alpha(bg_im), 0, 0, - bg_w, bg_h, 0, 0, w, h, 1, 0, 0); - else if (trans_bg) { - gib_imlib_image_fill_rectangle(im_main, 0, 0, w, h, 0, 0, 0, 0); - gib_imlib_image_set_has_alpha(im_main, 1); - } else { - /* Colour the background */ - gib_imlib_image_fill_rectangle(im_main, 0, 0, w, h, 0, 0, 0, 255); - } - - if (opt.display) { - winwid = winwidget_create_from_image(im_main, WIN_TYPE_SINGLE); - winwidget_rename(winwid, PACKAGE " [collage mode]"); - winwidget_show(winwid); - } - - for (l = filelist; l; l = l->next) { - file = FEH_FILE(l->data); - if (last) { - filelist = feh_file_remove_from_list(filelist, last); - last = NULL; - } - D(("About to load image %s\n", file->filename)); - if (feh_load_image(&im_temp, file) != 0) { - D(("Successfully loaded %s\n", file->filename)); - if (opt.verbose) - feh_display_status('.'); - www = opt.thumb_w; - hhh = opt.thumb_h; - ww = gib_imlib_image_get_width(im_temp); - hh = gib_imlib_image_get_height(im_temp); - - if (opt.aspect) { - double ratio = 0.0; - - /* Keep the aspect ratio for the thumbnail */ - ratio = ((double) ww / hh) / ((double) www / hhh); - - if (ratio > 1.0) - hhh = opt.thumb_h / ratio; - else if (ratio != 1.0) - www = opt.thumb_w * ratio; - } - - if ((!opt.stretch) && ((www > ww) || (hhh > hh))) { - /* Don't make the image larger unless stretch is specified */ - www = ww; - hhh = hh; - } - - /* pick random coords for thumbnail */ - xxx = ((w - www) * ((double) rand() / RAND_MAX)); - yyy = ((h - hhh) * ((double) rand() / RAND_MAX)); - D(("image going on at x=%d, y=%d\n", xxx, yyy)); - - im_thumb = gib_imlib_create_cropped_scaled_image(im_temp, - 0, 0, ww, hh, www, hhh, 1); - gib_imlib_free_image_and_decache(im_temp); - - if (opt.alpha) { - DATA8 atab[256]; - - D(("Applying alpha options\n")); - gib_imlib_image_set_has_alpha(im_thumb, 1); - memset(atab, opt.alpha_level, sizeof(atab)); - gib_imlib_apply_color_modifier_to_rectangle(im_thumb, - 0, 0, www, hhh, NULL, NULL, NULL, atab); - } - gib_imlib_blend_image_onto_image(im_main, im_thumb, - gib_imlib_image_has_alpha(im_thumb), 0, 0, www, hhh, xxx, - yyy,www, hhh, 1, gib_imlib_image_has_alpha(im_thumb), 0); - gib_imlib_free_image_and_decache(im_thumb); - } else { - last = l; - if (opt.verbose) - feh_display_status('x'); - } - if (opt.display) { - winwidget_render_image(winwid, 0, 0); - if (!feh_main_iteration(0)) - exit(0); - } - } - if (opt.verbose) - fputs("\n", stderr); - - if (opt.output && opt.output_file) { - char output_buf[1024]; - if (opt.output_dir) - snprintf(output_buf, 1024, "%s/%s", opt.output_dir, opt.output_file); - else { - strncpy(output_buf, opt.output_file, 1023); - output_buf[1023] = '\0'; - } - gib_imlib_save_image(im_main, output_buf); - if (opt.verbose) { - int tw, th; - - tw = gib_imlib_image_get_width(im_main); - th = gib_imlib_image_get_height(im_main); - fprintf(stderr, PACKAGE ": File saved as %s\n", output_buf); - fprintf(stderr, - " - Image is %dx%d pixels and contains %d thumbnails\n", - tw, th, (tw / opt.thumb_w) * (th / opt.thumb_h)); - } - } - - if (!opt.display) - gib_imlib_free_image_and_decache(im_main); - - return; -} diff --git a/src/feh.h b/src/feh.h index 009f45b..1d5e918 100644 --- a/src/feh.h +++ b/src/feh.h @@ -132,7 +132,6 @@ void init_xinerama(void); #endif /* HAVE_LIBXINERAMA */ void init_multiwindow_mode(void); void init_thumbnail_mode(void); -void init_collage_mode(void); void init_index_mode(void); void init_slideshow_mode(void); void init_list_mode(void); diff --git a/src/filelist.c b/src/filelist.c index fc9fa35..3f3c96d 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -491,7 +491,7 @@ void feh_prepare_filelist(void) * we can create a properly sized thumbnail list. */ if (opt.list || opt.preload || opt.customlist || (opt.sort > SORT_MTIME) - || (opt.filter_by_dimensions && (opt.index || opt.collage || opt.thumbs || opt.bgmode))) { + || (opt.filter_by_dimensions && (opt.index || opt.thumbs || opt.bgmode))) { /* For these sort options, we have to preload images */ filelist = feh_file_info_preload(filelist); if (!gib_list_length(filelist)) diff --git a/src/main.c b/src/main.c index 1a76e2d..eff664a 100644 --- a/src/main.c +++ b/src/main.c @@ -59,8 +59,6 @@ int main(int argc, char **argv) if (opt.index) init_index_mode(); - else if (opt.collage) - init_collage_mode(); else if (opt.multiwindow) init_multiwindow_mode(); else if (opt.list || opt.customlist) diff --git a/src/options.c b/src/options.c index 38d2568..afbfafa 100644 --- a/src/options.c +++ b/src/options.c @@ -354,7 +354,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"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'}, @@ -578,9 +577,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.bg = 1; opt.bg_file = estrdup(optarg); break; - case 'c': - opt.collage = 1; - break; case 'd': opt.draw_filename = 1; break; @@ -853,17 +849,11 @@ static void check_options(void) } } - if ((opt.index + opt.collage) > 1) { - weprintf("you can't use collage mode and index mode together.\n" - " I'm going with index"); - opt.collage = 0; - } - if (opt.full_screen && opt.multiwindow) { eprintf("You cannot combine --fullscreen with --multiwindow"); } - if (opt.list && (opt.multiwindow || opt.index || opt.collage)) { + if (opt.list && (opt.multiwindow || opt.index)) { eprintf("You cannot combine --list with other modes"); } diff --git a/src/options.h b/src/options.h index 606b8e6..72fa03d 100644 --- a/src/options.h +++ b/src/options.h @@ -36,7 +36,6 @@ enum on_last_slide_action { struct __fehoptions { unsigned char multiwindow; unsigned char montage; - unsigned char collage; unsigned char index; unsigned char thumbs; unsigned char slideshow; diff --git a/test/status b/test/status index 2cda6d8..0151bcd 100644 --- a/test/status +++ b/test/status @@ -76,8 +76,6 @@ Overall test status, what's covered / missing [x] correct caption display ---collage - --customlist [x] correct output -- cgit v1.2.3 From 6bdf2eef44b667298aa8f7bd61aa59e59050f588 Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Wed, 3 Oct 2018 00:06:33 +0200 Subject: Use output directory for image saving command. --- man/feh.pre | 2 +- src/slideshow.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/man/feh.pre b/man/feh.pre index f65ccd2..2587501 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -589,7 +589,7 @@ image. . Save files to .Ar directory -.Pq only useful with -k . +.Pq only useful with -k , -o / -O or the save_image command . By default, files are saved in the current working directory. . .It Cm -p , --preload diff --git a/src/slideshow.c b/src/slideshow.c index 3770677..63c0a11 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -615,18 +615,21 @@ void slideshow_save_image(winwidget win) { char *tmpname; Imlib_Load_Error err; + char *base_dir = estrjoin("", opt.output_dir ? opt.output_dir : "", "/", NULL); if (win->file) { - tmpname = feh_unique_filename("", FEH_FILE(win->file->data)->name); + tmpname = feh_unique_filename(base_dir, FEH_FILE(win->file->data)->name); } else if (mode) { char *tmp; tmp = estrjoin(".", mode, "png", NULL); - tmpname = feh_unique_filename("", tmp); + tmpname = feh_unique_filename(base_dir, tmp); free(tmp); } else { - tmpname = feh_unique_filename("", "noname.png"); + tmpname = feh_unique_filename(base_dir, "noname.png"); } + free(base_dir); + if (opt.verbose) fprintf(stderr, "saving image to filename '%s'\n", tmpname); -- cgit v1.2.3 From 0dd07456d361736b8f100c45b3edada6ef4f1e42 Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Thu, 4 Oct 2018 02:18:42 +0200 Subject: Add missing EXIF rotations. --- src/gib_imlib.c | 12 ++++++++++++ src/gib_imlib.h | 2 ++ src/imlib.c | 14 +++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gib_imlib.c b/src/gib_imlib.c index 8f401aa..7858cb7 100644 --- a/src/gib_imlib.c +++ b/src/gib_imlib.c @@ -717,3 +717,15 @@ void gib_imlib_image_orientate(Imlib_Image im, int orientation) imlib_context_set_image(im); imlib_image_orientate(orientation); } + +void gib_imlib_image_flip_horizontal(Imlib_Image im) +{ + imlib_context_set_image(im); + imlib_image_flip_horizontal(); +} + +void gib_imlib_image_flip_vertical(Imlib_Image im) +{ + imlib_context_set_image(im); + imlib_image_flip_vertical(); +} diff --git a/src/gib_imlib.h b/src/gib_imlib.h index 6a16a0c..07daabe 100644 --- a/src/gib_imlib.h +++ b/src/gib_imlib.h @@ -181,6 +181,8 @@ void gib_imlib_parse_color(char *col, int *r, int *g, int *b, int *a); void gib_imlib_parse_fontpath(char *path); Imlib_Font gib_imlib_load_font(char *name); void gib_imlib_image_orientate(Imlib_Image im, int orientation); +void gib_imlib_image_flip_horizontal(Imlib_Image im); +void gib_imlib_image_flip_vertical(Imlib_Image im); #ifdef __cplusplus } diff --git a/src/imlib.c b/src/imlib.c index f41cdcd..18547a9 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -294,10 +294,22 @@ int feh_load_image(Imlib_Image * im, feh_file * file) } file->ed = exifData; - if (orientation == 3) + if (orientation == 2) + gib_imlib_image_flip_horizontal(*im); + else if (orientation == 3) gib_imlib_image_orientate(*im, 2); + else if (orientation == 4) + gib_imlib_image_flip_vertical(*im); + else if (orientation == 5) { + gib_imlib_image_orientate(*im, 3); + gib_imlib_image_flip_vertical(*im); + } else if (orientation == 6) gib_imlib_image_orientate(*im, 1); + else if (orientation == 7) { + gib_imlib_image_orientate(*im, 3); + gib_imlib_image_flip_horizontal(*im); + } else if (orientation == 8) gib_imlib_image_orientate(*im, 3); #endif -- cgit v1.2.3 From 9803fc41e8e6a820634f41d2196bdced7cbbc99f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 17 Oct 2018 20:40:17 +0200 Subject: Use random() instead of rand() to increase portability Quoting glibc rand(3): The versions of rand() and srand() in the Linux C Library use the same random number generator as random(3) and srandom(3), so the lower-order bits should be as random as the higher-order bits. However, on older rand() implementations, and on current implementations on different systems, the lower-order bits are much less random than the higher-order bits. Do not use this function in applications intended to be portable when good randomness is needed. (Use random(3) instead.) --- src/collage.c | 4 ++-- src/gib_list.c | 2 +- src/keyevents.c | 2 +- src/main.c | 2 +- src/slideshow.c | 2 +- src/wallpaper.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/collage.c b/src/collage.c index 2a4d9f9..b616bef 100644 --- a/src/collage.c +++ b/src/collage.c @@ -145,8 +145,8 @@ void init_collage_mode(void) } /* pick random coords for thumbnail */ - xxx = ((w - www) * ((double) rand() / RAND_MAX)); - yyy = ((h - hhh) * ((double) rand() / RAND_MAX)); + xxx = ((w - www) * ((double) random() / RAND_MAX)); + yyy = ((h - hhh) * ((double) random() / RAND_MAX)); D(("image going on at x=%d, y=%d\n", xxx, yyy)); im_thumb = gib_imlib_create_cropped_scaled_image(im_temp, diff --git a/src/gib_list.c b/src/gib_list.c index 5384d98..a8ba1dd 100644 --- a/src/gib_list.c +++ b/src/gib_list.c @@ -362,7 +362,7 @@ gib_list_randomize(gib_list * list) } for (i = 0; i < len - 1; i++) { - r = i + rand() / (RAND_MAX / (len - i) + 1 ); + r = i + random() / (RAND_MAX / (len - i) + 1 ); t = farray[r]; farray[r] = farray[i]; farray[i] = t; diff --git a/src/keyevents.c b/src/keyevents.c index 689aebd..43bc82a 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -686,7 +686,7 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy } else if (feh_is_kp(EVENT_jump_random, state, keysym, button)) { if (winwid->type == WIN_TYPE_THUMBNAIL) - feh_thumbnail_select_next(winwid, rand() % (filelist_len - 1)); + feh_thumbnail_select_next(winwid, random() % (filelist_len - 1)); else slideshow_change_image(winwid, SLIDE_RAND, 1); } diff --git a/src/main.c b/src/main.c index 1a76e2d..779e0bd 100644 --- a/src/main.c +++ b/src/main.c @@ -42,7 +42,7 @@ int main(int argc, char **argv) { atexit(feh_clean_exit); - srand(getpid() * time(NULL) % ((unsigned int) -1)); + srandom(getpid() * time(NULL) % ((unsigned int) -1)); setup_signal_handlers(); init_parse_options(argc, argv); diff --git a/src/slideshow.c b/src/slideshow.c index 3770677..b404318 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -258,7 +258,7 @@ void slideshow_change_image(winwidget winwid, int change, int render) case SLIDE_RAND: if (filelist_len > 1) { current_file = feh_list_jump(filelist, current_file, FORWARD, - (rand() % (filelist_len - 1)) + 1); + (random() % (filelist_len - 1)) + 1); change = SLIDE_NEXT; } break; diff --git a/src/wallpaper.c b/src/wallpaper.c index db14a8c..ef7ecca 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -252,7 +252,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XGCValues gcval; GC gc; char bgname[20]; - int num = (int) rand(); + int num = (int) random(); char bgfil[4096]; char sendbuf[4096]; -- cgit v1.2.3 From ebb130d978df17b42935fed570294df45622dea2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 4 Nov 2018 11:18:51 +0100 Subject: Show verscmp status in --version output --- src/options.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/options.c b/src/options.c index 38d2568..383e663 100644 --- a/src/options.c +++ b/src/options.c @@ -899,6 +899,10 @@ static void show_version(void) "stat64 " #endif +#ifdef HAVE_VERSCMP + "verscmp " +#endif + #ifdef HAVE_LIBXINERAMA "xinerama " #endif -- cgit v1.2.3 From 1c36c74c8ff5ad9768c854a2d88fa66fa9fe148f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 4 Nov 2018 22:07:22 +0100 Subject: Disable in-place editing by default --- src/imlib.c | 2 +- src/options.c | 8 ++++---- src/options.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/imlib.c b/src/imlib.c index 2c04128..a48d654 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1204,7 +1204,7 @@ void feh_edit_inplace(winwidget w, int op) if (!w->file || !w->file->data || !FEH_FILE(w->file->data)->filename) return; - if (opt.no_inplace_edit) { + if (!opt.edit) { imlib_context_set_image(w->im); if (op == INPLACE_EDIT_FLIP) imlib_image_flip_vertical(); diff --git a/src/options.c b/src/options.c index dc6a9ff..19e47f6 100644 --- a/src/options.c +++ b/src/options.c @@ -398,6 +398,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"bg-fill" , 0, 0, 218}, {"bg-max" , 0, 0, 219}, {"no-jump-on-resort", 0, 0, 220}, + {"edit" , 0, 0, 221}, #ifdef HAVE_LIBEXIF {"draw-exif" , 0, 0, 223}, {"auto-rotate" , 0, 0, 242}, @@ -418,7 +419,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"conversion-timeout" , 1, 0, 245}, {"version-sort" , 0, 0, 246}, {"offset" , 1, 0, 247}, - {"no-inplace-edit", 0, 0, 248}, {0, 0, 0, 0} }; int optch = 0, cmdx = 0; @@ -731,6 +731,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case 220: opt.jump_on_resort = 0; break; + case 221: + opt.edit = 1; + break; #ifdef HAVE_LIBEXIF case 223: opt.draw_exif = 1; @@ -806,9 +809,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.offset_flags = XParseGeometry(optarg, &opt.offset_x, &opt.offset_y, (unsigned int *)&discard, (unsigned int *)&discard); break; - case 248: - opt.no_inplace_edit = 1; - break; default: break; } diff --git a/src/options.h b/src/options.h index 5734b54..1c68fa0 100644 --- a/src/options.h +++ b/src/options.h @@ -80,6 +80,7 @@ struct __fehoptions { unsigned char keep_zoom_vp; unsigned char insecure_ssl; unsigned char filter_by_dimensions; + unsigned char edit; char *output_file; char *output_dir; @@ -110,7 +111,6 @@ struct __fehoptions { double reload; int sort; int version_sort; - int no_inplace_edit; int debug; int geom_enabled; int geom_flags; -- cgit v1.2.3 From de185357e745f78e2133da826972502bd1980d1f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 4 Nov 2018 22:12:39 +0100 Subject: Fix segfault when editing an image without info struct --- src/imlib.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/imlib.c b/src/imlib.c index a48d654..4270c4a 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1213,8 +1213,12 @@ void feh_edit_inplace(winwidget w, int op) else { imlib_image_orientate(op); tmp = w->im_w; - FEH_FILE(w->file->data)->info->width = w->im_w = w->im_h; - FEH_FILE(w->file->data)->info->height = w->im_h = tmp; + w->im_w = w->im_h; + w->im_h = tmp; + if (FEH_FILE(w->file->data)->info) { + FEH_FILE(w->file->data)->info->width = w->im_w; + FEH_FILE(w->file->data)->info->height = w->im_h; + } } winwidget_render_image(w, 1, 0); return; @@ -1257,8 +1261,12 @@ void feh_edit_inplace(winwidget w, int op) else { imlib_image_orientate(op); tmp = w->im_w; - FEH_FILE(w->file->data)->info->width = w->im_w = w->im_h; - FEH_FILE(w->file->data)->info->height = w->im_h = tmp; + w->im_w = w->im_h; + w->im_h = tmp; + if (FEH_FILE(w->file->data)->info) { + FEH_FILE(w->file->data)->info->width = w->im_w; + FEH_FILE(w->file->data)->info->height = w->im_h; + } } im_weprintf(w, "unable to edit in place. Changes have not been saved."); winwidget_render_image(w, 1, 0); -- cgit v1.2.3 From 3a9a6bfdf7767fbbd59a6b0cc9e6d606c9286057 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 5 Nov 2018 19:44:02 +0100 Subject: Remove deprecated --cycle-once option --- ChangeLog | 1 + src/options.c | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index d99c578..667d204 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ git HEAD * Remove deprecated webcam scripts (feh-cam and gen-cam-menu) * Remove deprecated collage mode (-c/--collage) + * Remove deprecated option --cycle-once (use --on-last-slide=quit instead) * flip and rotation (keys "<", ">", "|", and "_") no longer change the underlying file. This leaves delete ("Ctrl+Delete") as the only destructive action which is enabled by default diff --git a/src/options.c b/src/options.c index 19e47f6..298dbab 100644 --- a/src/options.c +++ b/src/options.c @@ -403,7 +403,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"draw-exif" , 0, 0, 223}, {"auto-rotate" , 0, 0, 242}, #endif - {"cycle-once" , 0, 0, 224}, {"no-xinerama" , 0, 0, 225}, {"draw-tinted" , 0, 0, 229}, {"info" , 1, 0, 234}, @@ -742,10 +741,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.auto_rotate = 1; break; #endif - case 224: - weprintf("--cycle-once is deprecated, please use --on-last-slide=quit instead"); - opt.on_last_slide = ON_LAST_SLIDE_QUIT; - break; case 225: opt.xinerama = 0; break; -- cgit v1.2.3 From 7b873e26ed203365e9d96760b0ad5a3605574550 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 5 Nov 2018 19:51:57 +0100 Subject: Remove deprecated option --menu-bg --- ChangeLog | 1 + examples/themes | 5 ----- share/images/menubg_aluminium.png | Bin 1862 -> 0 bytes share/images/menubg_aqua.png | Bin 5325 -> 0 bytes share/images/menubg_black.png | Bin 1716 -> 0 bytes share/images/menubg_brushed.png | Bin 8649 -> 0 bytes share/images/menubg_sky.png | Bin 1928 -> 0 bytes src/main.c | 1 - src/menu.c | 2 +- src/options.c | 7 ------- src/options.h | 1 - 11 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 share/images/menubg_aluminium.png delete mode 100644 share/images/menubg_aqua.png delete mode 100644 share/images/menubg_black.png delete mode 100644 share/images/menubg_brushed.png delete mode 100644 share/images/menubg_sky.png (limited to 'src') diff --git a/ChangeLog b/ChangeLog index 667d204..f2ec192 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ git HEAD * Remove deprecated webcam scripts (feh-cam and gen-cam-menu) * Remove deprecated collage mode (-c/--collage) * Remove deprecated option --cycle-once (use --on-last-slide=quit instead) + * Remove deprecated option --menu-bg * flip and rotation (keys "<", ">", "|", and "_") no longer change the underlying file. This leaves delete ("Ctrl+Delete") as the only destructive action which is enabled by default diff --git a/examples/themes b/examples/themes index d315942..2d77770 100644 --- a/examples/themes +++ b/examples/themes @@ -41,11 +41,6 @@ booth --full-screen --hide-pointer --slideshow-delay 20 # Screw xscreensaver, use feh =) screensave --recursive --full-screen --randomize --slideshow-delay 10 --hide-pointer -# Different menus -aqua --menu-bg /usr/share/feh/images/menubg_aqua.png -sky --menu-bg /usr/share/feh/images/menubg_sky.png -black --menu-bg /usr/share/feh/images/menubg_black.png - # Some more examples, used by the feh developer rfs --full-screen --hide-pointer --auto-zoom --randomize diff --git a/share/images/menubg_aluminium.png b/share/images/menubg_aluminium.png deleted file mode 100644 index eed00f1..0000000 Binary files a/share/images/menubg_aluminium.png and /dev/null differ diff --git a/share/images/menubg_aqua.png b/share/images/menubg_aqua.png deleted file mode 100644 index 3a72590..0000000 Binary files a/share/images/menubg_aqua.png and /dev/null differ diff --git a/share/images/menubg_black.png b/share/images/menubg_black.png deleted file mode 100644 index 08b4c2b..0000000 Binary files a/share/images/menubg_black.png and /dev/null differ diff --git a/share/images/menubg_brushed.png b/share/images/menubg_brushed.png deleted file mode 100644 index 32fad47..0000000 Binary files a/share/images/menubg_brushed.png and /dev/null differ diff --git a/share/images/menubg_sky.png b/share/images/menubg_sky.png deleted file mode 100644 index e0be8ca..0000000 Binary files a/share/images/menubg_sky.png and /dev/null differ diff --git a/src/main.c b/src/main.c index 0d1cc4d..ded0b22 100644 --- a/src/main.c +++ b/src/main.c @@ -216,7 +216,6 @@ void feh_clean_exit(void) { delete_rm_files(); - free(opt.menu_bg); free(opt.menu_font); if(disp) diff --git a/src/menu.c b/src/menu.c index 2f8875d..fcbb490 100644 --- a/src/menu.c +++ b/src/menu.c @@ -134,7 +134,7 @@ feh_menu *feh_menu_new(void) menus = l; if (!bg) { - feh_load_image_char(&bg, opt.menu_bg); + feh_load_image_char(&bg, PREFIX "/share/feh/images/menubg_default.png"); if (bg) { border.left = border.right = border.top = border.bottom = 4; diff --git a/src/options.c b/src/options.c index 298dbab..c6165ac 100644 --- a/src/options.c +++ b/src/options.c @@ -62,7 +62,6 @@ void init_parse_options(int argc, char **argv) opt.scroll_step = 20; 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; @@ -319,7 +318,6 @@ 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[] = { - {"menu-bg" , 1, 0, ')'}, {"debug" , 0, 0, '+'}, {"scale-down" , 0, 0, '.'}, {"max-dimension" , 1, 0, '<'}, @@ -427,11 +425,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) switch (optch) { case 0: break; - 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 '+': opt.debug = 1; break; diff --git a/src/options.h b/src/options.h index 1c68fa0..7f8fe9c 100644 --- a/src/options.h +++ b/src/options.h @@ -96,7 +96,6 @@ struct __fehoptions { char *filelistfile; char *menu_font; char *customlist; - char *menu_bg; char *caption_path; char *start_list_at; char *info_cmd; -- cgit v1.2.3 From 88ea311f5347380b598f876bf21d91795b8fdd51 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 5 Nov 2018 20:45:51 +0100 Subject: Remove no longer present -c option from stropts --- src/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/options.c b/src/options.c index c6165ac..41c68cd 100644 --- a/src/options.c +++ b/src/options.c @@ -313,7 +313,7 @@ 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" + "a:A:b:B:C: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 */ -- cgit v1.2.3 From 61f83c411202b089752f8d1002c0f325f518a4f8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 8 Nov 2018 20:42:37 +0100 Subject: Change default toggle_fullscreen key to "f" This is in line with other software. save_filelist now defaults to "L". --- ChangeLog | 3 +++ man/feh.pre | 14 +++++++------- src/keyevents.c | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index f2ec192..bbfab1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ git HEAD * Remove deprecated collage mode (-c/--collage) * Remove deprecated option --cycle-once (use --on-last-slide=quit instead) * Remove deprecated option --menu-bg + * Change default save_filelist key from "f" to "L" (mnemonic: fileList) + * Change default toggle_fullscreen key from "v" to "f" as this is also + used by mplayer, mpv and similar * flip and rotation (keys "<", ">", "|", and "_") no longer change the underlying file. This leaves delete ("Ctrl+Delete") as the only destructive action which is enabled by default diff --git a/man/feh.pre b/man/feh.pre index 35ff062..f6db8c4 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1436,10 +1436,9 @@ Toggle filename display .Pq optional feature, $MAN_EXIF$ in this build Toggle EXIF tag display . -.It f Bq save_filelist +.It f Bq toggle_fullscreen . -Save the current filelist as -.Qq feh_PID_ID_filelist +Toggle fullscreen . .It g Bq toggle_fixed_geometry . @@ -1463,6 +1462,11 @@ When enabled, .Nm will keep zoom and X, Y offset when switching images. . +.It L Bq save_filelist +. +Save the current filelist as +.Qq feh_PID_ID_filelist +. .It m Bq toggle_menu . Show menu. @@ -1499,10 +1503,6 @@ Useful for webcams Save the current image as .Qq feh_PID_ID_FILENAME . -.It v Bq toggle_fullscreen -. -Toggle fullscreen -. .It w Bq size_to_image . Change window size to fit current image size diff --git a/src/keyevents.c b/src/keyevents.c index 43bc82a..6c2f06e 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -195,10 +195,10 @@ void init_keyevents(void) { feh_set_kb("toggle_caption" , 0, XK_c, 0, 0, 0, 0); feh_set_kb("toggle_pause" , 0, XK_h, 0, 0, 0, 0); feh_set_kb("toggle_menu" , 0, XK_m, 0, 0, 0, 0); - feh_set_kb("toggle_fullscreen" , 0, XK_v, 0, 0, 0, 0); + feh_set_kb("toggle_fullscreen" , 0, XK_f, 0, 0, 0, 0); feh_set_kb("reload_image" , 0, XK_r, 0, 0, 0, 0); feh_set_kb("save_image" , 0, XK_s, 0, 0, 0, 0); - feh_set_kb("save_filelist" , 0, XK_f, 0, 0, 0, 0); + feh_set_kb("save_filelist" , 0, XK_L, 0, 0, 0, 0); feh_set_kb("orient_1" , 0, XK_greater, 0, 0, 0, 0); feh_set_kb("orient_3" , 0, XK_less, 0, 0, 0, 0); feh_set_kb("flip" , 0, XK_underscore, 0, 0, 0, 0); -- cgit v1.2.3 From 1aef8e8617e519694764b4b7435007eb2e02187b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 9 Nov 2018 17:07:05 +0100 Subject: Update help --- src/help.raw | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/help.raw b/src/help.raw index c8de3d7..ca7c85c 100644 --- a/src/help.raw +++ b/src/help.raw @@ -35,6 +35,7 @@ OPTIONS -d, --draw-filename Show the filename in the image window --draw-tinted Show overlay texts on semi-transparent background --draw-exif Show some Exif information (if compiled with exif=1) + --edit Make flip/rotation keys flip/rotate the underlying file --auto-rotate Rotate images according to Exif info (if compiled with exif=1) -^, --title TITLE Set window title (see FORMAT SPECIFIERS) -D, --slideshow-delay NUM Set delay between automatically changing slides @@ -87,6 +88,7 @@ OPTIONS -M, --menu-font FONT Use FONT for the font in menus. -B, --image-bg STYLE Set background for transparent images and the like. Accepted values: default, checks, or a XColor (eg. #428bdd) + --xinerama-index I Assumee that I is the active xinerama screen -N, --no-menus Don't load or show any menus. --no-xinerama Disable Xinerama support --no-screen-clip Do not limit window size to screen size @@ -123,13 +125,14 @@ INDEX MODE OPTIONS FORMAT SPECIFIERS %f image path/filename %F image path/filename (shell-escaped) + %g window dimensions (\"width,height\") in pixels %h image height %l total number of files in the filelist %L path to temporary copy of filelist %m current mode (slideshow, multiwindow...) %n image name %N image name (shell-escaped) - %o x,y offset of top-left image corner to window in pixels + %o offset of top-left image corner to window (\"x,y\") in pixels %p image pixel size %P image pixel size in kilo-/megapixels %r image rotation. half right turn == 3.1415 (pi) @@ -140,34 +143,39 @@ FORMAT SPECIFIERS %w image width %v " PACKAGE " version %V process ID - %z current image zoom + %z current image zoom, rounded to two decimal places + %Z current image zoom, high precision %% % \\n newline -KEYS +DEFAULT KEYS a Toggle action display (--draw-actions) A Toggle anti-aliasing c Enable caption entry mode d Toggle filename display (--draw-filename) e Toggle exif tag display (if compiled with exif=1) - f Save current filelist to unique filename + f Toggle fullscreen + g Toggle fixed geometry mode h pause/continue slideshow i Toggle --info display k Toggle zoom/viewport freeze when switching images - m Show menu + L Save current filelist to unique filename + m Show/hide menu n, , Go to next image o Toggle pointer visibility p, , Go to previous image q, Quit r Reload image + R Render/anti-alias image s Save current image to unique filename - v Toggle fullscreen w Resize window to current image dimensions x Close current window z Jump to a random position in the current filelist - <, > In place editing, rotate 90 degrees right/left - _ In place editing, vertical flip - | In place editing, horizontal flip + Z Toggle auto-zoom + [, ] Jump to previous/next directory + <, > Rotate 90 degrees right/left + _ Vertical flip + | Horizontal flip 0, Run action specified by --action option 1-9 Run action 1-9 specified by --action[1-9] options Go to first slide @@ -191,7 +199,7 @@ KEYS This program is free software, see the file COPYING for licensing info. Copyright Tom Gilbert (and various contributors) 1999-2003. -Copyright Daniel Friesel (and various contributors) 2010-2016. +Copyright Daniel Friesel (and various contributors) 2010-2018. Homepage: http://feh.finalrewind.org Report bugs to or #feh on irc.oftc.net. -- cgit v1.2.3 From e8183eb75707fac82ac18dd55fe7faa8a55905af Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 9 Nov 2018 17:14:16 +0100 Subject: options.c: Remove '-)' (belonged to menu-bg) --- src/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/options.c b/src/options.c index 41c68cd..894e29f 100644 --- a/src/options.c +++ b/src/options.c @@ -314,7 +314,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) int discard; static char stropts[] = "a:A:b:B:C: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[] = { -- cgit v1.2.3 From ddf90e154a33a4e15054d962124f381eb3608fa2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 18 Nov 2018 20:19:49 +0100 Subject: Make slideshow_save_image work again when opt.output_dir is unset --- src/slideshow.c | 9 +++++++-- src/utils.c | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slideshow.c b/src/slideshow.c index 19aeaee..145bee1 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -615,7 +615,10 @@ void slideshow_save_image(winwidget win) { char *tmpname; Imlib_Load_Error err; - char *base_dir = estrjoin("", opt.output_dir ? opt.output_dir : "", "/", NULL); + char *base_dir = ""; + if (opt.output_dir) { + base_dir = estrjoin("", opt.output_dir, "/", NULL); + } if (win->file) { tmpname = feh_unique_filename(base_dir, FEH_FILE(win->file->data)->name); @@ -628,7 +631,9 @@ void slideshow_save_image(winwidget win) tmpname = feh_unique_filename(base_dir, "noname.png"); } - free(base_dir); + if (opt.output_dir) { + free(base_dir); + } if (opt.verbose) fprintf(stderr, "saving image to filename '%s'\n", tmpname); diff --git a/src/utils.c b/src/utils.c index ec30d4a..087e7f6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -152,6 +152,7 @@ char path_is_url(char *path) { return 0; } +/* Note: path must end with a trailing / or be an empty string */ /* free the result please */ char *feh_unique_filename(char *path, char *basename) { -- cgit v1.2.3 From 55c27c4babcf63989192f930ba7a75dac691e1e5 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 18 Nov 2018 21:26:43 +0100 Subject: --start-at: Compare basenames if exact match failed This more closely resembles the expected behaviour of --start-at, but may lead to mismatches if several files in the filelist have the same basename. Closes #206 Related to #372 and #420 --- man/feh.pre | 23 ++++++++++------------- src/slideshow.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/man/feh.pre b/man/feh.pre index 173410e..e401ab5 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -729,20 +729,17 @@ to sort numbers naturally, so that e.g. 10.jpg comes after 2.jpg. Start the filelist at .Ar filename . . -Note that at the moment, +If you use relative paths in your filelist, .Ar filename -must match an -.Pq expanded -path in the filelist. -So, if the file to be matched is passed via an absolute path in the filelist, -.Ar filename -must be an absolute path. -If the file is passed via a relative path, -.Ar filename -must be an identical relative path. -This is a known issue. -See also -.Sx USAGE EXAMPLES . +should also be a relative path. +If you use absolute paths, it should also be an absolute path. +. +If +.Nm +cannot find an exact match, it will compare basenames +.Pq filenames without the directory suffix . +Note that this may lead to mismatches if several files in your filelist +have the same basename. . .It Cm -T , --theme Ar theme . diff --git a/src/slideshow.c b/src/slideshow.c index 145bee1..145ced1 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -37,6 +37,24 @@ void init_slideshow_mode(void) int success = 0; gib_list *l = filelist, *last = NULL; + /* + * In theory, --start-at FILENAME is simple: Look for a file called + * FILENAME, start the filelist there, done. + * + * In practice, there are cases where this isn't sufficient. For instance, + * a user running 'feh --start-at hello.jpg /tmp' will expect feh to start + * at /tmp/hello.jpg, as if they had used + * 'feh --start-at /tmp/hello.jpg /tmp'. Similarly, XDG Desktop files + * may lead to the invocation 'feh --start-at /tmp/hello.jpg .' in /tmp, + * expecting the behaviour of 'feh --start-at ./hello.jpg .'. + * + * Since a good user experience is not about being technically correct, but + * about delivering the expected behaviour, we do some fuzzy matching + * here. In the worst case, this will cause --start-at to start at the + * wrong file. + */ + + // Try finding an exact filename match first for (; l && opt.start_list_at; l = l->next) { if (!strcmp(opt.start_list_at, FEH_FILE(l->data)->filename)) { opt.start_list_at = NULL; @@ -44,6 +62,34 @@ void init_slideshow_mode(void) } } + /* + * If it didn't work (opt.start_list_at is still set): Fall back to + * comparing just the filenames without directory prefixes. This may lead + * to false positives, but for now that's just the way it is. + */ + if (opt.start_list_at) { + char *current_filename; + char *start_at_filename = strrchr(opt.start_list_at, '/'); + if (start_at_filename) { + start_at_filename++; // We only care about the part after the '/' + } else { + start_at_filename = opt.start_list_at; + } + for (l = filelist; l && opt.start_list_at; l = l->next) { + current_filename = strrchr(FEH_FILE(l->data)->filename, '/'); + if (current_filename) { + current_filename++; // We only care about the part after the '/' + } else { + current_filename = FEH_FILE(l->data)->filename; + } + if (!strcmp(start_at_filename, current_filename)) { + opt.start_list_at = NULL; + break; + } + } + } + + // If that didn't work either, we're out of luck. if (opt.start_list_at) eprintf("--start-at %s: File not found in filelist", opt.start_list_at); -- cgit v1.2.3 From 391a9bfd489d3f2e0cc74a2f698938b3e621d25b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 19 Nov 2018 18:34:31 +0100 Subject: --start-at: Auto-load directory when no other files are specified This changes the behaviour of "feh --start-at FILENAME" as follows: Previously, this would cause feh to load all files in the current working directory, since no files or filelists were specified on the command line. Now this is a special case: feh will extract the directory component from FILENAME, load all files in that directory, and display FILENAME. This way, it's possible to use "feh --start-at ~%f" in XDG Desktop files and browse files in feh using the prev/next keys Closes #372 Closes #420 --- man/feh.pre | 28 +++++++++++++++++++++------- src/options.c | 13 +++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/man/feh.pre b/man/feh.pre index e401ab5..d5d7cbf 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -45,7 +45,9 @@ and image captions. .Nm can be controlled by configurable keyboard and mouse shortcuts, terminal input and signals. -When no file arguments or filelists are specified, +When no file arguments or filelists are specified and +.Cm --start-at +is not used, .Nm displays all files in the current directory. . @@ -728,8 +730,20 @@ to sort numbers naturally, so that e.g. 10.jpg comes after 2.jpg. . Start the filelist at .Ar filename . +If no files or filelists were specifed on the commandline, +.Nm +will first load all files from the directory in which +.Ar filename +resides. +This way, it's possible to look at a specific image and use the next / prev +keys to browse through the directory. +See +.Sx USAGE EXAMPLES +for examples. +. +.Pp . -If you use relative paths in your filelist, +Note: If you use relative paths in your filelist, .Ar filename should also be a relative path. If you use absolute paths, it should also be an absolute path. @@ -738,7 +752,7 @@ If .Nm cannot find an exact match, it will compare basenames .Pq filenames without the directory suffix . -Note that this may lead to mismatches if several files in your filelist +This may lead to mismatches if several files in your filelist have the same basename. . .It Cm -T , --theme Ar theme @@ -1915,14 +1929,14 @@ automatically change to the next image after 5 seconds View all images in ~/Pictures and below, sorted by width, move an image to ~/image/image_name when enter is pressed . -.It feh --start-at ./foo.jpg \&. +.It feh --start-at ~/Pictures/foo.jpg . -View all images in the current directory, starting with foo.jpg. +View all images in ~/Pictures, starting with foo.jpg. All other images are still in the slideshow and can be viewed normally . -.It feh --start-at foo.jpg * +.It feh --start-at ~/Pictures/foo.jpg ~/Pictures . -Same as above +Same as above. . .It feh --info \&"exifgrep '\&(Model\&|DateTimeOriginal\&|FNumber\&|ISO\&|Flash\&)' %F \&| cut -d \&. -f 4-\&" \&. . diff --git a/src/options.c b/src/options.c index 894e29f..333c8c7 100644 --- a/src/options.c +++ b/src/options.c @@ -812,6 +812,19 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) add_file_to_filelist_recursively(argv[optind++], FILELIST_FIRST); } } + else if (finalrun && !opt.filelistfile && !opt.bgmode) { + if (opt.start_list_at && !path_is_url(opt.start_list_at) && strrchr(opt.start_list_at, '/')) { + char *target_directory = estrdup(opt.start_list_at); + char *filename_start = strrchr(target_directory, '/'); + if (filename_start) { + *filename_start = '\0'; + } + add_file_to_filelist_recursively(target_directory, FILELIST_FIRST); + free(target_directory); + } else { + add_file_to_filelist_recursively(".", FILELIST_FIRST); + } + } else if (finalrun && !opt.filelistfile && !opt.bgmode) add_file_to_filelist_recursively(".", FILELIST_FIRST); -- cgit v1.2.3 From a6ac404853d107308b0ad11dbf0885c50ab11b73 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 23 Nov 2018 16:38:22 +0100 Subject: Decrease libcurl timeout from indefinite to 30 minutes --- src/imlib.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/imlib.c b/src/imlib.c index 4270c4a..2f3459e 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -583,6 +583,13 @@ static char *feh_http_load_image(char *url) #ifdef DEBUG curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); #endif + /* + * Do not allow requests to take longer than 30 minutes. + * This should be sufficiently high to accomodate use cases with + * unusually high latencies, while at the sime time avoiding + * feh hanging indefinitely in unattended slideshows. + */ + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1800); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEDATA, sfp); ebuff = emalloc(CURL_ERROR_SIZE); -- cgit v1.2.3 From 3fc148aecf9a5334a26752acf6b6d71819cbc2f4 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 29 Nov 2018 18:36:46 +0100 Subject: Handle SIGINT while doing libcurl transfers See also #435 --- src/imlib.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/imlib.c b/src/imlib.c index 2f3459e..3bc0126 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -37,6 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef HAVE_LIBCURL #include +extern int sig_exit; #endif #ifdef HAVE_LIBEXIF @@ -541,6 +542,24 @@ static char *feh_magick_load_image(char *filename) #ifdef HAVE_LIBCURL +static int curl_quit_function(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) +{ + // ignore "unused parameter" warnings + (void)clientp; + (void)dltotal; + (void)dlnow; + (void)ultotal; + (void)ulnow; + if (sig_exit) { + /* + * The user wants to quit feh. Tell libcurl to abort the transfer and + * return control to the main loop, where we can quit gracefully. + */ + return 1; + } + return 0; +} + static char *feh_http_load_image(char *url) { CURL *curl; @@ -596,6 +615,8 @@ static char *feh_http_load_image(char *url) curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, ebuff); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, curl_quit_function); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); if (opt.insecure_ssl) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); @@ -608,7 +629,9 @@ static char *feh_http_load_image(char *url) res = curl_easy_perform(curl); curl_easy_cleanup(curl); if (res != CURLE_OK) { - weprintf("open url: %s", ebuff); + if (res != CURLE_ABORTED_BY_CALLBACK) { + weprintf("open url: %s", ebuff); + } unlink(sfn); close(fd); free(sfn); -- cgit v1.2.3 From bafc47fd575bb7878214deda3730efcb6c755770 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 4 Dec 2018 21:34:14 +0100 Subject: Declare sig_exit as volatile sig_exit may be changed by a signal handler, so its value should always be read from RAM. --- src/filelist.c | 2 +- src/imlib.c | 2 +- src/signals.c | 2 +- src/signals.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/filelist.c b/src/filelist.c index 3f3c96d..6f4f6df 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "feh.h" #include "filelist.h" +#include "signals.h" #include "options.h" gib_list *filelist = NULL; @@ -37,7 +38,6 @@ gib_list *original_file_items = NULL; /* original file items from argv */ int filelist_len = 0; gib_list *current_file = NULL; extern int errno; -extern int sig_exit; /* exit flag from signal handler */ static gib_list *rm_filelist = NULL; diff --git a/src/imlib.c b/src/imlib.c index 3bc0126..4d2f2fa 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "feh.h" #include "filelist.h" +#include "signals.h" #include "winwidget.h" #include "options.h" @@ -37,7 +38,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef HAVE_LIBCURL #include -extern int sig_exit; #endif #ifdef HAVE_LIBEXIF diff --git a/src/signals.c b/src/signals.c index aeaf889..d65f49b 100644 --- a/src/signals.c +++ b/src/signals.c @@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "options.h" void feh_handle_signal(int); -int sig_exit = 0; +volatile int sig_exit = 0; void setup_signal_handlers() { diff --git a/src/signals.h b/src/signals.h index 090ab0b..38fc0d2 100644 --- a/src/signals.h +++ b/src/signals.h @@ -27,5 +27,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SIGNALS_H void setup_signal_handlers(); -extern int sig_exit; +volatile extern int sig_exit; #endif -- cgit v1.2.3 From 6cbed6d3ac5db5601c82d04622eb1ed9f3061923 Mon Sep 17 00:00:00 2001 From: Pavel Shlyak Date: Sun, 23 Dec 2018 00:45:10 +0300 Subject: Remove useless assignments It is a naive way of fixing it :) Needs attentive review --- src/winwidget.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/winwidget.c b/src/winwidget.c index b68d56f..4f5f4a6 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -740,8 +740,6 @@ void winwidget_show(winwidget winwid) void winwidget_move(winwidget winwid, int x, int y) { if (winwid && ((winwid->x != x) || (winwid->y != y))) { - winwid->x = x; - winwid->y = y; winwid->x = (x > scr->width) ? scr->width : x; winwid->y = (y > scr->height) ? scr->height : y; XMoveWindow(disp, winwid->win, winwid->x, winwid->y); -- cgit v1.2.3 From a4f09edc1eb8a673cb1d953aeded7ac0b1295859 Mon Sep 17 00:00:00 2001 From: Pavel Shlyak Date: Sun, 23 Dec 2018 18:44:09 +0300 Subject: There is no need to test ft against null ft is already checked on line 153 so this condition is useless. Check https://github.com/derf/feh/issues/440 for more details --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index ded0b22..87cf7c4 100644 --- a/src/main.c +++ b/src/main.c @@ -183,7 +183,7 @@ int feh_main_iteration(int block) && ((errno == ENOMEM) || (errno == EINVAL) || (errno == EBADF))) eprintf("Connection to X display lost"); - if ((ft) && (count == 0)) { + if (count == 0) { /* This means the timer is due to be executed. If count was > 0, that would mean an X event had woken us, we're not interested in that */ -- cgit v1.2.3 From 5c0ab94b0cd1b944127448f4228690f122b702ef Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 23 Dec 2018 20:48:40 +0100 Subject: options.c: Note that sscanf calls are safe --- src/options.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/options.c b/src/options.c index 333c8c7..34e248e 100644 --- a/src/options.c +++ b/src/options.c @@ -131,6 +131,7 @@ static void feh_load_options_for_theme(char *theme) char *rcpath = NULL; char *oldrcpath = NULL; char *confbase = getenv("XDG_CONFIG_HOME"); + // s, s1 and s2 must always have identical size char s[1024], s1[1024], s2[1024]; int cont = 0; int bspos; @@ -167,11 +168,19 @@ static void feh_load_options_for_theme(char *theme) s2[0] = '\0'; if (cont) { + /* + * fgets ensures that s contains no more than 1023 characters + * (+ 1 null byte) + */ sscanf(s, " %[^\n]\n", (char *) &s2); if (!*s2) break; D(("Got continued options %s\n", s2)); } else { + /* + * fgets ensures that s contains no more than 1023 characters + * (+ 1 null byte) + */ sscanf(s, "%s %[^\n]\n", (char *) &s1, (char *) &s2); if (!(*s1) || (!*s2) || (*s1 == '\n') || (*s1 == '#')) { cont = 0; -- cgit v1.2.3 From fa10dc1e2529ab26d1caf633c19cb558cab29b85 Mon Sep 17 00:00:00 2001 From: guraga Date: Mon, 21 Jan 2019 15:41:49 +0700 Subject: Update "src/signals.h" Use "extern volatile" instead of "volatile extern" to avoid "gcc" warning "'extern' is not at beginning of declaration [-Wold-style-declaration]". --- src/signals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/signals.h b/src/signals.h index 38fc0d2..bff737e 100644 --- a/src/signals.h +++ b/src/signals.h @@ -27,5 +27,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SIGNALS_H void setup_signal_handlers(); -volatile extern int sig_exit; +extern volatile int sig_exit; #endif -- cgit v1.2.3 From 444a28c3d0ef6618a3b674466a241456a5d7d534 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 1 Feb 2019 18:36:44 +0100 Subject: Remove dead code closes #458 --- src/options.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/options.c b/src/options.c index 34e248e..c9b5a1c 100644 --- a/src/options.c +++ b/src/options.c @@ -834,8 +834,6 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) add_file_to_filelist_recursively(".", FILELIST_FIRST); } } - else if (finalrun && !opt.filelistfile && !opt.bgmode) - add_file_to_filelist_recursively(".", FILELIST_FIRST); /* So that we can safely be called again */ optind = 0; -- cgit v1.2.3 From 553d6f9060d867cf05bd21d8669751b31bbe11dd Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 8 Feb 2019 17:58:21 +0100 Subject: Fix ~/.fehbg creation when using --randomize or directory arguments Closes #456 Note that --randomize and directory names are not saved in fehbg. It only contains the command line needed to recreate the wallpaper setup which resulted from its invocation, i.e., after randomization etc. have been applied. This is intentional. --- src/wallpaper.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/wallpaper.c b/src/wallpaper.c index ef7ecca..f0bf891 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -502,15 +502,16 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, } fputc(' ', fp); if (use_filelist) { - for (int i = 0; i < cmdargc; i++) { - if (filelist_pos && !strcmp(FEH_FILE(filelist_pos->data)->filename, cmdargv[i])) { - /* argument is a file */ - absolute_path = feh_absolute_path(cmdargv[i]); - fputs(shell_escape(absolute_path), fp); - filelist_pos = filelist_pos->next; - free(absolute_path); - fputc(' ', fp); - } +#ifdef HAVE_LIBXINERAMA + for (int i = 0; (i < num_xinerama_screens) && filelist_pos; i++) { +#else + for (int i = 0; (i < 1 ) && filelist_pos; i++) { +#endif + absolute_path = feh_absolute_path(FEH_FILE(filelist_pos->data)->filename); + fputs(shell_escape(absolute_path), fp); + filelist_pos = filelist_pos->next; + free(absolute_path); + fputc(' ', fp); } } else if (fil) { absolute_path = feh_absolute_path(fil); -- cgit v1.2.3 From 668fad7ad971b42c90222189acf7380955622e58 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 11 Feb 2019 09:42:20 +0100 Subject: Unset "start paused" flag on positive slideshow delay This fixes "feh -D -1 -D 1" and similar starting the slideshow in paused mode even though the last -D option specifies autostart. --- src/options.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/options.c b/src/options.c index c9b5a1c..b34dbe9 100644 --- a/src/options.c +++ b/src/options.c @@ -470,6 +470,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) if (opt.slideshow_delay < 0.0) { opt.slideshow_delay *= (-1); opt.paused = 1; + } else { + opt.paused = 0; } break; case 'E': -- cgit v1.2.3 From c781929899dd281db89ab29b472c5d92393db0d5 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 11 Feb 2019 17:08:52 +0100 Subject: Unset "draw info" flag when encountering --info ';whatever' Otherwise, several --info switches will not properly override each other --- src/options.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/options.c b/src/options.c index b34dbe9..37fad88 100644 --- a/src/options.c +++ b/src/options.c @@ -753,10 +753,12 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 234: opt.info_cmd = estrdup(optarg); - if (opt.info_cmd[0] == ';') + if (opt.info_cmd[0] == ';') { + opt.draw_info = 0; opt.info_cmd++; - else + } else { opt.draw_info = 1; + } break; case 235: opt.force_aliasing = 1; -- cgit v1.2.3 From 942841ef4d99522eed37609a24ecb8786cb51659 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 11 Feb 2019 17:31:45 +0100 Subject: remove debug printf --- src/winwidget.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/winwidget.c b/src/winwidget.c index 4f5f4a6..bb4fdae 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -203,7 +203,6 @@ void winwidget_create_window(winwidget ret, int w, int h) } if (opt.paused) { - printf("name %s\n", ret->name); tmpname = estrjoin(" ", ret->name, "[Paused]", NULL); free(ret->name); ret->name = tmpname; -- cgit v1.2.3 From d63e1cdd97d9c492733c798d1b5f55c0267b0160 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 14 Feb 2019 17:40:47 +0100 Subject: Do not omit filenames in ~/.fehbg when using --no-xinerama (#456) --- src/wallpaper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/wallpaper.c b/src/wallpaper.c index f0bf891..9df259f 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -503,7 +503,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, fputc(' ', fp); if (use_filelist) { #ifdef HAVE_LIBXINERAMA - for (int i = 0; (i < num_xinerama_screens) && filelist_pos; i++) { + for (int i = 0; (i < opt.xinerama ? num_xinerama_screens : 1) && filelist_pos; i++) { #else for (int i = 0; (i < 1 ) && filelist_pos; i++) { #endif -- cgit v1.2.3 From 18dd1c5ea218c1b86e305d3ee0052335b1e22fc8 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 26 Mar 2019 17:19:39 +0100 Subject: Make SIGUSR1 / SIGUSR2 relaod the current image in single-file slideshows --- man/feh.pre | 10 +++++++--- src/signals.c | 13 +++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/man/feh.pre b/man/feh.pre index 913b9b3..b1ef16a 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1856,7 +1856,7 @@ So, to enlarge a specific part of an image, click the zoom button on that part. . .Sh SIGNALS . -In slideshow mode, +In slideshow and multiwindow mode, .Nm handles the following signals: . @@ -1864,11 +1864,15 @@ handles the following signals: . .It Dv SIGUSR1 . -Switch to next image +Slideshow mode: switch to next image; +reload current image if the slideshow consists of a single file. +Multiwindow mode: reload all images. . .It Dv SIGUSR2 . -Switch to previous image +Slideshow mode: switch to previous image; +reload current image if the slideshow consists of a single file. +Multiwindow mode: reload all images. . .El . diff --git a/src/signals.c b/src/signals.c index d65f49b..85d81bc 100644 --- a/src/signals.c +++ b/src/signals.c @@ -24,6 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "feh.h" +#include "filelist.h" #include "winwidget.h" #include "options.h" @@ -94,10 +95,14 @@ void feh_handle_signal(int signo) winwid = winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW); if (winwid) { - if (signo == SIGUSR1) - slideshow_change_image(winwid, SLIDE_NEXT, 1); - else if (signo == SIGUSR2) - slideshow_change_image(winwid, SLIDE_PREV, 1); + if (filelist_len > 1) { + if (signo == SIGUSR1) + slideshow_change_image(winwid, SLIDE_NEXT, 1); + else if (signo == SIGUSR2) + slideshow_change_image(winwid, SLIDE_PREV, 1); + } else { + feh_reload_image(winwid, 0, 0); + } } else if (opt.multiwindow) { for (i = window_num - 1; i >= 0; i--) feh_reload_image(windows[i], 0, 0); -- cgit v1.2.3