diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-08-23 18:37:24 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-08-23 18:37:24 +0200 |
commit | 3b53d965289346b73a6af42225175768e5e202fc (patch) | |
tree | 04ffe00e3dde2f2d679c5ab73ec502887a22e061 /src | |
parent | 84c27062d8035b634d13e96858cfa34fa7e67173 (diff) |
Add terminal-input support for space and return
Diffstat (limited to 'src')
-rw-r--r-- | src/keyevents.c | 8 | ||||
-rw-r--r-- | src/main.c | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/keyevents.c b/src/keyevents.c index f10ce43..b5c1949 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -269,13 +269,19 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action) void feh_event_handle_stdin() { char stdin_buf[2]; + KeySym keysym = NoSymbol; if (read(STDIN_FILENO, &stdin_buf, 1) == -1) { weprintf("reading a command from stdin failed"); return; } stdin_buf[1] = '\0'; - KeySym keysym = XStringToKeysym(stdin_buf); + if (stdin_buf[0] == ' ') + keysym = XK_space; + else if (stdin_buf[0] == '\n') + keysym = XK_Return; + else + keysym = XStringToKeysym(stdin_buf); if (window_num) feh_event_handle_generic(windows[0], 0, keysym, 0); @@ -119,8 +119,7 @@ int feh_main_iteration(int block) if (tcgetattr(STDIN_FILENO, &ctrl) == -1) eprintf("tcgetattr failed"); ctrl.c_iflag &= ~(PARMRK | ISTRIP - | INLCR | IGNCR | ICRNL | IXON); - ctrl.c_oflag &= ~OPOST; + | INLCR | IGNCR | IXON); ctrl.c_lflag &= ~(ECHO | ICANON | IEXTEN); ctrl.c_cflag &= ~(CSIZE | PARENB); ctrl.c_cflag |= CS8; |