Skip to content

Commit

Permalink
src: ignore focus events
Browse files Browse the repository at this point in the history
The focus state does not matter to us
  • Loading branch information
marcelohdez committed Mar 2, 2024
1 parent 47216eb commit 3c2541c
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions src/dim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ pub struct DimData {
alpha: f32,
views: Vec<DimView>,

exit: bool,
keyboard: Option<wl_keyboard::WlKeyboard>,
keyboard_focus: bool,
pointer: Option<wl_pointer::WlPointer>,
touch: Option<wl_touch::WlTouch>,
exit: bool,
}

struct DimView {
Expand Down Expand Up @@ -94,7 +93,6 @@ impl DimData {

exit: false,
keyboard: None,
keyboard_focus: true,
pointer: None,
touch: None,
}
Expand Down Expand Up @@ -379,37 +377,21 @@ impl KeyboardHandler for DimData {
_conn: &smithay_client_toolkit::reexports::client::Connection,
_qh: &QueueHandle<Self>,
_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(
&mut self,
_conn: &smithay_client_toolkit::reexports::client::Connection,
_qh: &QueueHandle<Self>,
_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(
Expand Down Expand Up @@ -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,
}
}
Expand Down

0 comments on commit 3c2541c

Please sign in to comment.