summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-03-31 15:30:26 -0400
committerKacper Michajłow <kasper93@gmail.com>2024-04-18 01:03:33 +0200
commitc2ed2e7bc8b1f31b28aa1de67e93ca0e7cbe40f6 (patch)
treebaf7d3b64393b12b01dfe293ec6607a84fc4d799 /osdep
parentabc0b0e8c9f238fd2b41dc8349b367bc83361972 (diff)
downloadmpv-c2ed2e7bc8b1f31b28aa1de67e93ca0e7cbe40f6.tar.bz2
mpv-c2ed2e7bc8b1f31b28aa1de67e93ca0e7cbe40f6.tar.xz
terminal: add terminal_set_mouse_input function
This function is used to enable/disable mouse input for win32 and unix.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/terminal-unix.c6
-rw-r--r--osdep/terminal-win.c4
-rw-r--r--osdep/terminal.h3
3 files changed, 13 insertions, 0 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c
index c487886c11..94d3e6085e 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -588,6 +588,12 @@ void terminal_get_size2(int *rows, int *cols, int *px_width, int *px_height)
*px_height = ws.ws_ypixel;
}
+void terminal_set_mouse_input(bool enable)
+{
+ printf(enable ? TERM_ESC_ENABLE_MOUSE : TERM_ESC_DISABLE_MOUSE);
+ fflush(stdout);
+}
+
void terminal_init(void)
{
assert(!getch2_enabled);
diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c
index dc75180d81..035af3f622 100644
--- a/osdep/terminal-win.c
+++ b/osdep/terminal-win.c
@@ -556,6 +556,10 @@ bool terminal_try_attach(void)
return true;
}
+void terminal_set_mouse_input(bool enable)
+{
+}
+
void terminal_init(void)
{
CONSOLE_SCREEN_BUFFER_INFO cinfo;
diff --git a/osdep/terminal.h b/osdep/terminal.h
index 6d12647035..4174cf2d3b 100644
--- a/osdep/terminal.h
+++ b/osdep/terminal.h
@@ -58,6 +58,9 @@ 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.
int mp_console_vfprintf(void *wstream, const char *format, va_list args);
int mp_console_write(void *wstream, bstr str);