Skip to content

Commit ae29f5b

Browse files
Schmarni-Devtechnobaboo
authored andcommitted
fix(wayland): fix keyboard holding onto surfaces without causing visual or functional issues
Signed-off-by: Schmarni <marnistromer@gmail.com>
1 parent 4e3a0e7 commit ae29f5b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/wayland/seat.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ impl SeatWrapper {
108108
touches: Mutex::new(FxHashMap::default()),
109109
}
110110
}
111+
pub fn unfocus_internal_state(&self, surface: &WlSurface) {
112+
let Some(state) = self.wayland_state.upgrade() else {
113+
return;
114+
};
115+
self.unfocus(surface, &mut state.lock());
116+
}
111117
pub fn unfocus(&self, surface: &WlSurface, state: &mut WaylandState) {
112118
let pointer = self.seat.get_pointer().unwrap();
113119
if pointer.current_focus() == Some(surface.clone()) {

src/wayland/xdg_shell.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ impl Backend for XdgBackend {
472472

473473
fn close_toplevel(&self) {
474474
if let Some(toplevel) = self.toplevel.lock().clone() {
475+
self.seat.unfocus_internal_state(toplevel.wl_surface());
475476
toplevel.send_close();
476477
}
477478
}

0 commit comments

Comments
 (0)