From e91a10ecb2e1f7c237e77e47936932ce14fbec32 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 16 Sep 2017 01:32:57 +0200 Subject: Replace legacy signal(...) call with sigaction(...) --- src/wallpaper.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index 2f7810f..f40c613 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -779,10 +779,11 @@ void enl_ipc_send(char *str) return; } -static sighandler_t *enl_ipc_timeout(int sig) +void enl_ipc_timeout(int sig) { - timeout = 1; - return((sighandler_t *) sig); + if (sig == SIGALRM) + timeout = 1; + return; } char *enl_wait_for_reply(void) @@ -842,7 +843,8 @@ char *enl_ipc_get(const char *msg_data) char *enl_send_and_wait(char *msg) { char *reply = IPC_TIMEOUT; - sighandler_t old_alrm; + struct sigaction e17_sh, feh_sh; + sigset_t e17_ss; /* * Shortcut this func and return IPC_FAKE @@ -861,7 +863,19 @@ char *enl_send_and_wait(char *msg) sleep(1); } } - old_alrm = (sighandler_t) signal(SIGALRM, (sighandler_t) enl_ipc_timeout); + + if ((sigemptyset(&e17_ss) == -1) || sigaddset(&e17_ss, SIGALRM) == -1) { + weprintf("Failed to set up temporary E17 signal masks"); + return reply; + } + e17_sh.sa_handler = enl_ipc_timeout; + e17_sh.sa_mask = e17_ss; + e17_sh.sa_flags = 0; + if (sigaction(SIGALRM, &e17_sh, &feh_sh) == -1) { + weprintf("Failed to set up temporary E17 signal handler"); + return reply; + } + for (; reply == IPC_TIMEOUT;) { timeout = 0; enl_ipc_send(msg); @@ -873,6 +887,8 @@ char *enl_send_and_wait(char *msg) ipc_win = None; } } - signal(SIGALRM, old_alrm); + if (sigaction(SIGALRM, &feh_sh, NULL) == -1) { + weprintf("Failed to restore signal handler"); + } return(reply); } -- cgit v1.2.3 From 528616b3df854b3bfad30c2364bf2aaf000e3a6d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 3 Oct 2017 20:39:47 +0200 Subject: Always save user-provided commandline in ~/.fehbg This fixes --force-aliasing (and possibly other options) missing from the file. --- src/wallpaper.c | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index f40c613..e7f0b74 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -296,40 +296,11 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, Pixmap pmap_d1, pmap_d2; gib_list *l; - /* string for sticking in ~/.fehbg */ - char *fehbg = NULL; - char fehbg_args[512]; - fehbg_args[0] = '\0'; - char *argptr = fehbg_args; char *home; char filbuf[4096]; char *bgfill = NULL; bgfill = opt.image_bg == IMAGE_BG_WHITE ? "--image-bg white" : "--image-bg black" ; -#ifdef HAVE_LIBXINERAMA - if (opt.xinerama) { - if (opt.xinerama_index >= 0) { - snprintf(argptr, sizeof(fehbg_args), - "--xinerama-index %d", opt.xinerama_index); - } - } - else - snprintf(argptr, sizeof(fehbg_args), "--no-xinerama"); - argptr += strlen(argptr); -#endif /* HAVE_LIBXINERAMA */ - if ((opt.geom_flags & XValue) && (sizeof(fehbg_args) - strlen(fehbg_args) > 60)) { - snprintf(argptr, sizeof(fehbg_args) - strlen(fehbg_args), " --geometry %c%d", - opt.geom_flags & XNegative ? '-' : '+', - opt.geom_flags & XNegative ? abs(opt.geom_x) : opt.geom_x); - argptr += strlen(argptr); - if (opt.geom_flags & YValue) { - snprintf(argptr, sizeof(fehbg_args) - strlen(fehbg_args), "%c%d", - opt.geom_flags & YNegative ? '-' : '+', - opt.geom_flags & YNegative ? abs(opt.geom_y) : opt.geom_y); - argptr += strlen(argptr); - } - } - /* local display to set closedownmode on */ Display *disp2; Window root2; @@ -403,7 +374,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, #endif /* HAVE_LIBXINERAMA */ feh_wm_set_bg_scaled(pmap_d1, im, use_filelist, 0, 0, scr->width, scr->height); - fehbg = estrjoin(" ", "feh", fehbg_args, "--bg-scale", filbuf, NULL); } else if (centered) { D(("centering\n")); @@ -433,8 +403,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XFreeGC(disp, gc); - fehbg = estrjoin(" ", "feh", fehbg_args, bgfill, "--bg-center", filbuf, NULL); - } else if (filled == 1) { pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); @@ -464,8 +432,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, feh_wm_set_bg_filled(pmap_d1, im, use_filelist , 0, 0, scr->width, scr->height); - fehbg = estrjoin(" ", "feh", fehbg_args, "--bg-fill", filbuf, NULL); - } else if (filled == 2) { pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); @@ -493,8 +459,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XFreeGC(disp, gc); - fehbg = estrjoin(" ", "feh", fehbg_args, bgfill, "--bg-max", filbuf, NULL); - } else { if (use_filelist) feh_wm_load_next(&im); @@ -502,10 +466,9 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, h = gib_imlib_image_get_height(im); pmap_d1 = XCreatePixmap(disp, root, w, h, depth); gib_imlib_render_image_on_drawable(pmap_d1, im, 0, 0, 1, 0, 0); - fehbg = estrjoin(" ", "feh --bg-tile", filbuf, NULL); } - if (fehbg && !opt.no_fehbg) { + if (!opt.no_fehbg) { home = getenv("HOME"); if (home) { FILE *fp; @@ -515,7 +478,12 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, if ((fp = fopen(path, "w")) == NULL) { weprintf("Can't write to %s", path); } else { - fprintf(fp, "#!/bin/sh\n%s\n", fehbg); + fputs("#!/bin/sh\n", fp); + for (int i = 0; i < cmdargc; i++) { + fputs(shell_escape(cmdargv[i]), fp); + fputc(' ', fp); + } + fputc('\n', fp); fclose(fp); stat(path, &s); if (chmod(path, s.st_mode | S_IXUSR | S_IXGRP) != 0) { @@ -526,8 +494,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, } } - free(fehbg); - /* create new display, copy pixmap to new display */ disp2 = XOpenDisplay(NULL); if (!disp2) -- cgit v1.2.3 From cfad4c3640d76181dcba2e1feb5bd531178c9d3e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 1 Nov 2017 10:10:07 +0100 Subject: Fix ~/.fehbg not being updated when setting wallpaper via menu --- src/wallpaper.c | 69 +++++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 44 deletions(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index e7f0b74..222afdd 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -294,10 +294,8 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, unsigned long length, after; unsigned char *data_root = NULL, *data_esetroot = NULL; Pixmap pmap_d1, pmap_d2; - gib_list *l; char *home; - char filbuf[4096]; char *bgfill = NULL; bgfill = opt.image_bg == IMAGE_BG_WHITE ? "--image-bg white" : "--image-bg black" ; @@ -305,48 +303,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, Display *disp2; Window root2; int depth2; - int in, out, w, h; + int w, h; D(("Falling back to XSetRootWindowPixmap\n")); - /* Put the filename in filbuf between ' and escape ' in the filename */ - out = 0; - - if (fil && !use_filelist) { - filbuf[out++] = '\''; - - fil = feh_absolute_path(fil); - - for (in = 0; fil[in] && out < 4092; in++) { - - if (fil[in] == '\'') - filbuf[out++] = '\\'; - filbuf[out++] = fil[in]; - } - filbuf[out++] = '\''; - free(fil); - - } else { - for (l = filelist; l && out < 4092; l = l->next) { - filbuf[out++] = '\''; - - fil = feh_absolute_path(FEH_FILE(l->data)->filename); - - for (in = 0; fil[in] && out < 4092; in++) { - - if (fil[in] == '\'') - filbuf[out++] = '\\'; - filbuf[out++] = fil[in]; - } - filbuf[out++] = '\''; - filbuf[out++] = ' '; - free(fil); - } - } - - - filbuf[out++] = 0; - if (scaled) { pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); @@ -478,10 +438,31 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, if ((fp = fopen(path, "w")) == NULL) { weprintf("Can't write to %s", path); } else { - fputs("#!/bin/sh\n", fp); - for (int i = 0; i < cmdargc; i++) { - fputs(shell_escape(cmdargv[i]), fp); + fputs("#!/bin/sh\nexec ", fp); + if (use_filelist) { + for (int i = 0; i < cmdargc; i++) { + fputs(shell_escape(cmdargv[i]), fp); + fputc(' ', fp); + } + } else if (fil) { + fputs("feh --bg-", fp); + if (centered) + fputs("center", fp); + else if (scaled) + fputs("scale", fp); + else if (filled) + fputs("fill", fp); + else + fputs("tile", fp); + + if (opt.force_aliasing) + fputs(" --force-aliasing", fp); +#ifdef HAVE_LIBXINERAMA + if (!opt.xinerama) + fputs(" --no-xinerama", fp); +#endif fputc(' ', fp); + fputs(shell_escape(fil), fp); } fputc('\n', fp); fclose(fp); -- cgit v1.2.3 From 18bf1580744c20cac6739ec3b6fb46c070320b72 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 1 Nov 2017 10:59:41 +0100 Subject: wallpaper.c: Remove unused variable --- src/wallpaper.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index 222afdd..2a4743f 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -296,8 +296,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, Pixmap pmap_d1, pmap_d2; char *home; - char *bgfill = NULL; - bgfill = opt.image_bg == IMAGE_BG_WHITE ? "--image-bg white" : "--image-bg black" ; /* local display to set closedownmode on */ Display *disp2; -- cgit v1.2.3 From f6642257096c6fe0f78984d989790a3d9e1056fe Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 7 Nov 2017 07:52:52 +0100 Subject: Fix ~/.fehbg no longer being source-able (closes #342) --- ChangeLog | 6 ++++++ src/imlib.c | 2 +- src/wallpaper.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/wallpaper.c') diff --git a/ChangeLog b/ChangeLog index b5b814a..752b29d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue, 07 Nov 2017 07:51:48 +0100 + +* Release v2.22.1 + * Allow ~/.fehbg to be sourced (instead of executed) from other shell + scripts again (broken in 2.22) + Sat, 04 Nov 2017 14:55:38 +0100 Daniel Friesel * Release v2.22 diff --git a/src/imlib.c b/src/imlib.c index 82a9865..abdef4e 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -467,7 +467,7 @@ static char *feh_http_load_image(char *url) char *feh_http_load_image(char *url) { weprintf( - "Cannot load image %s\n Please recompile with libcurl support", + "Cannot load image %s\nPlease recompile feh with libcurl support", url ); return NULL; diff --git a/src/wallpaper.c b/src/wallpaper.c index 2a4743f..c9a3a05 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -436,7 +436,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, if ((fp = fopen(path, "w")) == NULL) { weprintf("Can't write to %s", path); } else { - fputs("#!/bin/sh\nexec ", fp); + fputs("#!/bin/sh\n", fp); if (use_filelist) { for (int i = 0; i < cmdargc; i++) { fputs(shell_escape(cmdargv[i]), fp); -- cgit v1.2.3 From 5965739a0aa6e1f91989a011746c2709cb4e92dc Mon Sep 17 00:00:00 2001 From: Paul O'Day Date: Tue, 26 Mar 2013 20:52:14 -0700 Subject: Allow any XColor values as --image-bg argument --- man/feh.pre | 2 +- src/feh.h | 2 -- src/help.raw | 2 +- src/options.c | 9 +-------- src/options.h | 2 +- src/wallpaper.c | 29 ++++++++++++----------------- src/winwidget.c | 26 ++++++++++++++------------ 7 files changed, 30 insertions(+), 42 deletions(-) (limited to 'src/wallpaper.c') diff --git a/man/feh.pre b/man/feh.pre index c2a4cd1..90e6b20 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -379,7 +379,7 @@ Hide the pointer .It Cm -B , --image-bg Ar style . Use style as background for transparent image parts and the like. -Accepted values: checks, white, black. +Accepted values: default, checks, or a XColor (eg. #428bdd). . The default for windowed mode is checks, while fullscreen defaults to black. . diff --git a/src/feh.h b/src/feh.h index a4a0a7b..3f0ce0c 100644 --- a/src/feh.h +++ b/src/feh.h @@ -107,8 +107,6 @@ enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_RAND, SLIDE_FIRST, SLIDE_LAST, SLIDE_JUMP_PREV_DIR }; -enum image_bg { IMAGE_BG_CHECKS = 1, IMAGE_BG_BLACK, IMAGE_BG_WHITE }; - #define INPLACE_EDIT_FLIP -1 #define INPLACE_EDIT_MIRROR -2 diff --git a/src/help.raw b/src/help.raw index 37e0e71..8b244c1 100644 --- a/src/help.raw +++ b/src/help.raw @@ -84,7 +84,7 @@ OPTIONS can be used multiple times to add multiple paths. -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: white, black, default + Accepted values: default, checks, or a XColor (eg. #428bdd) -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 diff --git a/src/options.c b/src/options.c index c874832..03f5ae3 100644 --- a/src/options.c +++ b/src/options.c @@ -449,14 +449,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.actions[0] = estrdup(optarg); break; case 'B': - if (!strcmp(optarg, "checks")) - opt.image_bg = IMAGE_BG_CHECKS; - else if (!strcmp(optarg, "white")) - opt.image_bg = IMAGE_BG_WHITE; - else if (!strcmp(optarg, "black")) - opt.image_bg = IMAGE_BG_BLACK; - else - weprintf("Unknown argument to --image-bg: %s", optarg); + opt.image_bg = estrdup(optarg); break; case 'C': D(("adding fontpath %s\n", optarg)); diff --git a/src/options.h b/src/options.h index c6959c8..fc9774e 100644 --- a/src/options.h +++ b/src/options.h @@ -71,7 +71,6 @@ struct __fehoptions { unsigned char cycle_once; unsigned char hold_actions[10]; unsigned char text_bg; - unsigned char image_bg; unsigned char no_fehbg; unsigned char keep_zoom_vp; unsigned char insecure_ssl; @@ -79,6 +78,7 @@ struct __fehoptions { char *output_file; char *output_dir; char *bg_file; + char *image_bg; char *font; char *title_font; char *title; diff --git a/src/wallpaper.c b/src/wallpaper.c index c9a3a05..5c50ad8 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -305,15 +305,19 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, D(("Falling back to XSetRootWindowPixmap\n")); + XColor color; + Colormap cmap = DefaultColormap(disp, DefaultScreen(disp)); + if (opt.image_bg) + XAllocNamedColor(disp, cmap, (char*) opt.image_bg, &color, &color); + else + XAllocNamedColor(disp, cmap, "black", &color, &color); + if (scaled) { pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); #ifdef HAVE_LIBXINERAMA if (opt.xinerama_index >= 0) { - if (opt.image_bg == IMAGE_BG_WHITE) - gcval.foreground = WhitePixel(disp, DefaultScreen(disp)); - else - gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); + gcval.foreground = color.pixel; gc = XCreateGC(disp, root, GCForeground, &gcval); XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height); XFreeGC(disp, gc); @@ -337,10 +341,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, D(("centering\n")); pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); - if (opt.image_bg == IMAGE_BG_WHITE) - gcval.foreground = WhitePixel(disp, DefaultScreen(disp)); - else - gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); + gcval.foreground = color.pixel; gc = XCreateGC(disp, root, GCForeground, &gcval); XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height); @@ -367,10 +368,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, #ifdef HAVE_LIBXINERAMA if (opt.xinerama_index >= 0) { - if (opt.image_bg == IMAGE_BG_WHITE) - gcval.foreground = WhitePixel(disp, DefaultScreen(disp)); - else - gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); + gcval.foreground = color.pixel; gc = XCreateGC(disp, root, GCForeground, &gcval); XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height); XFreeGC(disp, gc); @@ -393,10 +391,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, } else if (filled == 2) { pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth); - if (opt.image_bg == IMAGE_BG_WHITE) - gcval.foreground = WhitePixel(disp, DefaultScreen(disp)); - else - gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); + gcval.foreground = color.pixel; gc = XCreateGC(disp, root, GCForeground, &gcval); XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height); @@ -472,7 +467,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, free(path); } } - + /* create new display, copy pixmap to new display */ disp2 = XOpenDisplay(NULL); if (!disp2) diff --git a/src/winwidget.c b/src/winwidget.c index d636a85..e0796fa 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -391,17 +391,18 @@ void winwidget_setup_pixmaps(winwidget winwid) if (winwid->gc == None) { XGCValues gcval; - if (opt.image_bg == IMAGE_BG_WHITE) { - gcval.foreground = WhitePixel(disp, DefaultScreen(disp)); + if (!opt.image_bg || !strcmp(opt.image_bg, "default")) { + gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); winwid->gc = XCreateGC(disp, winwid->win, GCForeground, &gcval); - } - else if (opt.image_bg == IMAGE_BG_CHECKS) { + } else if (!strcmp(opt.image_bg, "checks")) { gcval.tile = feh_create_checks(); gcval.fill_style = FillTiled; winwid->gc = XCreateGC(disp, winwid->win, GCTile | GCFillStyle, &gcval); - } - else { - gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); + } else { + XColor color; + Colormap cmap = DefaultColormap(disp, DefaultScreen(disp)); + XAllocNamedColor(disp, cmap, (char*) opt.image_bg, &color, &color); + gcval.foreground = color.pixel; winwid->gc = XCreateGC(disp, winwid->win, GCForeground, &gcval); } } @@ -700,14 +701,15 @@ Pixmap feh_create_checks(void) if (!checks) eprintf("Unable to create a teeny weeny imlib image. I detect problems"); - if (opt.image_bg == IMAGE_BG_WHITE) - gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 255, 255, 255, 255); - else if (opt.image_bg == IMAGE_BG_BLACK) - gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 0, 0, 0, 255); - else { + if (!opt.image_bg || !strcmp(opt.image_bg, "default") || !strcmp(opt.image_bg, "checks")) { gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, 144, 144, 144, 255); gib_imlib_image_fill_rectangle(checks, 0, 0, 8, 8, 100, 100, 100, 255); gib_imlib_image_fill_rectangle(checks, 8, 8, 8, 8, 100, 100, 100, 255); + } else { + XColor color; + Colormap cmap = DefaultColormap(disp, DefaultScreen(disp)); + XAllocNamedColor(disp, cmap, (char*) opt.image_bg, &color, &color); + gib_imlib_image_fill_rectangle(checks, 0, 0, 16, 16, color.red, color.green, color.blue, 255); } checks_pmap = XCreatePixmap(disp, root, 16, 16, depth); -- cgit v1.2.3 From fe8ce5419da5f08e0923e759753b75edc53906b3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 29 Jan 2018 21:01:03 +0100 Subject: Include system headers before local ones to fix type conflict on OpenBSD --- src/feh_png.c | 4 ++-- src/feh_png.h | 4 ++-- src/gib_hash.c | 2 +- src/options.c | 3 ++- src/wallpaper.c | 6 ++++-- 5 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/wallpaper.c') diff --git a/src/feh_png.c b/src/feh_png.c index d27df01..d0c1c8a 100644 --- a/src/feh_png.c +++ b/src/feh_png.c @@ -23,13 +23,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "feh_png.h" - #include #include #include +#include "feh_png.h" + #define FEH_PNG_COMPRESSION 3 #define FEH_PNG_NUM_COMMENTS 4 diff --git a/src/feh_png.h b/src/feh_png.h index ac3375f..035d36a 100644 --- a/src/feh_png.h +++ b/src/feh_png.h @@ -26,11 +26,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef FEH_PNG_H #define FEH_PNG_H -#include "feh.h" - #include #include +#include "feh.h" + gib_hash *feh_png_read_comments(char *file); int feh_png_write_png_fd(Imlib_Image image, int fd, ...); diff --git a/src/gib_hash.c b/src/gib_hash.c index 15bbf4a..0d6a226 100644 --- a/src/gib_hash.c +++ b/src/gib_hash.c @@ -22,11 +22,11 @@ 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 #include "gib_hash.h" #include "utils.h" #include "debug.h" -#include gib_hash_node *gib_hash_node_new(char *key, void *data) { diff --git a/src/options.c b/src/options.c index c874832..837d7a8 100644 --- a/src/options.c +++ b/src/options.c @@ -24,10 +24,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include + #include "feh.h" #include "filelist.h" #include "options.h" -#include static void check_options(void); static void feh_getopt_theme(int argc, char **argv); diff --git a/src/wallpaper.c b/src/wallpaper.c index c9a3a05..34694ae 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -24,12 +24,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include +#include + #include "feh.h" #include "filelist.h" #include "options.h" #include "wallpaper.h" -#include -#include + Window ipc_win = None; Window my_ipc_win = None; Atom ipc_atom = None; -- cgit v1.2.3 From 8eaa39234a54fcdd3c9050a01790b152598af80d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 27 Feb 2018 19:35:59 +0100 Subject: Handle transparency when setting background images --- src/wallpaper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index cfefb8f..758a81a 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -91,7 +91,7 @@ static void feh_wm_set_bg_scaled(Pixmap pmap, Imlib_Image im, int use_filelist, feh_wm_load_next(&im); gib_imlib_render_image_on_drawable_at_size(pmap, im, x, y, w, h, - 1, 0, !opt.force_aliasing); + 1, 1, !opt.force_aliasing); if (use_filelist) gib_imlib_free_image_and_decache(im); @@ -132,7 +132,7 @@ static void feh_wm_set_bg_centered(Pixmap pmap, Imlib_Image im, int use_filelist y + ((offset_y > 0) ? offset_y : 0), w, h, - 1, 0, 0); + 1, 1, 0); if (use_filelist) gib_imlib_free_image_and_decache(im); @@ -212,7 +212,7 @@ static void feh_wm_set_bg_maxed(Pixmap pmap, Imlib_Image im, int use_filelist, gib_imlib_render_image_on_drawable_at_size(pmap, im, render_x, render_y, render_w, render_h, - 1, 0, !opt.force_aliasing); + 1, 1, !opt.force_aliasing); if (use_filelist) gib_imlib_free_image_and_decache(im); @@ -420,7 +420,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, w = gib_imlib_image_get_width(im); h = gib_imlib_image_get_height(im); pmap_d1 = XCreatePixmap(disp, root, w, h, depth); - gib_imlib_render_image_on_drawable(pmap_d1, im, 0, 0, 1, 0, 0); + gib_imlib_render_image_on_drawable(pmap_d1, im, 0, 0, 1, 1, 0); } if (!opt.no_fehbg) { -- cgit v1.2.3 From c2e0b7239522dc417b87f45cd133fb8f046dedfa Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 28 Feb 2018 19:44:21 +0100 Subject: Respect --geometry in --bg-fill (closes #209) --- man/feh.pre | 10 +++++----- src/wallpaper.c | 27 ++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 6 deletions(-) (limited to 'src/wallpaper.c') diff --git a/man/feh.pre b/man/feh.pre index 5290f79..46de5d1 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -919,13 +919,13 @@ instead. . .Pp . -For the -.Cm --bg-center +For +.Cm --bg-center , --bg-fill , and -.Cm --bg-max -options, you can use the +.Cm --bg-max , +you can use .Cm --geometry -option to specify an offset from one side of the screen instead of +to specify an offset from one side of the screen instead of centering the image. Positive values will offset from the left/top side, negative values from the bottom/right. +0 and -0 are both valid and distinct values. diff --git a/src/wallpaper.c b/src/wallpaper.c index 758a81a..2d3d3bc 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -160,11 +160,36 @@ static void feh_wm_set_bg_filled(Pixmap pmap, Imlib_Image im, int use_filelist, render_x = ( cut_x ? ((img_w - render_w) >> 1) : 0); render_y = ( !cut_x ? ((img_h - render_h) >> 1) : 0); + if ((opt.geom_flags & XValue) && cut_x) { + if (opt.geom_flags & XNegative) { + render_x = img_w - render_w + opt.geom_x; + } else { + render_x = opt.geom_x; + } + if (render_x < 0) { + render_x = 0; + } else if (render_x + render_w > img_w) { + render_x = img_w - render_w; + } + } + else if ((opt.geom_flags & YValue) && !cut_x) { + if (opt.geom_flags & YNegative) { + render_y = img_h - render_h + opt.geom_y; + } else { + render_y = opt.geom_y; + } + if (render_y < 0) { + render_y = 0; + } else if (render_y + render_h > img_h) { + render_y = img_h - render_h; + } + } + gib_imlib_render_image_part_on_drawable_at_size(pmap, im, render_x, render_y, render_w, render_h, x, y, w, h, - 1, 0, !opt.force_aliasing); + 1, 1, !opt.force_aliasing); if (use_filelist) gib_imlib_free_image_and_decache(im); -- cgit v1.2.3 From b05b89f404d44e2e2b3e675ccac09cfa7593eef4 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 18 Apr 2018 21:07:33 +0200 Subject: Always save absolute paths in ~/fehbg (closes #389) --- src/wallpaper.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index 2d3d3bc..8d15335 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -453,7 +453,9 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, if (home) { FILE *fp; char *path; + char *absolute_path; struct stat s; + gib_list *filelist_pos = filelist; path = estrjoin("/", home, ".fehbg", NULL); if ((fp = fopen(path, "w")) == NULL) { weprintf("Can't write to %s", path); @@ -461,7 +463,16 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, fputs("#!/bin/sh\n", fp); if (use_filelist) { for (int i = 0; i < cmdargc; i++) { - fputs(shell_escape(cmdargv[i]), fp); + 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); + } else { + /* argument is an option / option arg */ + fputs(shell_escape(cmdargv[i]), fp); + } fputc(' ', fp); } } else if (fil) { @@ -482,7 +493,9 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, fputs(" --no-xinerama", fp); #endif fputc(' ', fp); - fputs(shell_escape(fil), fp); + absolute_path = feh_absolute_path(fil); + fputs(shell_escape(absolute_path), fp); + free(absolute_path); } fputc('\n', fp); fclose(fp); -- cgit v1.2.3 From f68160e7fb3c86bfa14f8ea7faf0f3d104f4a457 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 10 May 2018 21:16:00 +0200 Subject: Only save background setting-related options in ~/.fehbg This restores pre-2.21 ~/.fehbg behaviour. Replicating the entire commandline in ~/.fehbg turned out to do more harm than good. Closes #398 --- man/feh.pre | 8 -------- src/wallpaper.c | 56 +++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 29 deletions(-) (limited to 'src/wallpaper.c') diff --git a/man/feh.pre b/man/feh.pre index 01b6377..a6b76ef 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -965,14 +965,6 @@ So to have your background restored every time you start X, you can add .Qq ~/.fehbg & to your X startup script .Pq such as Pa ~/.xinitrc . -Note that -.Pq unless the wallpaper is set via the menu -.Nm -saves the files and directories it was passed on the commandline, not the -files which actually ended up as wallpaper. -So, if you have randomization enabled, -.Pa ~/.fehbg -may set different wallpapers on each execution. . .Pp . diff --git a/src/wallpaper.c b/src/wallpaper.c index 8d15335..4eaa660 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -461,6 +461,40 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, weprintf("Can't write to %s", path); } else { fputs("#!/bin/sh\n", fp); + fputs(cmdargv[0], fp); + fputs(" --bg-", fp); + if (centered) + fputs("center", fp); + else if (scaled) + fputs("scale", fp); + else if (filled) + fputs("fill", fp); + else + fputs("tile", fp); +#ifdef HAVE_LIBXINERAMA + if (opt.xinerama) { + if (opt.xinerama_index >= 0) { + fprintf(fp, " --xinerama-index %d", opt.xinerama_index); + } + } + else { + fputs(" --no-xinerama", fp); + } +#endif /* HAVE_LIBXINERAMA */ + if (opt.geom_flags & XValue) { + fprintf(fp, " --geometry %c%d", + opt.geom_flags & XNegative ? '-' : '+', + opt.geom_flags & XNegative ? abs(opt.geom_x) : opt.geom_x); + if (opt.geom_flags & YValue) { + fprintf(fp, "%c%d", + opt.geom_flags & YNegative ? '-' : '+', + opt.geom_flags & YNegative ? abs(opt.geom_y) : opt.geom_y); + } + } + if (opt.force_aliasing) { + fputs(" --force-aliasing", fp); + } + fputc(' ', fp); if (use_filelist) { for (int i = 0; i < cmdargc; i++) { if (filelist_pos && !strcmp(FEH_FILE(filelist_pos->data)->filename, cmdargv[i])) { @@ -469,30 +503,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, fputs(shell_escape(absolute_path), fp); filelist_pos = filelist_pos->next; free(absolute_path); - } else { - /* argument is an option / option arg */ - fputs(shell_escape(cmdargv[i]), fp); + fputc(' ', fp); } - fputc(' ', fp); } } else if (fil) { - fputs("feh --bg-", fp); - if (centered) - fputs("center", fp); - else if (scaled) - fputs("scale", fp); - else if (filled) - fputs("fill", fp); - else - fputs("tile", fp); - - if (opt.force_aliasing) - fputs(" --force-aliasing", fp); -#ifdef HAVE_LIBXINERAMA - if (!opt.xinerama) - fputs(" --no-xinerama", fp); -#endif - fputc(' ', fp); absolute_path = feh_absolute_path(fil); fputs(shell_escape(absolute_path), fp); free(absolute_path); -- cgit v1.2.3 From 4e2e218cf0fffd0c74aa4bd44d7abd318166403f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 10 May 2018 21:23:28 +0200 Subject: Save image-bg setting in ~/.fehbg --- src/wallpaper.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index 4eaa660..6aa5c6d 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -471,6 +471,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, fputs("fill", fp); else fputs("tile", fp); + if (opt.image_bg) { + fputs(" --image-bg ", fp); + fputs(opt.image_bg, fp); + } #ifdef HAVE_LIBXINERAMA if (opt.xinerama) { if (opt.xinerama_index >= 0) { -- cgit v1.2.3 From 3c675a64a5842f0fe824a22bc9d3af025c1d17fe Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 11 May 2018 20:51:24 +0200 Subject: Update copyright notice --- man/feh.pre | 2 +- src/collage.c | 2 +- src/debug.h | 2 +- src/events.c | 2 +- src/feh.h | 2 +- src/filelist.c | 2 +- src/imlib.c | 2 +- src/index.c | 2 +- src/index.h | 2 +- src/keyevents.c | 2 +- src/list.c | 2 +- src/main.c | 2 +- src/menu.c | 2 +- src/menu.h | 2 +- src/options.c | 2 +- src/options.h | 2 +- src/signals.c | 2 +- src/slideshow.c | 2 +- src/structs.h | 2 +- src/thumbnail.c | 2 +- src/thumbnail.h | 2 +- src/timers.c | 2 +- src/wallpaper.c | 2 +- src/wallpaper.h | 2 +- src/winwidget.c | 2 +- src/winwidget.h | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/wallpaper.c') diff --git a/man/feh.pre b/man/feh.pre index a358714..d2c2cea 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1943,7 +1943,7 @@ Make zoom options more intuitive . Copyright (C) 1999, 2000 by Paul Duncan. Copyright (C) 1999, 2000 by Tom Gilbert (and various contributors). -Copyright (C) 2010-2016 by Daniel Friesel (and even more contributors). +Copyright (C) 2010-2018 by Daniel Friesel (and even more contributors). . .Pp . diff --git a/src/collage.c b/src/collage.c index 431d3b6..2a4d9f9 100644 --- a/src/collage.c +++ b/src/collage.c @@ -1,7 +1,7 @@ /* collage.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/debug.h b/src/debug.h index eb929e3..38cf83f 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,7 +1,7 @@ /* debug.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/events.c b/src/events.c index 947e69f..4a24935 100644 --- a/src/events.c +++ b/src/events.c @@ -1,7 +1,7 @@ /* events.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/feh.h b/src/feh.h index 3e0cdda..009f45b 100644 --- a/src/feh.h +++ b/src/feh.h @@ -1,7 +1,7 @@ /* feh.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/filelist.c b/src/filelist.c index 08da331..eb8e294 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -1,7 +1,7 @@ /* filelist.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/imlib.c b/src/imlib.c index 28dc1a6..5be0539 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1,7 +1,7 @@ /* imlib.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/index.c b/src/index.c index c8c34c5..ca1664b 100644 --- a/src/index.c +++ b/src/index.c @@ -1,7 +1,7 @@ /* index.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/index.h b/src/index.h index 08ab337..b022f1a 100644 --- a/src/index.h +++ b/src/index.h @@ -1,6 +1,6 @@ /* index.h -Copyright (C) 2011 Daniel Friesel. +Copyright (C) 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 diff --git a/src/keyevents.c b/src/keyevents.c index 12a8eb9..689aebd 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -1,7 +1,7 @@ /* keyevents.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/list.c b/src/list.c index 09b23f4..2f6cf76 100644 --- a/src/list.c +++ b/src/list.c @@ -1,7 +1,7 @@ /* list.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/main.c b/src/main.c index 534b89e..f1fca24 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,7 @@ /* main.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/menu.c b/src/menu.c index ddb2db1..2f8875d 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,7 +1,7 @@ /* menu.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/menu.h b/src/menu.h index 403728f..b53b32f 100644 --- a/src/menu.h +++ b/src/menu.h @@ -1,7 +1,7 @@ /* menu.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/options.c b/src/options.c index bc95604..8ddf2fa 100644 --- a/src/options.c +++ b/src/options.c @@ -1,7 +1,7 @@ /* options.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/options.h b/src/options.h index ed8641a..61de5dc 100644 --- a/src/options.h +++ b/src/options.h @@ -1,7 +1,7 @@ /* options.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/signals.c b/src/signals.c index 8a3a8f7..c08d5df 100644 --- a/src/signals.c +++ b/src/signals.c @@ -1,6 +1,6 @@ /* signals.c -Copyright (C) 2010 by Daniel Friesel +Copyright (C) 2010-2018 by 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 diff --git a/src/slideshow.c b/src/slideshow.c index 7bad2c9..0e560d8 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -1,7 +1,7 @@ /* slideshow.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/structs.h b/src/structs.h index 3942bc0..ce30eb9 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,7 +1,7 @@ /* structs.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/thumbnail.c b/src/thumbnail.c index 3e99bfb..cf38cfc 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -1,7 +1,7 @@ /* thumbnail.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/thumbnail.h b/src/thumbnail.h index f22ff77..09cd771 100644 --- a/src/thumbnail.h +++ b/src/thumbnail.h @@ -1,7 +1,7 @@ /* thumbnail.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/timers.c b/src/timers.c index 1cac94b..95fc9f8 100644 --- a/src/timers.c +++ b/src/timers.c @@ -1,7 +1,7 @@ /* timers.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/wallpaper.c b/src/wallpaper.c index 6aa5c6d..7cf2468 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -1,7 +1,7 @@ /* wallpaper.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/wallpaper.h b/src/wallpaper.h index 0921129..02a6997 100644 --- a/src/wallpaper.h +++ b/src/wallpaper.h @@ -1,7 +1,7 @@ /* wallpaper.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/winwidget.c b/src/winwidget.c index 7aae191..cd5a745 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -1,7 +1,7 @@ /* winwidget.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 diff --git a/src/winwidget.h b/src/winwidget.h index dd8489a..3d998b4 100644 --- a/src/winwidget.h +++ b/src/winwidget.h @@ -1,7 +1,7 @@ /* winwidget.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +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 -- cgit v1.2.3 From b359a39b1684455dd91781a8b49906d7eb18fb62 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 16 May 2018 22:36:06 +0200 Subject: properly escape image-bg argument in ~/.fehbg Closes #400 --- src/wallpaper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index 7cf2468..f1fb149 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -473,7 +473,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, fputs("tile", fp); if (opt.image_bg) { fputs(" --image-bg ", fp); - fputs(opt.image_bg, fp); + fputs(shell_escape(opt.image_bg), fp); } #ifdef HAVE_LIBXINERAMA if (opt.xinerama) { -- cgit v1.2.3 From f7ee0c34bcc2d2ae9075269c53d8b4c10c1594c5 Mon Sep 17 00:00:00 2001 From: Sebastian Bickerle Date: Sun, 10 Jun 2018 20:08:11 +0200 Subject: fix .fehbg output for --bg-max --- src/wallpaper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/wallpaper.c') diff --git a/src/wallpaper.c b/src/wallpaper.c index f1fb149..db14a8c 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -467,8 +467,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, fputs("center", fp); else if (scaled) fputs("scale", fp); - else if (filled) + else if (filled == 1) fputs("fill", fp); + else if (filled == 2) + fputs("max", fp); else fputs("tile", fp); if (opt.image_bg) { -- cgit v1.2.3