diff options
Diffstat (limited to 'src/layout/tab_indicator.rs')
| -rw-r--r-- | src/layout/tab_indicator.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/layout/tab_indicator.rs b/src/layout/tab_indicator.rs index 451f2224..ad457386 100644 --- a/src/layout/tab_indicator.rs +++ b/src/layout/tab_indicator.rs @@ -182,6 +182,27 @@ impl TabIndicator { } } + pub fn hit( + &self, + area: Rectangle<f64, Logical>, + tab_count: usize, + scale: f64, + point: Point<f64, Logical>, + ) -> Option<usize> { + if self.config.off { + return None; + } + + let count = tab_count; + if self.config.hide_when_single_tab && count == 1 { + return None; + } + + self.tab_rects(area, count, scale) + .enumerate() + .find_map(|(idx, rect)| rect.contains(point).then_some(idx)) + } + pub fn render( &self, renderer: &mut impl NiriRenderer, |
