diff --git a/src/wayland/seat.rs b/src/wayland/seat.rs index b525f33..d8d85f2 100644 --- a/src/wayland/seat.rs +++ b/src/wayland/seat.rs @@ -108,6 +108,12 @@ impl SeatWrapper { touches: Mutex::new(FxHashMap::default()), } } + pub fn unfocus_internal_state(&self, surface: &WlSurface) { + let Some(state) = self.wayland_state.upgrade() else { + return; + }; + self.unfocus(surface, &mut state.lock()); + } pub fn unfocus(&self, surface: &WlSurface, state: &mut WaylandState) { let pointer = self.seat.get_pointer().unwrap(); if pointer.current_focus() == Some(surface.clone()) { diff --git a/src/wayland/xdg_shell.rs b/src/wayland/xdg_shell.rs index e50561b..70d6656 100644 --- a/src/wayland/xdg_shell.rs +++ b/src/wayland/xdg_shell.rs @@ -472,6 +472,7 @@ impl Backend for XdgBackend { fn close_toplevel(&self) { if let Some(toplevel) = self.toplevel.lock().clone() { + self.seat.unfocus_internal_state(toplevel.wl_surface()); toplevel.send_close(); } }