diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2024-03-10 01:58:12 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-09 21:58:12 +0000 |
commit | 41d2f1df4509148a6f1ffb3de59c2389a3a93283 (patch) | |
tree | 519f4f525dd544325374e91c1719d2076dc70298 | |
parent | f5646ba352c809f78c55a9e1f6a5212aea787899 (diff) | |
download | alacritty-41d2f1df4509148a6f1ffb3de59c2389a3a93283.tar.gz alacritty-41d2f1df4509148a6f1ffb3de59c2389a3a93283.zip |
Set PTY's pixel size on startup
117719b3 removed the extra call for TIOCSWINSZ, however the initial
`openpty` call itself did not set the pixel size, which caused issues
with some clients.
-rw-r--r-- | alacritty_terminal/src/tty/unix.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs index 1034c5a9..8ce04191 100644 --- a/alacritty_terminal/src/tty/unix.rs +++ b/alacritty_terminal/src/tty/unix.rs @@ -4,7 +4,6 @@ use std::ffi::CStr; use std::fs::File; use std::io::{Error, ErrorKind, Read, Result}; use std::mem::MaybeUninit; -use std::os::fd::OwnedFd; use std::os::unix::io::{AsRawFd, FromRawFd}; use std::os::unix::net::UnixStream; use std::os::unix::process::CommandExt; @@ -38,17 +37,6 @@ macro_rules! die { }} } -/// Get raw fds for master/slave ends of a new PTY. -fn make_pty(size: Winsize) -> Result<(OwnedFd, OwnedFd)> { - let mut window_size = size; - window_size.ws_xpixel = 0; - window_size.ws_ypixel = 0; - - let ends = openpty(None, Some(&window_size))?; - - Ok((ends.controller, ends.user)) -} - /// Really only needed on BSD, but should be fine elsewhere. fn set_controlling_terminal(fd: c_int) { let res = unsafe { @@ -194,7 +182,8 @@ fn default_shell_command(shell: &str, user: &str) -> Command { /// Create a new TTY and return a handle to interact with it. pub fn new(config: &Options, window_size: WindowSize, window_id: u64) -> Result<Pty> { - let (master, slave) = make_pty(window_size.to_winsize())?; + let pty = openpty(None, Some(&window_size.to_winsize()))?; + let (master, slave) = (pty.controller, pty.user); let master_fd = master.as_raw_fd(); let slave_fd = slave.as_raw_fd(); |