terminal-win: implement terminal_set_mouse_input

This commit is contained in:
nanahi 2024-03-31 16:51:33 -04:00 committed by Kacper Michajłow
parent c2ed2e7bc8
commit eff18a8a11
1 changed files with 7 additions and 0 deletions

View File

@ -558,6 +558,13 @@ bool terminal_try_attach(void)
void terminal_set_mouse_input(bool enable)
{
DWORD cmode;
HANDLE in = hSTDIN;
if (GetConsoleMode(in, &cmode)) {
cmode = enable ? cmode | ENABLE_MOUSE_INPUT
: cmode & (~ENABLE_MOUSE_INPUT);
SetConsoleMode(in, cmode);
}
}
void terminal_init(void)