terminal: add terminal_set_mouse_input function

This function is used to enable/disable mouse input for win32 and unix.
This commit is contained in:
nanahi
2024-03-31 15:30:26 -04:00
committed by Kacper Michajłow
parent abc0b0e8c9
commit c2ed2e7bc8
6 changed files with 19 additions and 6 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);