Merge branch 'blinc/voxygen-wayland-fix' into 'master'

Fix wayland permission problem by updating keyboard-keynames

See merge request veloren/veloren!3733
This commit is contained in:
Marcel 2023-01-02 14:07:06 +00:00
commit 54176068cf
3 changed files with 52 additions and 33 deletions

54
Cargo.lock generated
View File

@ -3133,16 +3133,15 @@ dependencies = [
[[package]]
name = "keyboard-keynames"
version = "0.1.0"
source = "git+https://gitlab.com/Frinksy/keyboard-keynames.git?branch=develop#1ae010ca032a57dfe0ba01d4346a3b03bde36de0"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f32e85d306d31d33240ea15accdf6e153d0a31da1409a21a0d5fb7ca5ef91d6c"
dependencies = [
"libc",
"memmap",
"wayland-client 0.28.6",
"wayland-client 0.29.5",
"winapi 0.3.9",
"winit",
"xcb 0.9.0",
"xkbcommon-sys",
"xcb 1.2.0",
"xkbcommon",
]
[[package]]
@ -3422,16 +3421,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memmap"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
dependencies = [
"libc",
"winapi 0.3.9",
]
[[package]]
name = "memmap2"
version = "0.1.0"
@ -8218,16 +8207,6 @@ dependencies = [
"libc",
]
[[package]]
name = "xcb"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6"
dependencies = [
"libc",
"log",
]
[[package]]
name = "xcb"
version = "0.10.1"
@ -8239,6 +8218,17 @@ dependencies = [
"quick-xml",
]
[[package]]
name = "xcb"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0faeb4d7e2d54fff4a0584f61297e86b106914af2029778de7b427f72564d6c5"
dependencies = [
"bitflags",
"libc",
"quick-xml",
]
[[package]]
name = "xcursor"
version = "0.3.4"
@ -8264,12 +8254,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a"
[[package]]
name = "xkbcommon-sys"
version = "0.7.6"
source = "git+https://github.com/Frinksy/rust-xkbcommon-sys.git?rev=8f615dd6cd90a4ab77c45627830dde49b592b9b5#8f615dd6cd90a4ab77c45627830dde49b592b9b5"
name = "xkbcommon"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbee136714379ab22da0280207fdb7f47e0bb940adea97731b65598b8c7a92e"
dependencies = [
"libc",
"pkg-config",
"memmap2 0.5.7",
"xcb 1.2.0",
]
[[package]]

View File

@ -75,7 +75,7 @@ iced = {package = "iced_native", git = "https://github.com/Imberflur/iced", tag
iced_winit = {git = "https://github.com/Imberflur/iced", tag = "winit-0.25"}
window_clipboard = "0.2"
glyph_brush = "0.7.0"
keyboard-keynames = { git = "https://gitlab.com/Frinksy/keyboard-keynames.git", branch = "develop" }
keyboard-keynames = "0.1.2"
# EGUI
egui = {version = "0.12", optional = true }

View File

@ -469,7 +469,7 @@ impl Window {
let scale_factor = window.scale_factor();
let key_layout = match KeyLayout::new_from_window(&window) {
let key_layout = match init_keylayout_from_window(&window) {
Ok(kl) => Some(kl),
Err(err) => {
warn!(
@ -1390,3 +1390,30 @@ impl Default for FullScreenSettings {
}
}
}
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)
}
}