summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/tty/unix.rs
diff options
context:
space:
mode:
authorDavid Hewitt <1939362+davidhewitt@users.noreply.github.com>2019-12-14 21:32:24 +0000
committerChristian Duerr <contact@christianduerr.com>2019-12-14 22:32:24 +0100
commit08a122574880d299181c59bec186c0f9e8bef77c (patch)
treec9dc6350869f89f08b35ca1e3a40a983bb1b53f1 /alacritty_terminal/src/tty/unix.rs
parentcb99fd4e4c16e8fe5c36e8be6062658842794ac3 (diff)
downloadalacritty-08a122574880d299181c59bec186c0f9e8bef77c.tar.gz
alacritty-08a122574880d299181c59bec186c0f9e8bef77c.zip
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.
Diffstat (limited to 'alacritty_terminal/src/tty/unix.rs')
-rw-r--r--alacritty_terminal/src/tty/unix.rs10
1 files changed, 5 insertions, 5 deletions
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<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) ->
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());