aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-06 17:40:48 +0100
committerBert <ber.t@gmx.com>2011-02-06 17:40:48 +0100
commit603e664f7c9fc5cb228eef90fdaa501ac5dfa3bb (patch)
treeb33881b443d0c96e75a2a93d26497dcc5571db27 /main.c
parentcbf6aae721455a952ab0437bb62143ef8444cc93 (diff)
downloadnsxiv-603e664f7c9fc5cb228eef90fdaa501ac5dfa3bb.tar.zst
Nicer fit window to image
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/main.c b/main.c
index 4ce19de..379b7bd 100644
--- a/main.c
+++ b/main.c
@@ -222,6 +222,8 @@ unsigned char timeout;
int mox, moy;
void on_keypress(XKeyEvent *kev) {
+ int x, y;
+ unsigned int w, h;
char key;
KeySym ksym;
int changed;
@@ -330,8 +332,14 @@ void on_keypress(XKeyEvent *kev) {
/* render on next configurenotify */
break;
case XK_W:
- if ((changed = win_resize(&win, img.w * img.zoom, img.h * img.zoom)))
- img.checkpan = 1;
+ x = win.x + img.x;
+ y = win.y + img.y;
+ w = img.w * img.zoom;
+ h = img.h * img.zoom;
+ if ((changed = win_moveresize(&win, x, y, w, h))) {
+ img.x = x - win.x;
+ img.y = y - win.y;
+ }
break;
/* miscellaneous */