1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

mux: propagate focus changes to remote mux

Pretty much the same test plan as b4c4c85683

but start wezterm:

./target/debug/wezterm -n --config 'ssh_domains={{name="s",remote_address="localhost"}}' connect s

This reliably propagates focus=true events, but if the client switches
focus away from a mux pane to a local pane, then the focus=false event
may not be propagated to the remote mux.

refs: #1608
This commit is contained in:
Wez Furlong 2022-03-27 09:30:18 -07:00
parent 26acdae1d9
commit 3c701d9dc8
2 changed files with 21 additions and 0 deletions

View File

@ -366,9 +366,24 @@ impl Mux {
}
pub fn record_focus_for_client(&self, client_id: &ClientId, pane_id: PaneId) {
let mut prior = None;
if let Some(info) = self.clients.borrow_mut().get_mut(client_id) {
prior = info.focused_pane_id;
info.update_focused_pane(pane_id);
}
if prior == Some(pane_id) {
return;
}
// Synthesize focus events
if let Some(prior_id) = prior {
if let Some(pane) = self.get_pane(prior_id) {
pane.focus_changed(false);
}
}
if let Some(pane) = self.get_pane(pane_id) {
pane.focus_changed(true);
}
}
pub fn register_client(&self, client_id: Arc<ClientId>) {

View File

@ -415,6 +415,12 @@ impl Pane for ClientPane {
self.renderable.borrow().inner.borrow().working_dir.clone()
}
fn focus_changed(&self, focused: bool) {
if focused {
self.advise_focus();
}
}
fn advise_focus(&self) {
let mut focused_pane = self.client.focused_remote_pane_id.lock().unwrap();
if *focused_pane != Some(self.remote_pane_id) {