From f76d7df549e95e1699651f59916e9a38f0f58985 Mon Sep 17 00:00:00 2001 From: Michael Hackner Date: Thu, 13 Aug 2026 08:00:32 -0700 Subject: fix: keep tab and sidebar clicks when the terminal reports a stray drag (#2736) * fix: keep tab and sidebar clicks when the terminal reports a stray drag This works around a Ghostty bug that causes herdr tabs to be unclickable in fullscreen mode. Ghostty on macOS in native fullscreen emits one motion report after a fresh press in the strip where the menu bar reveals, with the row shifted to near the bottom of the grid. The cause is upstream: macOS delivers one mouse event whose y is nearly a window height away from the real pointer, and Ghostty reports it as it arrives (iTerm2 and Terminal.app report the same clicks correctly). Herdr treated the stray report as a real drag and lost the click two ways: it opened a tab reorder with no drop target, making the release a no-op, and it handed the release to the pane under the bogus coordinates. Now, a press on the tab bar or sidebar owns the gesture until release, and a tab drag only starts once the pointer is over a real drop target. refs #796 * fix: scope chrome mouse gestures to their input source * fix: preserve chrome drag input source * fix: preserve concurrent chrome presses --------- Co-authored-by: Ogulcan Celik --- src/app/state.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/app/state.rs') diff --git a/src/app/state.rs b/src/app/state.rs index cbecef00..cb687363 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -1089,10 +1089,12 @@ pub(crate) enum WorkspaceDropTarget { pub(crate) enum DragTarget { WorkspaceReorder { + source_id: crate::app::InputSourceId, source_ws_idx: usize, drop_target: Option, }, TabReorder { + source_id: crate::app::InputSourceId, ws_idx: usize, source_tab_idx: usize, insert_idx: Option, @@ -1382,8 +1384,9 @@ pub struct AppState { // View geometry (computed before render, consumed by render + mouse) pub view: ViewState, pub(crate) drag: Option, - pub(crate) workspace_press: Option, - pub(crate) tab_press: Option, + pub(crate) workspace_presses: + std::collections::HashMap, + pub(crate) tab_presses: std::collections::HashMap, pub selection: Option, pub selection_autoscroll: Option, pub context_menu: Option, @@ -1758,8 +1761,8 @@ impl AppState { split_borders: Vec::new(), }, drag: None, - workspace_press: None, - tab_press: None, + workspace_presses: std::collections::HashMap::new(), + tab_presses: std::collections::HashMap::new(), selection: None, selection_autoscroll: None, context_menu: None, @@ -1955,11 +1958,11 @@ impl AppState { "empty app state must not keep drag state" ); assert!( - self.workspace_press.is_none(), + self.workspace_presses.is_empty(), "empty app state must not keep workspace press state" ); assert!( - self.tab_press.is_none(), + self.tab_presses.is_empty(), "empty app state must not keep tab press state" ); assert!( @@ -2126,6 +2129,7 @@ impl AppState { DragTarget::WorkspaceReorder { source_ws_idx, drop_target, + .. } => { assert_workspace_index(*source_ws_idx, "workspace drag source"); if let Some(WorkspaceDropTarget::Before(ws_idx)) = drop_target { @@ -2136,6 +2140,7 @@ impl AppState { ws_idx, source_tab_idx, insert_idx, + .. } => { assert_tab_index(*ws_idx, *source_tab_idx, "tab drag source"); if let Some(insert_idx) = insert_idx { @@ -2154,10 +2159,10 @@ impl AppState { _ => {} } } - if let Some(press) = &self.workspace_press { + for press in self.workspace_presses.values() { assert_workspace_index(press.ws_idx, "workspace press"); } - if let Some(press) = &self.tab_press { + for press in self.tab_presses.values() { assert_tab_index(press.ws_idx, press.tab_idx, "tab press"); } if let Some(menu) = &self.context_menu { -- cgit v1.2.3