From 8cff8fc918ad8a86a990ddde0cca56fee1dc0c7b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 2 Feb 2023 08:25:30 -0700 Subject: [PATCH] x11: simplify focus event matching refs: #2959 --- window/src/os/x11/window.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index 9e675cb73..b0b4f4b1d 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -585,18 +585,16 @@ impl XWindowInner { self.verify_focus = true; } } - Event::X(xcb::x::Event::FocusIn(e)) => match e.detail() { - xcb::x::NotifyDetail::Pointer => (), - _ => { - self.focus_changed(true); - } - }, - Event::X(xcb::x::Event::FocusOut(e)) => match e.detail() { - xcb::x::NotifyDetail::Pointer => (), - _ => { - self.focus_changed(false); - } - }, + Event::X(xcb::x::Event::FocusIn(e)) + if !matches!(e.detail(), xcb::x::NotifyDetail::Pointer) => + { + self.focus_changed(true); + } + Event::X(xcb::x::Event::FocusOut(e)) + if !matches!(e.detail(), xcb::x::NotifyDetail::Pointer) => + { + self.focus_changed(false); + } Event::X(xcb::x::Event::LeaveNotify(_)) => { self.events.dispatch(WindowEvent::MouseLeave); }