summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-08-23 18:37:24 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-08-23 18:37:24 +0200
commit3b53d965289346b73a6af42225175768e5e202fc (patch)
tree04ffe00e3dde2f2d679c5ab73ec502887a22e061
parent84c27062d8035b634d13e96858cfa34fa7e67173 (diff)
Add terminal-input support for space and return
-rw-r--r--src/keyevents.c8
-rw-r--r--src/main.c3
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);
diff --git a/src/main.c b/src/main.c
index 9e4081b..57b7a7b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;