diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-07-27 18:24:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-27 18:24:37 +0200 |
| commit | ea07e2d5b6bbc9ea6f9c765b0838b3e91156a58d (patch) | |
| tree | 4a8fac8a9b27f2a8b32b3af61a3b5419b9937c81 /zellij-client/src/input_handler.rs | |
| parent | Switch from the unmaintained daemonize crate to a maintained fork (#4512) (diff) | |
| download | sl0ppij-ea07e2d5b6bbc9ea6f9c765b0838b3e91156a58d.tar.gz sl0ppij-ea07e2d5b6bbc9ea6f9c765b0838b3e91156a58d.tar.xz sl0ppij-ea07e2d5b6bbc9ea6f9c765b0838b3e91156a58d.zip | |
Nested session handling (#5417)
* fix: theme query and updated pixel dimensions
* add no-ui-fullscreen key/action/capability
* protocol core
* integration test harness
* fix integration tests
* fix flaky tests
* nested ui (dimming) and directional focus initial implementation
* integration tests for nested ui dimming and directional focus
* initial full screen nesteed implementation
* fix: keep hidden floating panes hidden across nested no-ui fullscreen
* fix integration tests
* no ui fullscreen integration tests
* hardening behavior/tests
* fix(nested): re-derive descend/dim on host tab switch and new-tab so clicking dimmed chrome ascends
* initial modal implementation
* initial ui improvements
* fix integration tests
* improve nested selection ui
* nested session modal refactoring and tests
* improve integration test speed somewhat
* some ui adjustments
* simplify full/auto nested session handling
* hints in compact-bar
* guest stdin leak fix
* allow floating panes to be fullscreen
* make nested session handling configurable
* protocol reannounce
* refactor: naming confusion
* improve ux somewhat
* rustfmt
* merge fixes
* improve integration test rate limiting (fix ci)
* add pr
Diffstat (limited to 'zellij-client/src/input_handler.rs')
| -rw-r--r-- | zellij-client/src/input_handler.rs | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index 45e8d9ce..3c9d269c 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -1,7 +1,8 @@ //! Main input logic. use crate::{ - os_input_output::ClientOsApi, stdin_ansi_parser::AnsiStdinInstruction, ClientId, - ClientInstruction, CommandIsExecuting, InputInstruction, + nested_reannounce::NestedReannounce, os_input_output::ClientOsApi, + stdin_ansi_parser::AnsiStdinInstruction, ClientId, ClientInstruction, CommandIsExecuting, + InputInstruction, }; use zellij_utils::{ channels::{Receiver, SenderWithContext, OPENCALLS}, @@ -15,6 +16,7 @@ use zellij_utils::{ options::Options, }, ipc::{ClientToServerMsg, ExitReason}, + nested_session::{self, NestedSessionMessage}, position::Position, vendored::termwiz::input::{ InputEvent, Modifiers, MouseButtons, MouseEvent as TermwizMouseEvent, @@ -35,6 +37,7 @@ struct InputHandler { receive_input_instructions: Receiver<(InputInstruction, ErrorContext)>, mouse_old_event: MouseEvent, mouse_mode_active: bool, + nested_reannounce: Option<NestedReannounce>, } fn termwiz_mouse_convert(original_event: &mut MouseEvent, event: &TermwizMouseEvent) { @@ -136,6 +139,7 @@ impl InputHandler { mode: InputMode, // TODO: we can probably get rid of this now that we're tracking it on the // server instead receive_input_instructions: Receiver<(InputInstruction, ErrorContext)>, + nested_reannounce: Option<NestedReannounce>, ) -> Self { InputHandler { mode, @@ -148,6 +152,7 @@ impl InputHandler { receive_input_instructions, mouse_old_event: MouseEvent::new(), mouse_mode_active: false, + nested_reannounce, } } @@ -269,6 +274,12 @@ impl InputHandler { reply_bytes, }); }, + Ok(( + InputInstruction::NestedSessionFrameFromHost(payload_bytes), + _error_context, + )) => { + self.handle_nested_session_frame_from_host(payload_bytes); + }, Ok((InputInstruction::Exit, _error_context)) => { self.should_exit = true; }, @@ -329,6 +340,29 @@ impl InputHandler { }, } } + fn handle_nested_session_frame_from_host(&mut self, payload_bytes: Vec<u8>) { + if let Some(nested_reannounce) = &self.nested_reannounce { + nested_reannounce.note_host_contact(); + } + match nested_session::decode_payload(&payload_bytes) { + Some(NestedSessionMessage::Ping) => { + self.send_client_instructions + .send(ClientInstruction::EmitNestedSessionFrame( + nested_session::encode_payload(&NestedSessionMessage::Pong), + )) + .unwrap(); + }, + Some(_) => { + self.os_input + .send_to_server(ClientToServerMsg::NestedSessionFrameFromHost { + payload_bytes, + }); + }, + None => { + log::debug!("dropping undecodable nested session frame from host"); + }, + } + } fn handle_mouse_event(&mut self, mouse_event: &MouseEvent) { self.dispatch_action( Action::MouseEvent { @@ -450,6 +484,7 @@ pub(crate) fn input_loop( send_client_instructions: SenderWithContext<ClientInstruction>, default_mode: InputMode, receive_input_instructions: Receiver<(InputInstruction, ErrorContext)>, + nested_reannounce: Option<NestedReannounce>, ) { let _handler = InputHandler::new( os_input, @@ -459,6 +494,7 @@ pub(crate) fn input_loop( send_client_instructions, default_mode, receive_input_instructions, + nested_reannounce, ) .handle_input(); } |
