diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-09 02:04:39 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-09 02:04:39 +0300 |
| commit | 1777e9bba32b953ed1ad203b4a16d01105539000 (patch) | |
| tree | 22096973812c9baba822453d8470bdcfe64fc2a6 /src/app/state.rs | |
| parent | 36a8d36a7258e08b40c01bf521b1f4006525f143 (diff) | |
feat(graphics): add direct pane frame streaming (#2523)
* feat(graphics): add direct pane frame streaming
* feat(graphics): expose pane visibility
* test(graphics): preserve legacy terminal image output
* fix(graphics): harden streaming lifecycle
* fix(input): preserve mouse releases outside panes
Diffstat (limited to 'src/app/state.rs')
| -rw-r--r-- | src/app/state.rs | 54 |
1 files changed, 7 insertions, 47 deletions
diff --git a/src/app/state.rs b/src/app/state.rs index 04876290..e460f62b 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -4,7 +4,6 @@ use crate::config::{ use crossterm::event::{KeyCode, KeyModifiers}; use ratatui::layout::{Direction, Rect}; use ratatui::style::Color; -use std::hash::{Hash, Hasher}; use crate::detect::AgentState; use crate::layout::{PaneId, PaneInfo, SplitBorder}; @@ -12,7 +11,6 @@ use crate::selection::Selection; pub(crate) type InstalledPluginRegistry = std::collections::HashMap<String, crate::api::schema::InstalledPluginInfo>; - #[derive(Clone, Debug, PartialEq, Eq)] pub(crate) struct PluginPaneRecord { pub plugin_id: String, @@ -20,42 +18,6 @@ pub(crate) struct PluginPaneRecord { } #[derive(Clone, Debug, PartialEq, Eq)] -pub(crate) struct PaneGraphicsLayer { - pub format: crate::api::schema::PaneGraphicsFormat, - pub image_width: u32, - pub image_height: u32, - pub data: Vec<u8>, - pub data_fingerprint: u64, - pub render: crate::api::schema::PaneGraphicsPlacementParams, -} - -impl PaneGraphicsLayer { - pub(crate) fn new( - format: crate::api::schema::PaneGraphicsFormat, - image_width: u32, - image_height: u32, - data: Vec<u8>, - render: crate::api::schema::PaneGraphicsPlacementParams, - ) -> Self { - let data_fingerprint = pane_graphics_data_fingerprint(&data); - Self { - format, - image_width, - image_height, - data, - data_fingerprint, - render, - } - } -} - -fn pane_graphics_data_fingerprint(data: &[u8]) -> u64 { - let mut hasher = std::collections::hash_map::DefaultHasher::new(); - data.hash(&mut hasher); - hasher.finish() -} - -#[derive(Clone, Debug, PartialEq, Eq)] pub(crate) struct PopupPaneState { pub pane_id: PaneId, pub terminal_id: crate::terminal::TerminalId, @@ -1520,12 +1482,6 @@ pub struct AppState { pub(crate) installed_plugins: InstalledPluginRegistry, /// Pane ids opened through the plugin pane API. pub(crate) plugin_panes: std::collections::HashMap<PaneId, PluginPaneRecord>, - /// Runtime image layers owned by API clients and composited over panes. - pub(crate) pane_graphics_layers: std::collections::HashMap<PaneId, PaneGraphicsLayer>, - /// Active streaming graphics owner token by pane id. - pub(crate) pane_graphics_streams: std::collections::HashMap<PaneId, String>, - /// Monotonic marker for accepted pane graphics mutations. - pub(crate) pane_graphics_revision: u64, /// Session-modal terminal popup. This is intentionally outside workspace layouts. pub(crate) popup_pane: Option<PopupPaneState>, /// Recent plugin action/event command executions. @@ -1538,6 +1494,8 @@ pub struct AppState { pub host_terminal_theme: TerminalTheme, /// Last known foreground host terminal cell size in pixels. pub(crate) host_cell_size: crate::kitty_graphics::HostCellSize, + /// Exact pixel provenance only while one confirmed SGR report is dispatched. + pub(crate) host_mouse_pixels: Option<crate::input::mouse::HostPixels>, /// Set when a persisted session snapshot would change. pub session_dirty: bool, /// Terminal runtimes that should be shut down by the app/runtime layer @@ -1884,9 +1842,6 @@ impl AppState { integration_install_messages: Vec::new(), installed_plugins: std::collections::HashMap::new(), plugin_panes: std::collections::HashMap::new(), - pane_graphics_layers: std::collections::HashMap::new(), - pane_graphics_streams: std::collections::HashMap::new(), - pane_graphics_revision: 0, popup_pane: None, plugin_command_logs: Vec::new(), next_plugin_command_log_id: 1, @@ -1894,6 +1849,7 @@ impl AppState { global_menu: MenuListState::new(0), host_terminal_theme: TerminalTheme::default(), host_cell_size: crate::kitty_graphics::HostCellSize::default(), + host_mouse_pixels: None, session_dirty: false, terminal_runtime_shutdowns: Vec::new(), } @@ -2000,6 +1956,10 @@ impl AppState { self.context_menu.is_none(), "empty app state must not keep context menu" ); + assert!( + self.host_mouse_pixels.is_none(), + "empty app state must not keep host mouse pixel provenance" + ); return; } |
