diff options
author | Bert <ber.t@gmx.com> | 2011-06-03 23:39:22 +0200 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-06-03 23:39:22 +0200 |
commit | a6100373c1be2796966fa7e15d7b41f2f8a112f7 (patch) | |
tree | c6460288b42f669e0a82cec10a0cfe67e6b1c620 /main.c | |
parent | ea23115af449e086ba05c9757ad22108944f6ec2 (diff) |
New mappings: ctrl-[hjkl], pan image one window width/height
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -357,17 +357,18 @@ void on_keypress(XKeyEvent *kev) { unsigned int w, h; char key; KeySym ksym; - int changed; + int changed, ctrl; if (!kev) return; XLookupString(kev, &key, 1, &ksym, NULL); changed = 0; + ctrl = CLEANMASK(kev->state) & ControlMask; #if EXT_COMMANDS /* external commands from commands.h */ - if (CLEANMASK(kev->state) & ControlMask) { + if (ctrl) { for (x = 0; x < LEN(commands); ++x) { if (commands[x].ksym == ksym) { win_set_cursor(&win, CURSOR_WATCH); @@ -446,19 +447,25 @@ void on_keypress(XKeyEvent *kev) { /* panning */ case XK_h: case XK_Left: - changed = img_pan(&img, &win, PAN_LEFT); + changed = img_pan(&img, &win, PAN_LEFT, ctrl); break; case XK_j: case XK_Down: - changed = img_pan(&img, &win, PAN_DOWN); + changed = img_pan(&img, &win, PAN_DOWN, ctrl); break; case XK_k: case XK_Up: - changed = img_pan(&img, &win, PAN_UP); + changed = img_pan(&img, &win, PAN_UP, ctrl); break; case XK_l: case XK_Right: - changed = img_pan(&img, &win, PAN_RIGHT); + changed = img_pan(&img, &win, PAN_RIGHT, ctrl); + break; + case XK_Prior: + changed = img_pan(&img, &win, PAN_UP, 1); + break; + case XK_Next: + changed = img_pan(&img, &win, PAN_DOWN, 1); break; case XK_H: @@ -632,23 +639,23 @@ void on_buttonpress(XButtonEvent *bev) { if (mask == ControlMask) changed = img_zoom_in(&img, &win); else if (mask == ShiftMask) - changed = img_pan(&img, &win, PAN_LEFT); + changed = img_pan(&img, &win, PAN_LEFT, 0); else - changed = img_pan(&img, &win, PAN_UP); + changed = img_pan(&img, &win, PAN_UP, 0); break; case Button5: if (mask == ControlMask) changed = img_zoom_out(&img, &win); else if (mask == ShiftMask) - changed = img_pan(&img, &win, PAN_RIGHT); + changed = img_pan(&img, &win, PAN_RIGHT, 0); else - changed = img_pan(&img, &win, PAN_DOWN); + changed = img_pan(&img, &win, PAN_DOWN, 0); break; case 6: - changed = img_pan(&img, &win, PAN_LEFT); + changed = img_pan(&img, &win, PAN_LEFT, 0); break; case 7: - changed = img_pan(&img, &win, PAN_RIGHT); + changed = img_pan(&img, &win, PAN_RIGHT, 0); break; } } else { |