summaryrefslogtreecommitdiffstats
path: root/osdep/terminal.h
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/terminal.h')
-rw-r--r--osdep/terminal.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/osdep/terminal.h b/osdep/terminal.h
index ccf6a02c7c..4174cf2d3b 100644
--- a/osdep/terminal.h
+++ b/osdep/terminal.h
@@ -20,8 +20,23 @@
#ifndef MPLAYER_GETCH2_H
#define MPLAYER_GETCH2_H
+#include <stdarg.h>
#include <stdbool.h>
-#include <stdio.h>
+
+#include "misc/bstr.h"
+
+#define TERM_ESC_GOTO_YX "\033[%d;%df"
+#define TERM_ESC_HIDE_CURSOR "\033[?25l"
+#define TERM_ESC_RESTORE_CURSOR "\033[?25h"
+#define TERM_ESC_SYNC_UPDATE_BEGIN "\033[?2026h"
+#define TERM_ESC_SYNC_UPDATE_END "\033[?2026l"
+
+#define TERM_ESC_CLEAR_SCREEN "\033[2J"
+#define TERM_ESC_ALT_SCREEN "\033[?1049h"
+#define TERM_ESC_NORMAL_SCREEN "\033[?1049l"
+
+#define TERM_ESC_ENABLE_MOUSE "\033[?1003h"
+#define TERM_ESC_DISABLE_MOUSE "\033[?1003l"
struct input_ctx;
@@ -40,8 +55,16 @@ bool terminal_in_background(void);
/* Get terminal-size in columns/rows. */
void terminal_get_size(int *w, int *h);
+/* Get terminal-size in columns/rows and width/height in pixels. */
+void terminal_get_size2(int *rows, int *cols, int *px_width, int *px_height);
+
+/* Enable/Disable mouse input. */
+void terminal_set_mouse_input(bool enable);
+
// Windows only.
-void mp_write_console_ansi(void *wstream, char *buf);
+int mp_console_vfprintf(void *wstream, const char *format, va_list args);
+int mp_console_write(void *wstream, bstr str);
+bool mp_check_console(void *handle);
/* Windows-only function to attach to the parent process's console */
bool terminal_try_attach(void);