Wayland: implement focus events (#8170)

Implements keyboard focus in/out events.

This also enables vim mode to work on wayland, which is only activated
when an editor gains focus.
This commit is contained in:
Rom Grk 2024-02-22 12:51:09 -05:00 committed by GitHub
parent 40bbd0031d
commit bd94a0e921
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 6 deletions

View file

@ -228,6 +228,12 @@ impl WaylandWindowState {
}
}
}
pub fn set_focused(&self, focus: bool) {
if let Some(ref mut fun) = self.callbacks.lock().active_status_change {
fun(focus);
}
}
}
#[derive(Clone)]
@ -349,7 +355,7 @@ impl PlatformWindow for WaylandWindow {
}
fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>) {
//todo!(linux)
self.0.callbacks.lock().active_status_change = Some(callback);
}
fn on_resize(&self, callback: Box<dyn FnMut(Size<Pixels>, f32)>) {