diff options
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/terminal-unix.c | 6 | ||||
-rw-r--r-- | osdep/terminal-win.c | 25 | ||||
-rw-r--r-- | osdep/terminal.h | 3 |
3 files changed, 2 insertions, 32 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c index 844054e1bd..21ed42cb68 100644 --- a/osdep/terminal-unix.c +++ b/osdep/terminal-unix.c @@ -466,6 +466,7 @@ static int read_keys(void *ctx, int fd) void terminal_setup_getch(struct input_ctx *ictx) { mp_input_add_fd(ictx, 0, 1, NULL, read_keys, NULL, ictx); + getch2_enable(); } static volatile int getch2_active = 0; @@ -624,11 +625,6 @@ void terminal_set_foreground_color(FILE *stream, int c) } } -void terminal_setup_stdin_cmd_input(struct input_ctx *ictx) -{ - mp_input_add_fd(ictx, 0, 1, input_default_read_cmd, NULL, NULL, NULL); -} - int terminal_init(void) { use_terminal = isatty(1); diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c index 918a073a17..19603d87d1 100644 --- a/osdep/terminal-win.c +++ b/osdep/terminal-win.c @@ -54,30 +54,6 @@ static const unsigned char ansi2win32[8] = { FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED, }; -static int mp_input_slave_cmd_func(void *ctx, int fd, char *dest, int size) -{ - DWORD retval; - HANDLE in = GetStdHandle(STD_INPUT_HANDLE); - if (PeekNamedPipe(in, NULL, size, &retval, NULL, NULL)) { - if (size > retval) - size = retval; - } else { - if (WaitForSingleObject(in, 0)) - size = 0; - } - if (!size) - return MP_INPUT_NOTHING; - ReadFile(in, dest, size, &retval, NULL); - if (retval) - return retval; - return MP_INPUT_NOTHING; -} - -void terminal_setup_stdin_cmd_input(struct input_ctx *ictx) -{ - mp_input_add_fd(ictx, 0, 0, mp_input_slave_cmd_func, NULL, NULL, NULL); -} - void get_screen_size(void) { CONSOLE_SCREEN_BUFFER_INFO cinfo; @@ -170,6 +146,7 @@ static int read_keys(void *ctx, int fd) void terminal_setup_getch(struct input_ctx *ictx) { mp_input_add_fd(ictx, 0, 1, NULL, read_keys, NULL, ictx); + getch2_enable(); } void getch2_poll(void) diff --git a/osdep/terminal.h b/osdep/terminal.h index 651e31ed71..4495bfb471 100644 --- a/osdep/terminal.h +++ b/osdep/terminal.h @@ -39,9 +39,6 @@ extern char *terminal_cursor_up; /* Global initialization for terminal output. */ int terminal_init(void); -/* Setup ictx to read input commands from stdin (slave mode) */ -void terminal_setup_stdin_cmd_input(struct input_ctx *ictx); - /* Setup ictx to read keys from the terminal */ void terminal_setup_getch(struct input_ctx *ictx); |