fix: grab keyboard focus on map instead of realize (v0.7.4)
All checks were successful
Update PKGBUILD version / update-pkgver (push) Successful in 3s

Layer-shell keyboard grab is only confirmed by the compositor at map
time. The previous realize-time grab_focus() could fire before the
compositor assigned keyboard input, causing intermittent input loss.
This commit is contained in:
nevaforget 2026-04-06 22:29:37 +02:00
parent 9c1e00d0ef
commit de97d6658e
3 changed files with 14 additions and 2 deletions

2
Cargo.lock generated
View File

@ -575,7 +575,7 @@ dependencies = [
[[package]] [[package]]
name = "moongreet" name = "moongreet"
version = "0.7.1" version = "0.7.4"
dependencies = [ dependencies = [
"gdk-pixbuf", "gdk-pixbuf",
"gdk4", "gdk4",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "moongreet" name = "moongreet"
version = "0.7.3" version = "0.7.4"
edition = "2024" edition = "2024"
description = "A greetd greeter for Wayland with GTK4 and Layer Shell" description = "A greetd greeter for Wayland with GTK4 and Layer Shell"
license = "MIT" license = "MIT"

View File

@ -553,6 +553,18 @@ pub fn create_greeter_window(
)); ));
window.add_controller(key_controller); window.add_controller(key_controller);
// Grab keyboard focus after map — layer-shell keyboard grab is only
// confirmed by the compositor at map time, not at realize time.
window.connect_map(clone!(
#[weak]
password_entry,
move |_| {
glib::idle_add_local_once(move || {
password_entry.grab_focus();
});
}
));
// Defer initial user selection until realized (for correct theme colors) // Defer initial user selection until realized (for correct theme colors)
window.connect_realize(clone!( window.connect_realize(clone!(
#[strong] #[strong]