From 03eb45b2ea99d964db3b01f2703315c8a2b2a038 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 2 Feb 2012 20:34:34 +0100 Subject: Accept offset-only arguments for --geometry (closes #73) --- ChangeLog | 2 ++ man/feh.pre | 2 +- src/winwidget.c | 9 +++++---- test/feh-scr.i | 9 ++++++++- test/scr/geometry_offset_only | Bin 0 -> 570 bytes 5 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 test/scr/geometry_offset_only diff --git a/ChangeLog b/ChangeLog index a70eac7..cf8b8ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ git HEAD (-f and -F may get mixed up) * Patch by Dennis Real: Add optional EXIF tag view support (make exif=1) + * Accept offset-only arguments for --geometry + Mon, 02 Jan 2012 11:54:01 +0100 Daniel Friesel diff --git a/man/feh.pre b/man/feh.pre index 42df11a..e460fad 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -290,7 +290,7 @@ screen size. The only exception is a of 100, in which case images will always be shown at 100% zoom, no matter their dimensions. . -.It Cm -g , --geometry Ar width No x Ar height Op + Ar x No + Ar y +.It Cm -g , --geometry Oo Ar width No x Ar height Oc Op + Ar x No + Ar y . Limit (and don't change) the window size. Takes an X-style geometry .Ar string diff --git a/src/winwidget.c b/src/winwidget.c index e263702..ae34045 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -410,19 +410,20 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) D(("after scaling down image %dx%d\n", winwid->w, winwid->h)); } - if (!winwid->full_screen && ((gib_imlib_image_has_alpha(winwid->im)) || (opt.geom_flags) + if (!winwid->full_screen && ((gib_imlib_image_has_alpha(winwid->im)) + || (opt.geom_flags & (WidthValue | HeightValue)) || (winwid->im_x || winwid->im_y) || (winwid->zoom != 1.0) || (winwid->w > winwid->im_w || winwid->h > winwid->im_h) || (winwid->has_rotated))) feh_draw_checks(winwid); if (!winwid->full_screen && opt.zoom_mode - && (winwid->zoom == 1.0) && !opt.geom_flags + && (winwid->zoom == 1.0) && ! (opt.geom_flags & (WidthValue | HeightValue)) && (winwid->w > winwid->im_w) && (winwid->h > winwid->im_h)) feh_calc_needed_zoom(&(winwid->zoom), winwid->im_w, winwid->im_h, winwid->w, winwid->h); - if (resize && (winwid->full_screen || opt.geom_flags)) { + if (resize && (winwid->full_screen || (opt.geom_flags & (WidthValue | HeightValue)))) { int smaller; /* Is the image smaller than screen? */ int max_w = 0, max_h = 0; @@ -810,7 +811,7 @@ void winwidget_resize(winwidget winwid, int w, int h) D((" x %d y %d w %d h %d\n", attributes.x, attributes.y, winwid->w, winwid->h)); - if (opt.geom_flags) { + if (opt.geom_flags & (WidthValue | HeightValue)) { winwid->had_resize = 1; return; } diff --git a/test/feh-scr.i b/test/feh-scr.i index e242a59..d6d55b1 100755 --- a/test/feh-scr.i +++ b/test/feh-scr.i @@ -6,7 +6,7 @@ use autodie qw/:all/; use Cwd; use GD qw/:DEFAULT :cmp/; -use Test::More tests => 53; +use Test::More tests => 54; use Time::HiRes qw/sleep/; use X11::GUITest qw/:ALL/; @@ -194,6 +194,13 @@ feh_start( test_scr('index_full_h400'); feh_stop(); +feh_start( + '--geometry +10+20', + 'test/ok/png' +); +test_scr('geometry_offset_only'); +feh_stop(); + feh_start( '--caption-path .tc', 'test/bg/exact/in' diff --git a/test/scr/geometry_offset_only b/test/scr/geometry_offset_only new file mode 100644 index 0000000..1f23f60 Binary files /dev/null and b/test/scr/geometry_offset_only differ -- cgit v1.2.3