Merge pull request #41 from pop-os/fix/xkb-crash

input: Don't ignore keyboard init failures
This commit is contained in:
Victoria Brekenfeld 2022-09-23 19:19:20 +02:00 committed by GitHub
commit 10353f3f75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,7 @@ use smithay::{
},
desktop::{layer_map_for_output, Kind, WindowSurfaceType},
input::{
keyboard::{keysyms, FilterResult, KeysymHandle},
keyboard::{keysyms, FilterResult, KeysymHandle, XkbConfig},
pointer::{AxisFrame, ButtonEvent, CursorImageStatus, MotionEvent},
Seat, SeatState,
},
@ -124,8 +124,15 @@ pub fn add_seat(
// So instead of doing the right thing (and initialize these capabilities as matching
// devices appear), we have to surrender to reality and just always expose a keyboard and pointer.
let conf = config.xkb_config();
let _ = seat.add_keyboard((&conf).into(), 200, 25);
let _ = seat.add_pointer();
if let Err(err) = seat.add_keyboard((&conf).into(), 200, 25) {
slog_scope::warn!(
"Failed to load provided xkb config: {}. Trying default...",
err
);
seat.add_keyboard(XkbConfig::default(), 200, 25)
.expect("Failed to load xkb configuration files");
}
seat.add_pointer();
seat
}