diff --git a/compositor/src/input.rs b/compositor/src/input.rs index 3b6c66b..12d83b8 100644 --- a/compositor/src/input.rs +++ b/compositor/src/input.rs @@ -25,17 +25,6 @@ use smithay::{ }; use crate::{Ferese, config::BindingAction}; -use ferese_layout::WindowId; - -fn hover_blocked_after_drag(blocked: &mut Option, target: Option) -> bool { - if let Some(window) = *blocked { - if target == Some(window) { - return true; - } - *blocked = None; - } - false -} impl Ferese { pub fn process_input_event(&mut self, event: InputEvent) { @@ -290,12 +279,6 @@ impl Ferese { InputEvent::PointerButton { event, .. } => { let pointer = self.seat.get_pointer().expect("seat has a pointer"); let serial = SERIAL_COUNTER.next_serial(); - let released_over_another_window = (event.state() == ButtonState::Released - && pointer.is_grabbed()) - .then(|| self.window_under_visual(pointer.current_location())) - .flatten() - .and_then(|window| self.window_ids.get(&window).copied()) - .filter(|window| Some(*window) != self.focused_window); // Native popup_done destroys Iced's window immediately. For // effects-capable shell popups, release input now but defer @@ -354,7 +337,6 @@ impl Ferese { } if event.state() == ButtonState::Pressed && !pointer.is_grabbed() { - self.hover_focus_blocked = None; self.focus_window_at(pointer.current_location(), serial, true); } @@ -368,9 +350,6 @@ impl Ferese { }, ); pointer.frame(self); - if event.state() == ButtonState::Released { - self.hover_focus_blocked = released_over_another_window; - } } InputEvent::PointerAxis { event, .. } => { let source = event.source(); @@ -645,19 +624,8 @@ impl Ferese { { return; } - if self.layer_under(position).is_some() { - self.hover_focus_blocked = None; - return; - } - let window = self.window_under_visual(position); - let target = window - .as_ref() - .and_then(|window| self.window_ids.get(window).copied()); - if hover_blocked_after_drag(&mut self.hover_focus_blocked, target) { - return; - } - let Some(window) = window else { + let Some(window) = self.window_under_visual(position) else { return; }; if self.window_ids.get(&window).copied() == self.focused_window { @@ -829,23 +797,7 @@ fn overview_escape(symbol: u32, overview_active: bool) -> bool { #[cfg(test)] mod tests { - use super::{ - WindowId, emergency_shortcut_escape, hover_blocked_after_drag, overview_escape, - virtual_terminal, - }; - - #[test] - fn drag_release_does_not_turn_motion_inside_the_same_window_into_hover_focus() { - let selected = WindowId(1); - let other = WindowId(2); - let mut blocked = Some(other); - - assert!(hover_blocked_after_drag(&mut blocked, Some(other))); - assert!(hover_blocked_after_drag(&mut blocked, Some(other))); - assert!(!hover_blocked_after_drag(&mut blocked, Some(selected))); - assert_eq!(blocked, None); - assert!(!hover_blocked_after_drag(&mut blocked, Some(other))); - } + use super::{emergency_shortcut_escape, overview_escape, virtual_terminal}; #[test] fn escape_closes_only_an_active_overview() { diff --git a/compositor/src/state.rs b/compositor/src/state.rs index a764f25..947ce56 100644 --- a/compositor/src/state.rs +++ b/compositor/src/state.rs @@ -147,7 +147,6 @@ pub struct Ferese { viewport_coupled_widths: HashMap, pending_column_width_cycles: HashSet, pub focused_window: Option, - pub(crate) hover_focus_blocked: Option, column_width_presets: Vec, gap_config: GapConfig, pub(crate) input_settings: InputSettings, @@ -361,7 +360,6 @@ impl Ferese { viewport_coupled_widths: HashMap::new(), pending_column_width_cycles: HashSet::new(), focused_window: None, - hover_focus_blocked: None, column_width_presets: config.column_width_presets, gap_config: config.gap_config, input_settings: config.input_settings, @@ -864,23 +862,11 @@ impl Ferese { let visual = self.presented_window_rect(*id)?; let caption_height = if overview_active { 34.0 } else { 0.0 }; - let inside_visual = position.x >= visual.x + (position.x >= visual.x && position.y >= visual.y && position.x < visual.x + visual.width - && position.y < visual.y + visual.height + caption_height; - if !inside_visual { - return None; - } - - if !overview_active { - let (source_x, source_y) = - self.inverse_presented_window_point(*id, position.x, position.y)?; - let source_point = - Point::from((source_x, source_y)) + window.geometry().loc.to_f64(); - window.surface_under(source_point, WindowSurfaceType::ALL)?; - } - - Some(window.clone()) + && position.y < visual.y + visual.height + caption_height) + .then_some(window.clone()) }; if overview_active {