keyfork-crossterm-ioctl-shim: use raw pointers when necessary
This commit is contained in:
parent
c15c4625a9
commit
2186c1ce86
|
@ -55,7 +55,7 @@ impl TerminalIoctl {
|
||||||
|
|
||||||
fn get_termios(&self) -> Result<Termios> {
|
fn get_termios(&self) -> Result<Termios> {
|
||||||
let mut termios = unsafe { std::mem::zeroed() };
|
let mut termios = unsafe { std::mem::zeroed() };
|
||||||
assert_io(unsafe { libc::tcgetattr(self.fd, &mut termios) })?;
|
assert_io(unsafe { libc::tcgetattr(self.fd, &raw mut termios) })?;
|
||||||
Ok(termios)
|
Ok(termios)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ impl TerminalIoctl {
|
||||||
let mut termios = self.get_termios()?;
|
let mut termios = self.get_termios()?;
|
||||||
let original_mode_ios = termios;
|
let original_mode_ios = termios;
|
||||||
|
|
||||||
unsafe { libc::cfmakeraw(&mut termios) };
|
unsafe { libc::cfmakeraw(&raw mut termios) };
|
||||||
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &termios) })?;
|
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &raw const termios) })?;
|
||||||
self.stored_termios = Some(original_mode_ios);
|
self.stored_termios = Some(original_mode_ios);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -87,7 +87,7 @@ impl TerminalIoctl {
|
||||||
/// The method may propagate errors encountered when interacting with the terminal.
|
/// The method may propagate errors encountered when interacting with the terminal.
|
||||||
pub fn disable_raw_mode(&mut self) -> Result<()> {
|
pub fn disable_raw_mode(&mut self) -> Result<()> {
|
||||||
if let Some(termios) = self.stored_termios.take() {
|
if let Some(termios) = self.stored_termios.take() {
|
||||||
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &termios) })?;
|
assert_io(unsafe { libc::tcsetattr(self.fd, libc::TCSANOW, &raw const termios) })?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ impl TerminalIoctl {
|
||||||
ws_ypixel: 0,
|
ws_ypixel: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_io(unsafe { libc::ioctl(self.fd, libc::TIOCGWINSZ, &mut size) })?;
|
assert_io(unsafe { libc::ioctl(self.fd, libc::TIOCGWINSZ, &raw mut size) })?;
|
||||||
Ok((size.ws_col, size.ws_row))
|
Ok((size.ws_col, size.ws_row))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue