From 08a122574880d299181c59bec186c0f9e8bef77c Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sat, 14 Dec 2019 21:32:24 +0000 Subject: Send PTY resize messages through event loop This allows us to clean up the Arcs on windows, as well as tidy up the code on unix a little too. Fixes #3086. --- alacritty_terminal/src/tty/unix.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'alacritty_terminal/src/tty/unix.rs') diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs index 01ee1b59..9419ead0 100644 --- a/alacritty_terminal/src/tty/unix.rs +++ b/alacritty_terminal/src/tty/unix.rs @@ -135,7 +135,7 @@ fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd<'_> { pub struct Pty { child: Child, - pub fd: File, + fd: File, token: mio::Token, signals: Signals, signals_token: mio::Token, @@ -226,14 +226,14 @@ pub fn new(config: &Config, size: &SizeInfo, window_id: Option) -> set_nonblocking(master); } - let pty = Pty { + let mut pty = Pty { child, fd: unsafe { File::from_raw_fd(master) }, token: mio::Token::from(0), signals, signals_token: mio::Token::from(0), }; - pty.fd.as_raw_fd().on_resize(size); + pty.on_resize(size); pty }, Err(err) => die!("Failed to spawn command '{}': {}", shell.program, err), @@ -350,7 +350,7 @@ impl<'a> ToWinsize for &'a SizeInfo { } } -impl OnResize for i32 { +impl OnResize for Pty { /// Resize the pty /// /// Tells the kernel that the window size changed with the new pixel @@ -358,7 +358,7 @@ impl OnResize for i32 { fn on_resize(&mut self, size: &SizeInfo) { let win = size.to_winsize(); - let res = unsafe { libc::ioctl(*self, libc::TIOCSWINSZ, &win as *const _) }; + let res = unsafe { libc::ioctl(self.fd.as_raw_fd(), libc::TIOCSWINSZ, &win as *const _) }; if res < 0 { die!("ioctl TIOCSWINSZ failed: {}", io::Error::last_os_error()); -- cgit