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);
|
XLookupString(kev, &key, 1, &ksym, NULL);
|
||||||
changed = 0;
|
changed = 0;
|
||||||
|
|
||||||
|
if (mode == MODE_NORMAL) {
|
||||||
switch (ksym) {
|
switch (ksym) {
|
||||||
case XK_Escape:
|
|
||||||
cleanup();
|
|
||||||
exit(2);
|
|
||||||
case XK_q:
|
|
||||||
cleanup();
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
/* navigate image list */
|
/* navigate image list */
|
||||||
case XK_n:
|
case XK_n:
|
||||||
case XK_space:
|
case XK_space:
|
||||||
|
@ -377,10 +371,6 @@ void on_keypress(XKeyEvent *kev) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* control window */
|
/* control window */
|
||||||
case XK_f:
|
|
||||||
win_toggle_fullscreen(&win);
|
|
||||||
/* render on next configurenotify */
|
|
||||||
break;
|
|
||||||
case XK_W:
|
case XK_W:
|
||||||
x = win.x + img.x;
|
x = win.x + img.x;
|
||||||
y = win.y + img.y;
|
y = win.y + img.y;
|
||||||
|
@ -401,6 +391,22 @@ void on_keypress(XKeyEvent *kev) {
|
||||||
changed = load_image();
|
changed = load_image();
|
||||||
break;
|
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)
|
if (changed)
|
||||||
redraw();
|
redraw();
|
||||||
|
|
Loading…
Reference in a new issue