Remove custom keylayout init code since we are back on matching winit version with the keylayout crate.

This commit is contained in:
Imbris 2023-01-02 22:43:32 +00:00
parent edb34116b4
commit d254e14771

View File

@ -469,7 +469,7 @@ impl Window {
let scale_factor = window.scale_factor();
let key_layout = match init_keylayout_from_window(&window) {
let key_layout = match KeyLayout::new_from_window(&window) {
Ok(kl) => Some(kl),
Err(err) => {
warn!(
@ -1389,31 +1389,4 @@ impl Default for FullScreenSettings {
refresh_rate: None,
}
}
}
use keyboard_keynames::errors::KeyLayoutError;
fn init_keylayout_from_window(
_window: &winit::window::Window,
) -> Result<KeyLayout, KeyLayoutError> {
#[cfg(target_family = "unix")]
{
use keyboard_keynames::key_layout::KeyLayoutExtUnix;
use winit::platform::unix::WindowExtUnix;
match _window.xcb_connection() {
Some(_) => KeyLayout::new_x11(),
None => KeyLayout::new_wayland(),
}
}
#[cfg(target_family = "windows")]
{
Ok(KeyLayout {})
}
#[cfg(all(not(target_family = "unix"), not(target_family = "windows")))]
{
Err(KeyLayoutError::PlatformUnsupportedError)
}
}
}