mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: make the C. WIN32 API declarations more precise, to catch errors earlier (#16090)
This commit is contained in:
@@ -45,17 +45,17 @@ pub fn init(cfg Config) &Context {
|
||||
panic('could not get stdin handle')
|
||||
}
|
||||
// save the current input mode, to be restored on exit
|
||||
if C.GetConsoleMode(stdin_handle, &ui.stdin_at_startup) == 0 {
|
||||
if !C.GetConsoleMode(stdin_handle, &ui.stdin_at_startup) {
|
||||
panic('could not get stdin console mode')
|
||||
}
|
||||
|
||||
// enable extended input flags (see https://stackoverflow.com/a/46802726)
|
||||
// 0x80 == C.ENABLE_EXTENDED_FLAGS
|
||||
if C.SetConsoleMode(stdin_handle, 0x80) == 0 {
|
||||
if !C.SetConsoleMode(stdin_handle, 0x80) {
|
||||
panic('could not set raw input mode')
|
||||
}
|
||||
// enable window and mouse input events.
|
||||
if C.SetConsoleMode(stdin_handle, C.ENABLE_WINDOW_INPUT | C.ENABLE_MOUSE_INPUT) == 0 {
|
||||
if !C.SetConsoleMode(stdin_handle, C.ENABLE_WINDOW_INPUT | C.ENABLE_MOUSE_INPUT) {
|
||||
panic('could not set raw input mode')
|
||||
}
|
||||
// store the current title, so restore_terminal_state can get it back
|
||||
|
||||
Reference in New Issue
Block a user