diff options
Diffstat (limited to 'src/client/input')
| -rw-r--r-- | src/client/input/windows_vti.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/input/windows_vti.rs b/src/client/input/windows_vti.rs index e9cfa4e6..48fe8220 100644 --- a/src/client/input/windows_vti.rs +++ b/src/client/input/windows_vti.rs @@ -86,14 +86,17 @@ fn push_platform_input_events( #[cfg(windows)] pub(super) fn console_input_handle() -> std::io::Result<windows_sys::Win32::Foundation::HANDLE> { use windows_sys::Win32::Foundation::{HANDLE, INVALID_HANDLE_VALUE}; - use windows_sys::Win32::System::Console::{GetStdHandle, STD_INPUT_HANDLE}; + use windows_sys::Win32::System::Console::{GetConsoleMode, GetStdHandle, STD_INPUT_HANDLE}; let handle: HANDLE = unsafe { GetStdHandle(STD_INPUT_HANDLE) }; if handle.is_null() || handle == INVALID_HANDLE_VALUE { - Err(std::io::Error::last_os_error()) - } else { - Ok(handle) + return Err(std::io::Error::last_os_error()); } + let mut mode = 0; + if unsafe { GetConsoleMode(handle, &mut mode) } == 0 { + return Err(std::io::Error::last_os_error()); + } + Ok(handle) } #[cfg(windows)] |
