aboutsummaryrefslogtreecommitdiff
path: root/src/server/client_shell_graphics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/client_shell_graphics.rs')
-rw-r--r--src/server/client_shell_graphics.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/server/client_shell_graphics.rs b/src/server/client_shell_graphics.rs
index 578350b2..00355230 100644
--- a/src/server/client_shell_graphics.rs
+++ b/src/server/client_shell_graphics.rs
@@ -1,6 +1,48 @@
use crate::kitty_graphics::surface::DeliveryCache;
use crate::protocol::{ClientShellPopupSurface, SurfaceGraphicsScene};
+pub(crate) fn collect_retained(
+ app: &crate::app::App,
+ surface: &crate::protocol::PaneSurfaceFrame,
+ target: crate::ui::TabSurfaceTarget,
+ cell_size: crate::kitty_graphics::HostCellSize,
+ delivered: &DeliveryCache,
+ client_id: u64,
+) -> Option<(SurfaceGraphicsScene, DeliveryCache)> {
+ let rect = |rect: crate::protocol::SurfaceRect| {
+ ratatui::layout::Rect::new(rect.x, rect.y, rect.width, rect.height)
+ };
+ let pane_infos = surface
+ .panes
+ .iter()
+ .map(|pane| {
+ let (workspace_index, id) = app.parse_pane_id(&pane.pane_id)?;
+ if workspace_index != target.workspace_index {
+ return None;
+ }
+ Some(crate::layout::PaneInfo {
+ id,
+ rect: rect(pane.rect),
+ inner_rect: rect(pane.inner_rect),
+ scrollbar_rect: pane.scrollbar_rect.map(rect),
+ borders: ratatui::widgets::Borders::NONE,
+ is_focused: pane.focused,
+ })
+ })
+ .collect::<Option<Vec<_>>>()?;
+ // Image clipping uses the retained content rectangles, not borders or split handles.
+ Some(collect(
+ app,
+ &pane_infos,
+ &[],
+ None,
+ Some(target),
+ cell_size,
+ delivered,
+ client_id,
+ ))
+}
+
pub(crate) fn collect(
app: &crate::app::App,
pane_infos: &[crate::layout::PaneInfo],