From 3c2541c2029d46f17dc3f9047dfe0cc153395534 Mon Sep 17 00:00:00 2001 From: Marcelo Hernandez Lopez Date: Sat, 2 Mar 2024 18:00:30 -0500 Subject: [PATCH] src: ignore focus events The focus state does not matter to us --- src/dim.rs | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/dim.rs b/src/dim.rs index 9d4adad..88f7167 100644 --- a/src/dim.rs +++ b/src/dim.rs @@ -53,11 +53,10 @@ pub struct DimData { alpha: f32, views: Vec, - exit: bool, keyboard: Option, - keyboard_focus: bool, pointer: Option, touch: Option, + exit: bool, } struct DimView { @@ -94,7 +93,6 @@ impl DimData { exit: false, keyboard: None, - keyboard_focus: true, pointer: None, touch: None, } @@ -379,19 +377,11 @@ impl KeyboardHandler for DimData { _conn: &smithay_client_toolkit::reexports::client::Connection, _qh: &QueueHandle, _keyboard: &wl_keyboard::WlKeyboard, - surface: &smithay_client_toolkit::reexports::client::protocol::wl_surface::WlSurface, + _surface: &smithay_client_toolkit::reexports::client::protocol::wl_surface::WlSurface, _serial: u32, _raw: &[u32], _keysyms: &[smithay_client_toolkit::seat::keyboard::Keysym], ) { - if self - .views - .iter() - .any(|view| view.layer.wl_surface() == surface) - { - debug!("Gained keyboard focus"); - self.keyboard_focus = true; - } } fn leave( @@ -399,17 +389,9 @@ impl KeyboardHandler for DimData { _conn: &smithay_client_toolkit::reexports::client::Connection, _qh: &QueueHandle, _keyboard: &wl_keyboard::WlKeyboard, - surface: &smithay_client_toolkit::reexports::client::protocol::wl_surface::WlSurface, + _surface: &smithay_client_toolkit::reexports::client::protocol::wl_surface::WlSurface, _serial: u32, ) { - if self - .views - .iter() - .any(|view| view.layer.wl_surface() == surface) - { - debug!("Lost keyboard focus"); - self.keyboard_focus = false; - } } fn press_key( @@ -457,9 +439,7 @@ impl PointerHandler for DimData { ) { for e in events { match e.kind { - PointerEventKind::Enter { .. } | PointerEventKind::Leave { .. } => { - debug!("Mouse focus changed!") - } + PointerEventKind::Enter { .. } | PointerEventKind::Leave { .. } => (), _ => self.exit = true, } }