fix wayland keyboard input #43

Merged
Schmarni-Dev merged 2 commits from dev into dev 2025-05-05 18:32:36 -04:00
2 changed files with 7 additions and 1 deletions

View File

@@ -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()) {
@@ -240,7 +246,6 @@ impl SeatWrapper {
0,
|_, _, _| FilterResult::Forward::<()>,
);
keyboard.set_focus(&mut state.lock(), None, SERIAL_COUNTER.next_serial());
}
pub fn touch_down(&self, surface: WlSurface, id: u32, position: Vector2<f32>) {

View File

@@ -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();
}
}