diff options
Diffstat (limited to 'src/client/shell/endpoint_navigation.rs')
| -rw-r--r-- | src/client/shell/endpoint_navigation.rs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/client/shell/endpoint_navigation.rs b/src/client/shell/endpoint_navigation.rs index 38ad0621..542bf3f9 100644 --- a/src/client/shell/endpoint_navigation.rs +++ b/src/client/shell/endpoint_navigation.rs @@ -35,23 +35,11 @@ impl ClientShellState { press: ClientWorkspacePress, outcome: &mut ClientShellInput, ) { - if press.endpoint_id == self.active_endpoint_id { - self.push_endpoint_method( - crate::api::schema::Method::WorkspaceFocus(crate::api::schema::WorkspaceTarget { - workspace_id: press.workspace_id, - }), - outcome, - ); - } else if self.endpoint_is_online(&press.endpoint_id) { - outcome.actions.push(ClientShellAction::ActivateEndpoint { - endpoint_id: press.endpoint_id, - target: Some(ClientEndpointFocusTarget::Workspace(press.workspace_id)), - }); - } else { - let label = self.endpoint_label(&press.endpoint_id).to_owned(); - self.receive_endpoint_unavailable(format!("{label} is not ready")); - outcome.repaint = true; - } + self.focus_or_activate( + press.endpoint_id, + ClientEndpointFocusTarget::Workspace(press.workspace_id), + outcome, + ); } pub(super) fn handle_endpoint_machine_click( @@ -68,12 +56,16 @@ impl ClientShellState { return false; }; let endpoint_id = hit.endpoint_id.clone(); - if super::contains(hit.collapse_toggle, point) || endpoint_id == self.active_endpoint_id { + let collapse_toggle = super::contains(hit.collapse_toggle, point); + if collapse_toggle || endpoint_id == self.active_endpoint_id { if !self.collapsed_endpoints.remove(&endpoint_id) { - self.collapsed_endpoints.insert(endpoint_id); + self.collapsed_endpoints.insert(endpoint_id.clone()); } outcome.repaint = true; - } else if self.endpoint_is_online(&endpoint_id) { + if !collapse_toggle && endpoint_id.is_local() { + self.activate_endpoint(endpoint_id, outcome); + } + } else if endpoint_id.is_local() || self.endpoint_is_online(&endpoint_id) { outcome.actions.push(ClientShellAction::ActivateEndpoint { endpoint_id, target: None, @@ -236,13 +228,16 @@ impl ClientShellState { endpoint_id: ClientEndpointId, outcome: &mut ClientShellInput, ) -> bool { - if !self.endpoint_is_online(&endpoint_id) { + let online = self.endpoint_is_online(&endpoint_id); + if !online && !endpoint_id.is_local() { let label = self.endpoint_label(&endpoint_id).to_owned(); self.receive_endpoint_unavailable(format!("{label} is not ready")); outcome.repaint = true; return false; } - if endpoint_id != self.active_endpoint_id { + if (endpoint_id.is_local() && (self.multi_endpoint_active() || !online)) + || endpoint_id != self.active_endpoint_id + { outcome.actions.push(ClientShellAction::ActivateEndpoint { endpoint_id, target: None, @@ -257,13 +252,18 @@ impl ClientShellState { target: ClientEndpointFocusTarget, outcome: &mut ClientShellInput, ) -> bool { - if !self.endpoint_is_online(&endpoint_id) { + let online = self.endpoint_is_online(&endpoint_id); + if !online && !endpoint_id.is_local() { let label = self.endpoint_label(&endpoint_id).to_owned(); self.receive_endpoint_unavailable(format!("{label} is not ready")); outcome.repaint = true; return false; } - if endpoint_id == self.active_endpoint_id { + // Local can still be displayed while a remote activation is pending. + // Route explicit selections through the runtime so they can cancel that handoff. + if endpoint_id == self.active_endpoint_id + && !(endpoint_id.is_local() && (self.multi_endpoint_active() || !online)) + { let method = match target { ClientEndpointFocusTarget::Workspace(workspace_id) => { crate::api::schema::Method::WorkspaceFocus( |
