summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-04-13 20:34:45 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-04-13 20:34:45 +0200
commit894da5961e5bb07251d5f10ee649ccac77f85fae (patch)
treec14888767cadbdddf4d60e17083ef3230a969c06
parent01e9116b59c5b308ac4c41e17970558236093f38 (diff)
fix image resize for w key and menu option (#229)
-rw-r--r--src/events.c2
-rw-r--r--src/menu.c2
-rw-r--r--src/winwidget.c13
-rw-r--r--src/winwidget.h2
4 files changed, 12 insertions, 7 deletions
diff --git a/src/events.c b/src/events.c
index 876c7c4..c5032a1 100644
--- a/src/events.c
+++ b/src/events.c
@@ -638,7 +638,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
winwid->im_h = gib_imlib_image_get_height(temp);
gib_imlib_free_image_and_decache(temp);
if (!winwid->full_screen && !opt.geom_flags)
- winwidget_resize(winwid, winwid->im_w, winwid->im_h);
+ winwidget_resize(winwid, winwid->im_w, winwid->im_h, 0);
winwid->has_rotated = 1;
}
winwid->im_angle = (ev->xmotion.x - winwid->w / 2) / ((double) winwid->w / 2) * 3.1415926535;
diff --git a/src/menu.c b/src/menu.c
index 8f55d3c..9a83f08 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1218,7 +1218,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, unsigned short dat
if (m->fehwin->has_rotated) {
m->fehwin->im_w = gib_imlib_image_get_width(m->fehwin->im);
m->fehwin->im_h = gib_imlib_image_get_height(m->fehwin->im);
- winwidget_resize(m->fehwin, m->fehwin->im_w, m->fehwin->im_h);
+ winwidget_resize(m->fehwin, m->fehwin->im_w, m->fehwin->im_h, 0);
}
winwidget_reset_image(m->fehwin);
winwidget_render_image(m->fehwin, 1, 0);
diff --git a/src/winwidget.c b/src/winwidget.c
index 737d6bc..d9b7413 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -401,7 +401,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
int need_center = winwid->had_resize;
if (!winwid->full_screen && resize) {
- winwidget_resize(winwid, winwid->im_w, winwid->im_h);
+ winwidget_resize(winwid, winwid->im_w, winwid->im_h, 0);
winwidget_reset_image(winwid);
}
@@ -792,7 +792,7 @@ void winwidget_move(winwidget winwid, int x, int y)
return;
}
-void winwidget_resize(winwidget winwid, int w, int h)
+void winwidget_resize(winwidget winwid, int w, int h, int force_resize)
{
XWindowAttributes attributes;
int tc_x, tc_y, px, py;
@@ -833,7 +833,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 & (WidthValue | HeightValue)) {
+ if ((opt.geom_flags & (WidthValue | HeightValue)) && !force_resize) {
winwid->had_resize = 1;
return;
}
@@ -857,6 +857,11 @@ void winwidget_resize(winwidget winwid, int w, int h)
winwid->had_resize = 1;
XFlush(disp);
+ if (force_resize && opt.scale_down && (winwid->type != WIN_TYPE_THUMBNAIL)) {
+ opt.geom_w = winwid->w;
+ opt.geom_h = winwid->h;
+ }
+
D(("-> x %d y %d w %d h %d\n", winwid->x, winwid->y, winwid->w,
winwid->h));
@@ -1046,7 +1051,7 @@ void winwidget_sanitise_offsets(winwidget winwid)
void winwidget_size_to_image(winwidget winwid)
{
- winwidget_resize(winwid, winwid->im_w * winwid->zoom, winwid->im_h * winwid->zoom);
+ winwidget_resize(winwid, winwid->im_w * winwid->zoom, winwid->im_h * winwid->zoom, 1);
winwid->im_x = winwid->im_y = 0;
winwidget_render_image(winwid, 0, 0);
return;
diff --git a/src/winwidget.h b/src/winwidget.h
index 89d5bcd..6a794e7 100644
--- a/src/winwidget.h
+++ b/src/winwidget.h
@@ -128,7 +128,7 @@ void winwidget_center_image(winwidget w);
void winwidget_render_image(winwidget winwid, int resize, int force_alias);
void winwidget_rotate_image(winwidget winid, double angle);
void winwidget_move(winwidget winwid, int x, int y);
-void winwidget_resize(winwidget winwid, int w, int h);
+void winwidget_resize(winwidget winwid, int w, int h, int force_resize);
void winwidget_setup_pixmaps(winwidget winwid);
void winwidget_update_title(winwidget ret);
void winwidget_update_caption(winwidget winwid);