diff options
| author | salmonik <raisersoft@proton.me> | 2026-02-28 19:32:20 +0100 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-02-28 19:32:20 +0100 |
| commit | 17082597464198fe84be80313b7d51e1e57de639 (patch) | |
| tree | 7b2c7b90c38e3c47e1839247174df2161b736df4 /src/bin/client/platform.rs | |
| parent | remove Cargo.lock from git tracking (diff) | |
| download | zagan-bet-17082597464198fe84be80313b7d51e1e57de639.tar.gz zagan-bet-17082597464198fe84be80313b7d51e1e57de639.zip | |
folder restructuring
Diffstat (limited to 'src/bin/client/platform.rs')
| -rw-r--r-- | src/bin/client/platform.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/bin/client/platform.rs b/src/bin/client/platform.rs deleted file mode 100644 index 817c39d..0000000 --- a/src/bin/client/platform.rs +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | #[cfg(windows)] | ||
| 2 | pub mod win { | ||
| 3 | use std::io; | ||
| 4 | use winapi::um::consoleapi::GetConsoleMode; | ||
| 5 | use winapi::um::consoleapi::SetConsoleMode; | ||
| 6 | use winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING; | ||
| 7 | use winapi::um::wincon::ENABLE_ECHO_INPUT; | ||
| 8 | use winapi::um::winbase::STD_OUTPUT_HANDLE; | ||
| 9 | use winapi::um::processenv::GetStdHandle; | ||
| 10 | use winapi::shared::minwindef::DWORD; | ||
| 11 | |||
| 12 | pub fn enable_vt() -> io::Result<()> { | ||
| 13 | unsafe { | ||
| 14 | let h = GetStdHandle(STD_OUTPUT_HANDLE); | ||
| 15 | if h.is_null() { return Err(io::Error::last_os_error()); } | ||
| 16 | |||
| 17 | let mut mode: DWORD = 0; | ||
| 18 | if GetConsoleMode(h, &mut mode) == 0 { | ||
| 19 | return Err(io::Error::last_os_error()); | ||
| 20 | } | ||
| 21 | let new = (mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING) & !ENABLE_ECHO_INPUT; | ||
| 22 | if SetConsoleMode(h, new) == 0 { | ||
| 23 | return Err(io::Error::last_os_error()); | ||
| 24 | } | ||
| 25 | Ok(()) | ||
| 26 | } | ||
| 27 | } | ||
| 28 | } | ||
