From 615ab7c2d1de0fbed1c073e8a62748a4a84ecc0e Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sat, 9 Mar 2024 21:50:21 +0400 Subject: Fix pty's pixelsize being zero until resize 117719b3 removed the extra call for TIOCSWINSZ, however the first call was not setting the pixelsize for _unknown_ reason, which regressed some clients. Fixes: 117719b3 (Remove extra TIOCSWINSZ) --- alacritty_terminal/src/tty/unix.rs | 15 ++------------- 1 file 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 { - 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(); -- cgit v1.2.3-54-g00ecf