summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-02-02 20:34:34 +0100
committerDaniel Friesel <derf@finalrewind.org>2012-02-02 20:34:34 +0100
commit03eb45b2ea99d964db3b01f2703315c8a2b2a038 (patch)
tree0a61439e07847fda98e16193d0305d75e2b4bc38
parent2c773b0a4815461bd3c7a8fb1b2ce40a8d8c71f6 (diff)
Accept offset-only arguments for --geometry (closes #73)
-rw-r--r--ChangeLog2
-rw-r--r--man/feh.pre2
-rw-r--r--src/winwidget.c9
-rwxr-xr-xtest/feh-scr.i9
-rw-r--r--test/scr/geometry_offset_onlybin0 -> 570 bytes
5 files changed, 16 insertions, 6 deletions
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)
<https://github.com/derf/feh/issues/79>
* Patch by Dennis Real: Add optional EXIF tag view support (make exif=1)
+ * Accept offset-only arguments for --geometry
+ <https://github.com/derf/feh/issues/73>
Mon, 02 Jan 2012 11:54:01 +0100 Daniel Friesel <derf@finalrewind.org>
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/;
@@ -195,6 +195,13 @@ 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
--- /dev/null
+++ b/test/scr/geometry_offset_only
Binary files differ