Made key mappings mode-dependent
This commit is contained in:
parent
ac747c3f91
commit
f554cdf60e
28
main.c
28
main.c
|
@ -284,14 +284,8 @@ void on_keypress(XKeyEvent *kev) {
|
|||
XLookupString(kev, &key, 1, &ksym, NULL);
|
||||
changed = 0;
|
||||
|
||||
if (mode == MODE_NORMAL) {
|
||||
switch (ksym) {
|
||||
case XK_Escape:
|
||||
cleanup();
|
||||
exit(2);
|
||||
case XK_q:
|
||||
cleanup();
|
||||
exit(0);
|
||||
|
||||
/* navigate image list */
|
||||
case XK_n:
|
||||
case XK_space:
|
||||
|
@ -377,10 +371,6 @@ void on_keypress(XKeyEvent *kev) {
|
|||
break;
|
||||
|
||||
/* control window */
|
||||
case XK_f:
|
||||
win_toggle_fullscreen(&win);
|
||||
/* render on next configurenotify */
|
||||
break;
|
||||
case XK_W:
|
||||
x = win.x + img.x;
|
||||
y = win.y + img.y;
|
||||
|
@ -401,6 +391,22 @@ void on_keypress(XKeyEvent *kev) {
|
|||
changed = load_image();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
/* common key mappings */
|
||||
switch (ksym) {
|
||||
case XK_Escape:
|
||||
cleanup();
|
||||
exit(2);
|
||||
case XK_q:
|
||||
cleanup();
|
||||
exit(0);
|
||||
case XK_f:
|
||||
win_toggle_fullscreen(&win);
|
||||
/* render on next configurenotify */
|
||||
break;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
redraw();
|
||||
|
|
Loading…
Reference in a new issue