summaryrefslogtreecommitdiffstats
path: root/zellij-server/src/os_input_output.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-07-12 20:30:41 +0200
committerGitHub <noreply@github.com>2023-07-12 20:30:41 +0200
commit0825cb65a79c03a473b87bfbab82ffdb2aef9fea (patch)
treeddaf7e817012f8f60941e42b4cf1f326316a1f37 /zellij-server/src/os_input_output.rs
parent385cc1c81b5ee40dff91971ceddce82a4732af82 (diff)
fix(rendering): occasional glitches while resizing (#2621)
Diffstat (limited to 'zellij-server/src/os_input_output.rs')
-rw-r--r--zellij-server/src/os_input_output.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs
index 18e8f92db..f4cbf9b4a 100644
--- a/zellij-server/src/os_input_output.rs
+++ b/zellij-server/src/os_input_output.rs
@@ -10,6 +10,7 @@ use nix::{
},
unistd,
};
+
use signal_hook::consts::*;
use sysinfo::{ProcessExt, ProcessRefreshKind, System, SystemExt};
use zellij_utils::{
@@ -840,6 +841,34 @@ pub fn get_server_os_input() -> Result<ServerOsInputOutput, nix::Error> {
})
}
+use crate::pty_writer::PtyWriteInstruction;
+use crate::thread_bus::ThreadSenders;
+
+pub struct ResizeCache {
+ senders: ThreadSenders,
+}
+
+impl ResizeCache {
+ pub fn new(senders: ThreadSenders) -> Self {
+ senders
+ .send_to_pty_writer(PtyWriteInstruction::StartCachingResizes)
+ .unwrap_or_else(|e| {
+ log::error!("Failed to cache resizes: {}", e);
+ });
+ ResizeCache { senders }
+ }
+}
+
+impl Drop for ResizeCache {
+ fn drop(&mut self) {
+ self.senders
+ .send_to_pty_writer(PtyWriteInstruction::ApplyCachedResizes)
+ .unwrap_or_else(|e| {
+ log::error!("Failed to apply cached resizes: {}", e);
+ });
+ }
+}
+
/// Process id's for forked terminals
#[derive(Debug)]
pub struct ChildId {