aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2024-03-10 01:58:12 +0400
committerChristian Duerr <contact@christianduerr.com>2024-03-19 02:20:53 +0100
commitd3267eb964766752a37b94fd3cde12bd033ac777 (patch)
tree4ce8bf2ddba81a6944cf3056c9b6027ca9cc40ab
parent0a859ae3732d0f378474f80107186e46b61148fc (diff)
downloadalacritty-d3267eb964766752a37b94fd3cde12bd033ac777.tar.gz
alacritty-d3267eb964766752a37b94fd3cde12bd033ac777.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.rs15
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();