summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog29
-rw-r--r--man/feh.pre64
-rw-r--r--src/feh.h2
-rw-r--r--src/filelist.c4
-rw-r--r--src/gib_imlib.c23
-rw-r--r--src/imlib.c30
-rw-r--r--src/index.c2
-rw-r--r--src/list.c2
-rw-r--r--src/options.c16
-rw-r--r--src/options.h1
-rw-r--r--src/slideshow.c2
-rw-r--r--src/thumbnail.c2
-rw-r--r--src/wallpaper.c104
-rw-r--r--src/winwidget.c4
14 files changed, 197 insertions, 88 deletions
diff --git a/ChangeLog b/ChangeLog
index 932adb1..5dcd551 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,31 @@
+Sun, 24 May 2015 11:45:18 +0200
+
+* Release v2.13.1
+ * Fix --scale-down breaking image centering in fullscreen mode
+
+Sun, 17 May 2015 20:40:36 +0200 Daniel Friesel <derf+feh@finalrewind.org>
+
+* Release v2.13
+ * print --verbose output to stderr
+ * Show progress when using --verbose and --loadable / --unloadable
+ * ~/.fehbg is now a shell script and can be executed directly
+ (sourcing it still works)
+ * --max-dimension: ignore width/height limit of 0 pixels
+ * Do not re-render images when toggling keep_zoom_vp
+ * feh/themes: Support quoting with '' too (previously, only "" worked)
+ * Fix potential out of bounds array access in EXIF code
+ (when built with exif=1)
+
+Wed, 08 Apr 2015 11:18:41 +0200 Daniel Friesel <derf+feh@finalrewind.org>
+
+* Release v2.12.1
+ * Handle missing HOME in environment
+ * Fix memory leak when a slideshow contains many unloadable images
+ * Fix memory leak when --prelaod removes files from the filelist
+
Thu, 15 May 2014 23:41:07 +0200 Daniel Friesel <derf+feh@finalrewind.org>
-* Releasev v2.12
+* Release v2.12
* feh-cam and gen-cam-menu are no longer installed by default. Use
'make install cam=1' to install them or 'make uninstall cam=1 && make
install cam=0' to remove them permanently
@@ -14,7 +39,7 @@ Thu, 15 May 2014 23:41:07 +0200 Daniel Friesel <derf+feh@finalrewind.org>
* Fix a buffer overflow in the printf implementation when handling unknown
format specifiers (affects --action, --customlist, --index-info, --info,
--thumb-title and --title)
- * Update help (if built with help=1)
+ * Update help (when built with help=1)
Sun, 27 Apr 2014 20:28:02 +0200 Daniel Friesel <derf+feh@finalrewind.org>
diff --git a/man/feh.pre b/man/feh.pre
index a9f9894..d3d3d1f 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -420,8 +420,8 @@ Only show images with width <=
.Ar width
and height <=
.Ar height .
-If you only care about one parameter, set the other to either something large
-or -1.
+If you only care about one parameter, set the other to 0
+.Pq or a negative value .
.
.It Cm -M , --menu-font Ar font
.
@@ -571,7 +571,18 @@ first, reverse the filelist with --reverse.
.
Start the filelist at
.Ar filename .
-See
+.
+Note that at the moment,
+.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 .
.
.It Cm -T , --theme Ar theme
@@ -809,7 +820,12 @@ on screen 0, the second on screen 1, and so on.
.
Use
.Cm --no-xinerama
-to treat the whole X display as one screen when setting wallpapers.
+to treat the whole X display as one screen when setting wallpapers. You
+may also use
+.Cm --xinerama-index
+to use
+.Nm
+as a background setter for a specific screen.
.
.Bl -tag -width indent
.
@@ -848,6 +864,21 @@ Do not write a
.Pa ~/.fehbg
file
.
+.It Cm --xinerama-index Ar screen
+.
+When used with any option other than
+.Cm --bg-tile :
+Only set wallpaper on
+.Ar screen .
+All other screens will be filled black/white.
+.
+This is most useful in a Xinerama configuration with overlapping screens.
+For instance, assume you have two overlapping displays (index 0 and 1), where
+index 0 is smaller. To center a background on the display with index 0 and
+fill the extra space on index 1 black/white, use
+.Qq --xinerama-index 0
+when setting the wallpaper.
+.
.El
.
.
@@ -986,10 +1017,17 @@ is the name of the entry and
.Ar options
are the options which will be applied when the theme is used.
.
+Note that the options are not parsed by any shell. Therefore, filename expansion
+.Po
+.Qq *.jpg
+and similar
+.Pc
+is not supported. Quoting with both single and double quotes works, though.
+.
.Pp
.
An example entry would be
-.Qq imagemap -rVq --thumb-width 40 --thumb-height 30 .
+.Qq imagemap -rVq --thumb-width 40 --thumb-height 30 --index-info \&'%n\en\&%wx\&%h\&' .
.
.Pp
.
@@ -997,10 +1035,11 @@ You can use this theme in two ways. Either call
.Qo
.Nm
-Timagemap *.jpg
-.Qc
+.Qc ,
or create a symbolic link to
.Nm
-with the name of the theme you want it to use. So from the example above:
+with the name of the theme you want it to use. For the example above,
+this would be
.Qo
ln -s `which
.Nm
@@ -1013,11 +1052,11 @@ to use these options.
.Pp
.
Note that you can split a theme over several lines by placing a backslash at
-the end of a line, like in the shell.
+the end of an unfinished line.
.
.Pp
.
-You can combine these themes with commandline options.
+Command line options always override theme options.
.
.
.Sh KEYS CONFIG SYNTAX
@@ -1150,7 +1189,7 @@ to close the menu.
.
.It n , Ao Space Ac , Ao Right Ac Bq next_img
.
-Show next image
+Show next image. Selects the next image in thumbnail mode.
.
.It o Bq toggle_pointer
.
@@ -1158,7 +1197,7 @@ Toggle pointer visibility
.
.It p , Ao Backspace Ac , Ao Left Ac Bq prev_img
.
-Show previous image
+Show previous image. Selects the previous image in thumbnail mode.
.
.It q , Ao Escape Ac Bq quit
.
@@ -1298,7 +1337,8 @@ Scroll down by one page
.
.It R, Ao keypad begin Ac Bq render
.
-Antialias the image
+Antialias the image.
+Opens the currently selected image in thumbnail mode.
.
.It Ao keypad + Ac , Ao Up Ac Bq zoom_in
.
diff --git a/src/feh.h b/src/feh.h
index a4c01f5..a2a586a 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -162,8 +162,6 @@ void feh_reload_image(winwidget w, int resize, int force_new);
void feh_filelist_image_remove(winwidget winwid, char do_delete);
void feh_imlib_print_load_error(char *file, winwidget w, Imlib_Load_Error err);
void slideshow_save_image(winwidget win);
-void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file,
- Imlib_Load_Error * error_return);
void feh_edit_inplace(winwidget w, int orientation);
void feh_edit_inplace_lossless(winwidget w, int orientation);
gib_list *feh_wrap_string(char *text, int wrap_width, Imlib_Font fn, gib_style * style);
diff --git a/src/filelist.c b/src/filelist.c
index f31f05b..eaef54b 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -332,8 +332,10 @@ gib_list *feh_file_info_preload(gib_list * list)
feh_display_status(0);
if (remove_list) {
- for (l = remove_list; l; l = l->next)
+ for (l = remove_list; l; l = l->next) {
+ feh_file_free(FEH_FILE(((gib_list *) l->data)->data));
filelist = list = gib_list_remove(list, (gib_list *) l->data);
+ }
gib_list_free(remove_list);
}
diff --git a/src/gib_imlib.c b/src/gib_imlib.c
index b53b1cc..8f401aa 100644
--- a/src/gib_imlib.c
+++ b/src/gib_imlib.c
@@ -527,13 +527,22 @@ void
gib_imlib_save_image_with_error_return(Imlib_Image im, char *file,
Imlib_Load_Error * error_return)
{
- char *tmp;
-
- imlib_context_set_image(im);
- tmp = strrchr(file, '.');
- if (tmp)
- imlib_image_set_format(tmp + 1);
- imlib_save_image_with_error_return(file, error_return);
+ char *tmp;
+
+ imlib_context_set_image(im);
+ tmp = strrchr(file, '.');
+ if (tmp) {
+ char *p, *pp;
+ p = estrdup(tmp + 1);
+ pp = p;
+ while(*pp) {
+ *pp = tolower(*pp);
+ pp++;
+ }
+ imlib_image_set_format(p);
+ free(p);
+ }
+ imlib_save_image_with_error_return(file, error_return);
}
void
diff --git a/src/imlib.c b/src/imlib.c
index 36c8dff..10ab718 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -148,32 +148,6 @@ int feh_load_image_char(Imlib_Image * im, char *filename)
return(i);
}
-/*
- * XXX gib_imlib_save_image_with_error_return breaks with *.END and
- * similar because it tries to set the image format, which only works
- * with .end .
- * So we leave that part out.
- */
-void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file,
- Imlib_Load_Error * error_return)
-{
- char *tmp;
- imlib_context_set_image(im);
- tmp = strrchr(file, '.');
- if (tmp) {
- char *p, *pp;
- p = estrdup(tmp + 1);
- pp = p;
- while(*pp) {
- *pp = tolower(*pp);
- pp++;
- }
- imlib_image_set_format(p);
- free(p);
- }
- imlib_save_image_with_error_return(file, error_return);
-}
-
void feh_imlib_print_load_error(char *file, winwidget w, Imlib_Load_Error err)
{
if (err == IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS)
@@ -566,6 +540,8 @@ void im_weprintf(winwidget w, char *fmt, ...)
if (fmt[0] != '\0' && fmt[strlen(fmt) - 1] == ':')
fprintf(stderr, " %s", strerror(errno));
fputs("\n", stderr);
+ if (!w)
+ free(errstr);
}
@@ -1053,7 +1029,7 @@ void feh_edit_inplace(winwidget w, int op)
imlib_image_flip_horizontal();
} else
gib_imlib_image_orientate(old, op);
- ungib_imlib_save_image_with_error_return(old,
+ gib_imlib_save_image_with_error_return(old,
FEH_FILE(w->file->data)->filename, &err);
gib_imlib_free_image(old);
if (err)
diff --git a/src/index.c b/src/index.c
index db2c9d2..a71744d 100644
--- a/src/index.c
+++ b/src/index.c
@@ -327,7 +327,7 @@ void init_index_mode(void)
else
strncpy(output_buf, opt.output_file, 1024);
- ungib_imlib_save_image_with_error_return(im_main, output_buf, &err);
+ gib_imlib_save_image_with_error_return(im_main, output_buf, &err);
if (err) {
feh_imlib_print_load_error(output_buf, im_main, err);
}
diff --git a/src/list.c b/src/list.c
index 53fdb36..fcb41ac 100644
--- a/src/list.c
+++ b/src/list.c
@@ -110,7 +110,7 @@ void real_loadables_mode(int loadable)
}
else {
if (opt.verbose)
- feh_display_status('.');
+ feh_display_status('s');
ret = 1;
}
}
diff --git a/src/options.c b/src/options.c
index 8fbdbfb..120541a 100644
--- a/src/options.c
+++ b/src/options.c
@@ -70,6 +70,7 @@ void init_parse_options(int argc, char **argv)
#ifdef HAVE_LIBXINERAMA
/* if we're using xinerama, then enable it by default */
opt.xinerama = 1;
+ opt.xinerama_index = -1;
#endif /* HAVE_LIBXINERAMA */
feh_getopt_theme(argc, argv);
@@ -236,7 +237,7 @@ static void feh_parse_options_from_string(char *opts)
list[num - 1] = feh_string_normalize(s);
break;
- } else if (*t == '\"' && last != '\\')
+ } else if (((*t == '\"') || (*t == '\'')) && last != '\\')
inquote = !(inquote);
last = *t;
}
@@ -265,6 +266,9 @@ char *feh_string_normalize(char *str)
else if ((*s == '\"') && (last == '\\'))
ret[i++] = '\"';
else if ((*s == '\"') && (last == 0));
+ else if ((*s == '\'') && (last == '\\'))
+ ret[i++] = '\'';
+ else if ((*s == '\'') && (last == 0));
else if ((*s == ' ') && (last == '\\'))
ret[i++] = ' ';
else
@@ -272,7 +276,7 @@ char *feh_string_normalize(char *str)
last = *s;
}
- if (i && (ret[i - 1] == '\"'))
+ if (i && ((ret[i - 1] == '\"') || (ret[i - 1] == '\'')))
ret[i - 1] = '\0';
else
ret[i] = '\0';
@@ -401,6 +405,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
{"no-fehbg" , 0, 0, 236},
{"keep-zoom-vp" , 0, 0, 237},
{"scroll-step" , 1, 0, 238},
+ {"xinerama-index", 1, 0, 239},
{0, 0, 0, 0}
};
@@ -421,6 +426,10 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
break;
case '<':
XParseGeometry(optarg, &discard, &discard, &opt.max_width, &opt.max_height);
+ if (opt.max_width == 0)
+ opt.max_width = UINT_MAX;
+ if (opt.max_height == 0)
+ opt.max_height = UINT_MAX;
break;
case '>':
XParseGeometry(optarg, &discard, &discard, &opt.min_width, &opt.min_height);
@@ -737,6 +746,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
case 238:
opt.scroll_step = atoi(optarg);
break;
+ case 239:
+ opt.xinerama_index = atoi(optarg);
+ break;
default:
break;
}
diff --git a/src/options.h b/src/options.h
index a22cc05..923aa41 100644
--- a/src/options.h
+++ b/src/options.h
@@ -109,6 +109,7 @@ struct __fehoptions {
int default_zoom;
int zoom_mode;
unsigned char adjust_reload;
+ int xinerama_index;
/* signed in case someone wants to invert scrolling real quick */
int scroll_step;
diff --git a/src/slideshow.c b/src/slideshow.c
index 6c5d9c8..7636d31 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -669,7 +669,7 @@ void slideshow_save_image(winwidget win)
if (opt.verbose)
fprintf(stderr, "saving image to filename '%s'\n", tmpname);
- ungib_imlib_save_image_with_error_return(win->im, tmpname, &err);
+ gib_imlib_save_image_with_error_return(win->im, tmpname, &err);
if (err)
feh_imlib_print_load_error(tmpname, win, err);
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 1719fdc..c806ce4 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -382,7 +382,7 @@ void init_thumbnail_mode(void)
snprintf(output_buf, 1024, "%s/%s", opt.output_dir, opt.output_file);
else
strncpy(output_buf, opt.output_file, 1024);
- ungib_imlib_save_image_with_error_return(td.im_main, output_buf, &err);
+ gib_imlib_save_image_with_error_return(td.im_main, output_buf, &err);
if (err) {
feh_imlib_print_load_error(output_buf, td.im_main, err);
}
diff --git a/src/wallpaper.c b/src/wallpaper.c
index 3e19c41..b6f2c0c 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -298,21 +298,30 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
/* string for sticking in ~/.fehbg */
char *fehbg = NULL;
+ char fehbg_args[512];
+ fehbg_args[0] = '\0';
char *home;
char filbuf[4096];
- char fehbg_xinerama[] = "--no-xinerama";
char *bgfill = NULL;
bgfill = opt.image_bg == IMAGE_BG_WHITE ? "--image-bg white" : "--image-bg black" ;
+#ifdef HAVE_LIBXINERAMA
+ if (opt.xinerama) {
+ if (opt.xinerama_index >= 0) {
+ snprintf(fehbg_args, sizeof(fehbg_args),
+ "--xinerama-index %d", opt.xinerama_index);
+ }
+ }
+ else
+ snprintf(fehbg_args, sizeof(fehbg_args), "--no-xinerama");
+#endif /* HAVE_LIBXINERAMA */
+
/* local display to set closedownmode on */
Display *disp2;
Window root2;
int depth2;
int in, out, w, h;
- if (opt.xinerama)
- fehbg_xinerama[0] = '\0';
-
D(("Falling back to XSetRootWindowPixmap\n"));
/* Put the filename in filbuf between ' and escape ' in the filename */
@@ -357,16 +366,30 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth);
#ifdef HAVE_LIBXINERAMA
- if (opt.xinerama && xinerama_screens)
- for (i = 0; i < num_xinerama_screens; i++)
- feh_wm_set_bg_scaled(pmap_d1, im, use_filelist,
- xinerama_screens[i].x_org, xinerama_screens[i].y_org,
- xinerama_screens[i].width, xinerama_screens[i].height);
+ 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));
+ gc = XCreateGC(disp, root, GCForeground, &gcval);
+ XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height);
+ XFreeGC(disp, gc);
+ }
+
+ if (opt.xinerama && xinerama_screens) {
+ for (i = 0; i < num_xinerama_screens; i++) {
+ if (opt.xinerama_index < 0 || opt.xinerama_index == i) {
+ feh_wm_set_bg_scaled(pmap_d1, im, use_filelist,
+ xinerama_screens[i].x_org, xinerama_screens[i].y_org,
+ xinerama_screens[i].width, xinerama_screens[i].height);
+ }
+ }
+ }
else
#endif /* HAVE_LIBXINERAMA */
feh_wm_set_bg_scaled(pmap_d1, im, use_filelist,
0, 0, scr->width, scr->height);
- fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-scale", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_args, "--bg-scale", filbuf, NULL);
} else if (centered) {
D(("centering\n"));
@@ -380,11 +403,15 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height);
#ifdef HAVE_LIBXINERAMA
- if (opt.xinerama && xinerama_screens)
- for (i = 0; i < num_xinerama_screens; i++)
- feh_wm_set_bg_centered(pmap_d1, im, use_filelist,
- xinerama_screens[i].x_org, xinerama_screens[i].y_org,
- xinerama_screens[i].width, xinerama_screens[i].height);
+ if (opt.xinerama && xinerama_screens) {
+ for (i = 0; i < num_xinerama_screens; i++) {
+ if (opt.xinerama_index < 0 || opt.xinerama_index == i) {
+ feh_wm_set_bg_centered(pmap_d1, im, use_filelist,
+ xinerama_screens[i].x_org, xinerama_screens[i].y_org,
+ xinerama_screens[i].width, xinerama_screens[i].height);
+ }
+ }
+ }
else
#endif /* HAVE_LIBXINERAMA */
feh_wm_set_bg_centered(pmap_d1, im, use_filelist,
@@ -392,24 +419,38 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
XFreeGC(disp, gc);
- fehbg = estrjoin(" ", "feh", fehbg_xinerama, bgfill, "--bg-center", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_args, bgfill, "--bg-center", filbuf, NULL);
} else if (filled == 1) {
pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth);
#ifdef HAVE_LIBXINERAMA
- if (opt.xinerama && xinerama_screens)
- for (i = 0; i < num_xinerama_screens; i++)
- feh_wm_set_bg_filled(pmap_d1, im, use_filelist,
- xinerama_screens[i].x_org, xinerama_screens[i].y_org,
- xinerama_screens[i].width, xinerama_screens[i].height);
+ 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));
+ gc = XCreateGC(disp, root, GCForeground, &gcval);
+ XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height);
+ XFreeGC(disp, gc);
+ }
+
+ if (opt.xinerama && xinerama_screens) {
+ for (i = 0; i < num_xinerama_screens; i++) {
+ if (opt.xinerama_index < 0 || opt.xinerama_index == i) {
+ feh_wm_set_bg_filled(pmap_d1, im, use_filelist,
+ xinerama_screens[i].x_org, xinerama_screens[i].y_org,
+ xinerama_screens[i].width, xinerama_screens[i].height);
+ }
+ }
+ }
else
#endif /* HAVE_LIBXINERAMA */
feh_wm_set_bg_filled(pmap_d1, im, use_filelist
, 0, 0, scr->width, scr->height);
- fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-fill", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_args, "--bg-fill", filbuf, NULL);
} else if (filled == 2) {
@@ -422,11 +463,15 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height);
#ifdef HAVE_LIBXINERAMA
- if (opt.xinerama && xinerama_screens)
- for (i = 0; i < num_xinerama_screens; i++)
- feh_wm_set_bg_maxed(pmap_d1, im, use_filelist,
- xinerama_screens[i].x_org, xinerama_screens[i].y_org,
- xinerama_screens[i].width, xinerama_screens[i].height);
+ if (opt.xinerama && xinerama_screens) {
+ for (i = 0; i < num_xinerama_screens; i++) {
+ if (opt.xinerama_index < 0 || opt.xinerama_index == i) {
+ feh_wm_set_bg_maxed(pmap_d1, im, use_filelist,
+ xinerama_screens[i].x_org, xinerama_screens[i].y_org,
+ xinerama_screens[i].width, xinerama_screens[i].height);
+ }
+ }
+ }
else
#endif /* HAVE_LIBXINERAMA */
feh_wm_set_bg_maxed(pmap_d1, im, use_filelist,
@@ -434,7 +479,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
XFreeGC(disp, gc);
- fehbg = estrjoin(" ", "feh", fehbg_xinerama, bgfill, "--bg-max", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_args, bgfill, "--bg-max", filbuf, NULL);
} else {
if (use_filelist)
@@ -465,8 +510,9 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
}
free(path);
}
- free(fehbg);
}
+
+ free(fehbg);
/* create new display, copy pixmap to new display */
disp2 = XOpenDisplay(NULL);
diff --git a/src/winwidget.c b/src/winwidget.c
index a1b78d3..65cefca 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -443,8 +443,8 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
feh_calc_needed_zoom(&(winwid->zoom), winwid->im_w, winwid->im_h, winwid->w, winwid->h);
- if (resize && !opt.scale_down && (winwid->full_screen
- || (opt.geom_flags & (WidthValue | HeightValue)))) {
+ if (resize && (winwid->full_screen
+ || (!opt.scale_down && (opt.geom_flags & (WidthValue | HeightValue))))) {
int smaller; /* Is the image smaller than screen? */
int max_w = 0, max_h = 0;