diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/debug.h | 2 | ||||
-rw-r--r-- | src/events.c | 24 | ||||
-rw-r--r-- | src/exif.c | 2 | ||||
-rw-r--r-- | src/feh.h | 8 | ||||
-rw-r--r-- | src/filelist.c | 8 | ||||
-rw-r--r-- | src/filelist.h | 2 | ||||
-rw-r--r-- | src/gib_hash.c | 2 | ||||
-rw-r--r-- | src/gib_hash.h | 2 | ||||
-rw-r--r-- | src/gib_imlib.c | 3 | ||||
-rw-r--r-- | src/gib_imlib.h | 2 | ||||
-rw-r--r-- | src/help.raw | 4 | ||||
-rw-r--r-- | src/imlib.c | 157 | ||||
-rw-r--r-- | src/index.c | 2 | ||||
-rw-r--r-- | src/index.h | 2 | ||||
-rw-r--r-- | src/keyevents.c | 8 | ||||
-rw-r--r-- | src/list.c | 2 | ||||
-rw-r--r-- | src/main.c | 45 | ||||
-rw-r--r-- | src/menu.c | 20 | ||||
-rw-r--r-- | src/menu.h | 2 | ||||
-rw-r--r-- | src/options.c | 8 | ||||
-rw-r--r-- | src/options.h | 2 | ||||
-rw-r--r-- | src/signals.c | 26 | ||||
-rw-r--r-- | src/signals.h | 5 | ||||
-rw-r--r-- | src/slideshow.c | 8 | ||||
-rw-r--r-- | src/structs.h | 2 | ||||
-rw-r--r-- | src/strverscmp.c | 6 | ||||
-rw-r--r-- | src/thumbnail.c | 8 | ||||
-rw-r--r-- | src/thumbnail.h | 6 | ||||
-rw-r--r-- | src/timers.c | 2 | ||||
-rw-r--r-- | src/wallpaper.c | 2 | ||||
-rw-r--r-- | src/wallpaper.h | 2 | ||||
-rw-r--r-- | src/winwidget.c | 4 | ||||
-rw-r--r-- | src/winwidget.h | 2 |
33 files changed, 207 insertions, 173 deletions
diff --git a/src/debug.h b/src/debug.h index 569637e..0ff1447 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,7 +1,7 @@ /* debug.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/events.c b/src/events.c index 81b7157..de9e7b3 100644 --- a/src/events.c +++ b/src/events.c @@ -1,7 +1,7 @@ /* events.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -681,16 +681,18 @@ static void feh_event_handle_MotionNotify(XEvent * ev) } else { while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev)); winwid = winwidget_get_from_window(ev->xmotion.window); - if ((winwid != NULL) && (winwid->type == WIN_TYPE_THUMBNAIL)) { - feh_thumbnail *thumbnail; - int x, y; - - x = (ev->xbutton.x - winwid->im_x) / winwid->zoom; - y = (ev->xbutton.y - winwid->im_y) / winwid->zoom; - thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); - feh_thumbnail_select(winwid, thumbnail); - } else { - feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); + if (winwid != NULL) { + if (winwid->type == WIN_TYPE_THUMBNAIL) { + feh_thumbnail *thumbnail; + int x, y; + + x = (ev->xbutton.x - winwid->im_x) / winwid->zoom; + y = (ev->xbutton.y - winwid->im_y) / winwid->zoom; + thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); + feh_thumbnail_select(winwid, thumbnail); + } else { + feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); + } } } return; @@ -1,7 +1,7 @@ /* exif.c Copyright (C) 2012 Dennis Real. -Copyright (C) 2021 Daniel Friesel. +Copyright (C) 2021 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -1,7 +1,7 @@ /* feh.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -145,6 +145,10 @@ void init_slideshow_mode(void); void init_list_mode(void); void init_loadables_mode(void); void init_unloadables_mode(void); +#ifdef HAVE_LIBMAGIC +void uninit_magic(void); +void init_magic(void); +#endif void feh_clean_exit(void); int feh_should_ignore_image(Imlib_Image * im); int feh_load_image(Imlib_Image * im, feh_file * file); @@ -156,7 +160,7 @@ void init_buttonbindings(void); void setup_stdin(void); void restore_stdin(void); void feh_event_handle_keypress(XEvent * ev); -void feh_event_handle_stdin(); +void feh_event_handle_stdin(void); void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button); fehkey *feh_str_to_kb(char * action); void feh_action_run(feh_file * file, char *action, winwidget winwid); diff --git a/src/filelist.c b/src/filelist.c index 811151e..f1e820c 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -1,7 +1,7 @@ /* filelist.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -37,7 +37,6 @@ gib_list *filelist = NULL; gib_list *original_file_items = NULL; /* original file items from argv */ int filelist_len = 0; gib_list *current_file = NULL; -extern int errno; static gib_list *rm_filelist = NULL; @@ -156,7 +155,7 @@ static void feh_print_stat_error(char *path) } } -static void add_stdin_to_filelist() +static void add_stdin_to_filelist(void) { char buf[1024]; size_t readsize; @@ -181,6 +180,7 @@ static void add_stdin_to_filelist() while ((readsize = fread(buf, sizeof(char), sizeof(buf), stdin)) > 0) { if (fwrite(buf, sizeof(char), readsize, outfile) < readsize) { free(sfn); + fclose(outfile); return; } } @@ -657,7 +657,7 @@ char *feh_absolute_path(char *path) return(ret); } -void feh_save_filelist() +void feh_save_filelist(void) { char *tmpname; char *base_dir = ""; diff --git a/src/filelist.h b/src/filelist.h index ff0645e..7f263dc 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -96,7 +96,7 @@ int feh_write_filelist(gib_list * list, char *filename); gib_list *feh_read_filelist(char *filename); char *feh_absolute_path(char *path); gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l); -void feh_save_filelist(); +void feh_save_filelist(void); char *feh_http_unescape(char * url); int feh_cmp_name(void *file1, void *file2); diff --git a/src/gib_hash.c b/src/gib_hash.c index 127946a..9497d04 100644 --- a/src/gib_hash.c +++ b/src/gib_hash.c @@ -53,7 +53,7 @@ void gib_hash_node_free_and_data(gib_hash_node *node) return; } -gib_hash *gib_hash_new() +gib_hash *gib_hash_new(void) { gib_hash *hash = emalloc(sizeof(gib_hash)); hash->base = gib_hash_node_new("__gib_hash_new",NULL); diff --git a/src/gib_hash.h b/src/gib_hash.h index 58506c8..125e280 100644 --- a/src/gib_hash.h +++ b/src/gib_hash.h @@ -55,7 +55,7 @@ gib_hash_node *gib_hash_node_new(char *key, void *data); void gib_hash_node_free(gib_hash_node *node); void gib_hash_node_free_and_data(gib_hash_node *node); -gib_hash *gib_hash_new(); +gib_hash *gib_hash_new(void); void gib_hash_free(gib_hash *hash); void gib_hash_free_and_data(gib_hash *hash); diff --git a/src/gib_imlib.c b/src/gib_imlib.c index be3b427..39d0081 100644 --- a/src/gib_imlib.c +++ b/src/gib_imlib.c @@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "debug.h" +/* int gib_imlib_load_image(Imlib_Image * im, char *filename) { @@ -38,7 +39,6 @@ gib_imlib_load_image(Imlib_Image * im, char *filename) *im = imlib_load_image_with_error_return(filename, &err); if ((err) || (!im)) { - /* Check error code */ switch (err) { case IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST: @@ -91,6 +91,7 @@ gib_imlib_load_image(Imlib_Image * im, char *filename) } return (1); } +*/ int gib_imlib_image_get_width(Imlib_Image im) diff --git a/src/gib_imlib.h b/src/gib_imlib.h index 07daabe..6a35e7e 100644 --- a/src/gib_imlib.h +++ b/src/gib_imlib.h @@ -47,7 +47,9 @@ extern "C" { #endif +/* int gib_imlib_load_image(Imlib_Image * im, char *filename); +*/ int gib_imlib_image_get_width(Imlib_Image im); int gib_imlib_image_get_height(Imlib_Image im); int gib_imlib_image_has_alpha(Imlib_Image im); diff --git a/src/help.raw b/src/help.raw index 3c65fcc..e218e78 100644 --- a/src/help.raw +++ b/src/help.raw @@ -41,7 +41,7 @@ OPTIONS --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 - --on-last-slide quit Exit after one loop through the slide show + --on-last-slide quit Exit after one loop through the slide show (old --cycle-once) --on-last-slide hold Stop at both ends of the filelist -R, --reload NUM Reload images after NUM seconds -k, --keep-http Keep local copies when viewing HTTP/FTP files @@ -204,7 +204,7 @@ DEFAULT 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-2020. +Copyright Birte Kristina Friesel (and various contributors) 2010-2020. Homepage: http://feh.finalrewind.org Report bugs to <derf+feh@finalrewind.org> or #feh on irc.oftc.net. diff --git a/src/imlib.c b/src/imlib.c index 6d709a2..143807d 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1,7 +1,7 @@ /* imlib.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -44,6 +44,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "exif.h" #endif +#ifdef HAVE_LIBMAGIC +#include <magic.h> + +magic_t magic = NULL; +#endif + Display *disp = NULL; Visual *vis = NULL; Screen *scr = NULL; @@ -227,6 +233,14 @@ void feh_print_load_error(char *file, winwidget w, Imlib_Load_Error err, enum fe case IMLIB_LOAD_ERROR_OUT_OF_DISK_SPACE: im_weprintf(w, "%s - Cannot write - out of disk space", file); break; +#if defined(IMLIB2_VERSION_MAJOR) && defined(IMLIB2_VERSION_MINOR) && (IMLIB2_VERSION_MAJOR > 1 || IMLIB2_VERSION_MINOR > 7) + case IMLIB_LOAD_ERROR_IMAGE_READ: + im_weprintf(w, "%s - Invalid image file", file); + break; + case IMLIB_LOAD_ERROR_IMAGE_FRAME: + im_weprintf(w, "%s - Requested frame not in image", file); + break; +#endif default: im_weprintf(w, "While loading %s - Unknown error (%d)", file, err); @@ -235,6 +249,33 @@ void feh_print_load_error(char *file, winwidget w, Imlib_Load_Error err, enum fe } } +#ifdef HAVE_LIBMAGIC +void uninit_magic(void) +{ + if (!magic) { + return; + } + + magic_close(magic); + magic = NULL; +} +void init_magic(void) +{ + if (getenv("FEH_SKIP_MAGIC")) { + return; + } + + if (!(magic = magic_open(MAGIC_NONE))) { + weprintf("unable to initialize magic library\n"); + return; + } + + if (magic_load(magic, NULL) != 0) { + weprintf("cannot load magic database: %s\n", magic_error(magic)); + uninit_magic(); + } +} + /* * This is a workaround for an Imlib2 regression, causing unloadable image * detection to be excessively slow (and, thus, causing feh to hang for a while @@ -242,99 +283,48 @@ void feh_print_load_error(char *file, winwidget w, Imlib_Load_Error err, enum fe * avoid calling Imlib2 for files it probably cannot handle. See * <https://phab.enlightenment.org/T8739> and * <https://github.com/derf/feh/issues/505>. - * - * Note that this drops support for bz2-compressed files, unless - * FEH_SKIP_MAGIC is set */ -int feh_is_image(feh_file * file) +int feh_is_image(feh_file * file, int magic_flags) { - unsigned char buf[16]; - FILE *fh = fopen(file->filename, "r"); - if (!fh) { - return 0; - } - // Files smaller than buf will be padded with zeroes - memset(buf, 0, sizeof(buf)); - if (fread(buf, 1, 16, fh) <= 0) { - fclose(fh); - return 0; - } - fclose(fh); + const char * mime_type = NULL; - if (buf[0] == 0xff && buf[1] == 0xd8) { - // JPEG - return 1; - } - if (!memcmp(buf, "\x89PNG\x0d\x0a\x1a\x0a", 8)) { - // PNG - return 1; - } - if (buf[0] == 'A' && buf[1] == 'R' && buf[2] == 'G' && buf[3] == 'B') { - // ARGB - return 1; - } - if (buf[0] == 'B' && buf[1] == 'M') { - // BMP - return 1; - } - if (!memcmp(buf, "farbfeld", 8)) { - // farbfeld + if (!magic) { return 1; } - if (buf[0] == 'G' && buf[1] == 'I' && buf[2] == 'F') { - // GIF - return 1; - } - if (buf[0] == 0x00 && buf[1] == 0x00 && buf[2] <= 0x02 && buf[3] == 0x00) { - // ICO - return 1; - } - if (!memcmp(buf, "FORM", 4)) { - // Amiga IFF ILBM - return 1; - } - if (buf[0] == 'P' && buf[1] >= '1' && buf[1] <= '7') { - // PNM et al. - return 1; - } - if (strstr(file->filename, ".tga")) { - // TGA - return 1; - } - if (!memcmp(buf, "II\x2a\x00", 4) || !memcmp(buf, "MM\x00\x2a", 4)) { - // TIFF - return 1; - } - if (!memcmp(buf, "RIFF", 4)) { - // might be webp - return 1; - } - if (!memcmp(buf + 4, "ftyphei", 7) || !memcmp(buf + 4, "ftypmif1", 8)) { - // HEIC/HEIF - note that this is only supported in imlib2-heic. Ordinary - // imlib2 releases do not support heic/heif images as of 2021-01. - return 1; - } - if ((buf[0] == 0xff && buf[1] == 0x0a) || !memcmp(buf, "\x00\x00\x00\x0cJXL \x0d\x0a\x87\x0a", 12)) { - // JXL - note that this is only supported in imlib2-jxl. Ordinary - // imlib2 releases do not support JXL images as of 2021-06. - return 1; + + magic_setflags(magic, MAGIC_MIME_TYPE | MAGIC_SYMLINK | magic_flags); + mime_type = magic_file(magic, file->filename); + + if (!mime_type) { + return 0; } - buf[15] = 0; - if (strstr((char *)buf, "XPM")) { - // XPM + + D(("file %s has mime type: %s\n", file->filename, mime_type)); + + if (strncmp(mime_type, "image/", 6) == 0) { return 1; } - if (strstr(file->filename, ".bz2") || strstr(file->filename, ".gz")) { - // Imlib2 supports compressed images. It relies on the filename to - // determine the appropriate loader and does not use magic bytes here. - return 1; + + /* no infinite loop on compressed content, please */ + if (magic_flags) { + return 0; } - // moved to the end as this variable won't be set in most cases - if (getenv("FEH_SKIP_MAGIC")) { - return 1; + + /* imlib2 supports loading compressed images, let's have a look inside */ + if (strcmp(mime_type, "application/gzip") == 0 || + strcmp(mime_type, "application/x-bzip2") == 0 || + strcmp(mime_type, "application/x-xz") == 0) { + return feh_is_image(file, MAGIC_COMPRESS); } + return 0; } +#else +int feh_is_image(__attribute__((unused)) feh_file * file, __attribute__((unused)) int magic_flags) +{ + return 1; +} +#endif int feh_load_image(Imlib_Image * im, feh_file * file) { @@ -358,7 +348,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) } } else { - if (feh_is_image(file)) { + if (feh_is_image(file, 0)) { *im = imlib_load_image_with_error_return(file->filename, &err); } else { feh_err = LOAD_ERROR_MAGICBYTES; @@ -913,6 +903,7 @@ static char *feh_http_load_image(char *url) curl_easy_setopt(curl, CURLOPT_WRITEDATA, sfp); ebuff = emalloc(CURL_ERROR_SIZE); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, ebuff); + curl_easy_setopt(curl, CURLOPT_USERAGENT, PACKAGE "/" VERSION); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); #if LIBCURL_VERSION_NUM >= 0x072000 /* 07.32.0 */ diff --git a/src/index.c b/src/index.c index 4c00321..b0b6923 100644 --- a/src/index.c +++ b/src/index.c @@ -1,7 +1,7 @@ /* index.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/index.h b/src/index.h index b022f1a..b805cc0 100644 --- a/src/index.h +++ b/src/index.h @@ -1,6 +1,6 @@ /* index.h -Copyright (C) 2018 Daniel Friesel. +Copyright (C) 2018 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/keyevents.c b/src/keyevents.c index 4d6759a..2f9b1d6 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -1,7 +1,7 @@ /* keyevents.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -35,7 +35,7 @@ struct __fehkey keys[EVENT_LIST_END]; struct termios old_term_settings; unsigned char control_via_stdin = 0; -void setup_stdin() { +void setup_stdin(void) { struct termios ctrl; control_via_stdin = 1; @@ -55,7 +55,7 @@ void setup_stdin() { eprintf("tcsetattr failed"); } -void restore_stdin() { +void restore_stdin(void) { if (tcsetattr(STDIN_FILENO, TCSANOW, &old_term_settings) == -1) eprintf("tcsetattr failed"); } @@ -314,7 +314,7 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action) return; } -void feh_event_handle_stdin() +void feh_event_handle_stdin(void) { char stdin_buf[2]; static char is_esc = 0; @@ -1,7 +1,7 @@ /* list.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -1,7 +1,7 @@ /* main.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -49,6 +49,11 @@ int main(int argc, char **argv) srandom(getpid() * time(NULL) % ((unsigned int) -1)); setup_signal_handlers(); + +#ifdef HAVE_LIBMAGIC + init_magic(); +#endif + init_parse_options(argc, argv); init_imlib_fonts(); @@ -102,6 +107,28 @@ int main(int argc, char **argv) return(sig_exit); } +static void feh_process_signal(void) +{ + winwidget winwid = winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW); + int i; + int signo = sig_received; + sig_received = 0; + + if (winwid) { + 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); + } +} + /* Return 0 to stop iterating, 1 if ok to continue. */ int feh_main_iteration(int block) { @@ -119,6 +146,10 @@ int feh_main_iteration(int block) if (window_num == 0 || sig_exit != 0) return(0); + if (sig_received) { + feh_process_signal(); + } + if (first) { /* Only need to set these up the first time */ xfd = ConnectionNumber(disp); @@ -151,6 +182,10 @@ int feh_main_iteration(int block) if (window_num == 0 || sig_exit != 0) return(0); + + if (sig_received) { + feh_process_signal(); + } } XFlush(disp); @@ -244,6 +279,10 @@ int feh_main_iteration(int block) if (window_num == 0 || sig_exit != 0) return(0); + if (sig_received) { + feh_process_signal(); + } + return(1); } @@ -262,6 +301,10 @@ void feh_clean_exit(void) if(disp) XCloseDisplay(disp); +#ifdef HAVE_LIBMAGIC + uninit_magic(); +#endif + /* * Only restore the old terminal settings if * - we changed them in the first place @@ -1,7 +1,7 @@ /* menu.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -825,21 +825,17 @@ void feh_menu_draw_toggle_at(int x, int y, int w, int h, Imlib_Image dst, int ox void feh_menu_draw_submenu_at(int x, int y, Imlib_Image dst, int ox, int oy) { - ImlibPolygon poly; - - x -= ox; + // Draw filled triangle + x -= ox; y -= oy; imlib_context_set_image(dst); - - poly = imlib_polygon_new(); - imlib_polygon_add_point(poly, x, y + 3); - imlib_polygon_add_point(poly, x + 3, y + 6); - imlib_polygon_add_point(poly, x, y + 9); imlib_context_set_color(0, 0, 0, 255); - imlib_image_fill_polygon(poly); - imlib_polygon_free(poly); + for (int i= 0; i <= 3; i++) { + imlib_image_draw_line(x+i, y+3+i, x+i, y+9-i, 0); + } + return; } @@ -936,7 +932,7 @@ void feh_menu_init_main(void) return; } -void feh_menu_init_common() +void feh_menu_init_common(void) { int num_desks, i; char buf[30]; @@ -1,7 +1,7 @@ /* menu.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/options.c b/src/options.c index 71c65e2..0fc656d 100644 --- a/src/options.c +++ b/src/options.c @@ -1,7 +1,7 @@ /* options.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -537,6 +537,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) case OPTION_sort: if (!strcasecmp(optarg, "name")) opt.sort = SORT_NAME; + else if (!strcasecmp(optarg, "none")) + opt.sort = SORT_NONE; else if (!strcasecmp(optarg, "filename")) opt.sort = SORT_FILENAME; else if (!strcasecmp(optarg, "dirname")) @@ -976,6 +978,10 @@ static void show_version(void) "help " #endif +#ifdef HAVE_LIBMAGIC + "magic " +#endif + #if _FILE_OFFSET_BITS == 64 "stat64 " #endif diff --git a/src/options.h b/src/options.h index 6441e8b..aa3cd91 100644 --- a/src/options.h +++ b/src/options.h @@ -1,7 +1,7 @@ /* options.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/signals.c b/src/signals.c index a64f935..5a64883 100644 --- a/src/signals.c +++ b/src/signals.c @@ -1,6 +1,6 @@ /* signals.c -Copyright (C) 2010-2020 by Daniel Friesel +Copyright (C) 2010-2020 by Birte Kristina Friesel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -29,9 +29,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "options.h" void feh_handle_signal(int); +volatile int sig_received = 0; volatile int sig_exit = 0; -void setup_signal_handlers() +void setup_signal_handlers(void) { struct sigaction feh_sh; sigset_t feh_ss; @@ -71,9 +72,6 @@ void setup_signal_handlers() void feh_handle_signal(int signo) { - winwidget winwid; - int i; - switch (signo) { case SIGALRM: if (childpid) @@ -92,21 +90,5 @@ void feh_handle_signal(int signo) return; } - winwid = winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW); - - if (winwid) { - 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); - } - - return; + sig_received = signo; } diff --git a/src/signals.h b/src/signals.h index bff737e..505a071 100644 --- a/src/signals.h +++ b/src/signals.h @@ -1,6 +1,6 @@ /* signals.h -Copyright (C) 2010 by Daniel Friesel +Copyright (C) 2010 by Birte Kristina Friesel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef SIGNALS_H #define SIGNALS_H -void setup_signal_handlers(); +void setup_signal_handlers(void); extern volatile int sig_exit; +extern volatile int sig_received; #endif diff --git a/src/slideshow.c b/src/slideshow.c index 80bd476..a53749e 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -1,7 +1,7 @@ /* slideshow.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -529,6 +529,12 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid) strncat(ret, buf, sizeof(ret) - strlen(ret) - 1); } break; + case 'W': + if (winwid) { + snprintf(buf, sizeof(buf), "%dx%d+%d+%d", winwid->w, winwid->h, winwid->x, winwid->y); + strncat(ret, buf, sizeof(ret) - strlen(ret) - 1); + } + break; case 'z': if (winwid) { snprintf(buf, sizeof(buf), "%.2f", winwid->zoom); diff --git a/src/structs.h b/src/structs.h index 3e2a1aa..8438930 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,7 +1,7 @@ /* structs.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/strverscmp.c b/src/strverscmp.c index 92cd877..ddc6b6d 100644 --- a/src/strverscmp.c +++ b/src/strverscmp.c @@ -41,9 +41,9 @@ int strverscmp(const char *l0, const char *r0) else if (c!='0') z=0; } - if (l[dp]!='0' && r[dp]!='0') { - /* If we're not looking at a digit sequence that began - * with a zero, longest digit string is greater. */ + if (l[dp]-'1'<9U && r[dp]-'1'<9U) { + /* If we're looking at non-degenerate digit sequences starting + * with nonzero digits, longest digit string is greater. */ for (j=i; isdigit(l[j]); j++) if (!isdigit(r[j])) return 1; if (isdigit(r[j])) return -1; diff --git a/src/thumbnail.c b/src/thumbnail.c index e4a5f60..77c0acd 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -1,7 +1,7 @@ /* thumbnail.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -593,7 +593,7 @@ int feh_thumbnail_get_thumbnail(Imlib_Image * image, feh_file * file, return status; } -static char *feh_thumbnail_get_prefix() +static char *feh_thumbnail_get_prefix(void) { char *dir = NULL, *home, *xdg_cache_home; @@ -882,13 +882,13 @@ void feh_thumbnail_select_prev(winwidget winwid, int jump) } } -void feh_thumbnail_show_selected() +void feh_thumbnail_show_selected(void) { if (td.selected && td.selected->file) feh_thumbnail_show_fullsize(td.selected->file); } -feh_file* feh_thumbnail_get_selected_file() +feh_file* feh_thumbnail_get_selected_file(void) { if (td.selected) return td.selected->file; diff --git a/src/thumbnail.h b/src/thumbnail.h index 61d3053..e69759f 100644 --- a/src/thumbnail.h +++ b/src/thumbnail.h @@ -1,7 +1,7 @@ /* thumbnail.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -83,8 +83,8 @@ void feh_thumbnail_show_fullsize(feh_file *thumbfile); void feh_thumbnail_select(winwidget winwid, feh_thumbnail *thumbnail); void feh_thumbnail_select_next(winwidget winwid, int jump); void feh_thumbnail_select_prev(winwidget winwid, int jump); -void feh_thumbnail_show_selected(); -feh_file *feh_thumbnail_get_selected_file(); +void feh_thumbnail_show_selected(void); +feh_file *feh_thumbnail_get_selected_file(void); int feh_thumbnail_setup_thumbnail_dir(void); diff --git a/src/timers.c b/src/timers.c index b2cdbc7..8e42050 100644 --- a/src/timers.c +++ b/src/timers.c @@ -1,7 +1,7 @@ /* timers.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/wallpaper.c b/src/wallpaper.c index 71cee29..e2fa67e 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -1,7 +1,7 @@ /* wallpaper.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/wallpaper.h b/src/wallpaper.h index 77769f8..c836c0f 100644 --- a/src/wallpaper.h +++ b/src/wallpaper.h @@ -1,7 +1,7 @@ /* wallpaper.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff --git a/src/winwidget.c b/src/winwidget.c index 9f61ba6..b98cbef 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -1,7 +1,7 @@ /* winwidget.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -739,7 +739,7 @@ void winwidget_inotify_remove(winwidget winwid) #ifdef HAVE_INOTIFY void winwidget_inotify_add(winwidget winwid, feh_file * file) { - if (opt.auto_reload) { + if (opt.auto_reload && !path_is_url(file->filename)) { D(("Adding inotify watch for %s\n", file->filename)); char dir[PATH_MAX]; feh_file_dirname(dir, file, PATH_MAX); diff --git a/src/winwidget.h b/src/winwidget.h index 9d74286..0894b5a 100644 --- a/src/winwidget.h +++ b/src/winwidget.h @@ -1,7 +1,7 @@ /* winwidget.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2020 Daniel Friesel. +Copyright (C) 2010-2020 Birte Kristina Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to |