Don't forward enter or escape to unlock window on first event

If the user presses enter or escape in order to get the unlock dialog to
show in the first place, forwarding that event to the dialog will only
cause it to close immediately.

Also took the opportunity to clean up the dependencies where I have my
own patches.  I'm now using the cargo 'patch' section so that the
dependencies specified in the individual Cargo.toml files are clean.
This commit is contained in:
Brian Tarricone 2022-05-17 19:44:38 -07:00
parent 9e266894df
commit c3166f0b9c
11 changed files with 266 additions and 43 deletions

251
Cargo.lock generated
View File

@ -11,6 +11,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.57" version = "1.0.57"
@ -232,6 +241,29 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bindgen"
version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"clap 2.34.0",
"env_logger 0.8.4",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"which",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -259,12 +291,14 @@ dependencies = [
"anyhow", "anyhow",
"bscreensaver-command", "bscreensaver-command",
"bscreensaver-util", "bscreensaver-util",
"clap", "clap 3.1.18",
"libc", "libc",
"log", "log",
"nix", "nix",
"x11",
"xcb", "xcb",
"xcb-xembed", "xcb-xembed",
"xkb",
] ]
[[package]] [[package]]
@ -272,7 +306,7 @@ name = "bscreensaver-command"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bscreensaver-util", "bscreensaver-util",
"clap", "clap 3.1.18",
"nix", "nix",
"xcb", "xcb",
] ]
@ -343,8 +377,8 @@ name = "bscreensaver-util"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap 3.1.18",
"env_logger", "env_logger 0.9.0",
"humantime", "humantime",
"lazy_static", "lazy_static",
"libc", "libc",
@ -403,6 +437,15 @@ version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cexpr"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
dependencies = [
"nom",
]
[[package]] [[package]]
name = "cfg-expr" name = "cfg-expr"
version = "0.10.2" version = "0.10.2"
@ -432,18 +475,44 @@ dependencies = [
] ]
[[package]] [[package]]
name = "clap" name = "clang-sys"
version = "3.1.14" version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535434c063ced786eb04aaf529308092c5ab60889e8fe24275d15de07b01fa97" checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"strsim 0.8.0",
"textwrap 0.11.0",
"unicode-width",
"vec_map",
]
[[package]]
name = "clap"
version = "3.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"clap_lex", "clap_lex",
"indexmap", "indexmap",
"strsim", "strsim 0.10.0",
"termcolor", "termcolor",
"textwrap", "textwrap 0.15.0",
] ]
[[package]] [[package]]
@ -542,6 +611,19 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "env_logger"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.9.0" version = "0.9.0"
@ -873,6 +955,12 @@ dependencies = [
"system-deps", "system-deps",
] ]
[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]] [[package]]
name = "gloo-timers" name = "gloo-timers"
version = "0.2.4" version = "0.2.4"
@ -1028,10 +1116,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "lazycell"
version = "0.2.125" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "libloading"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd"
dependencies = [
"cfg-if",
"winapi",
]
[[package]] [[package]]
name = "lock_api" name = "lock_api"
@ -1045,9 +1149,9 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.16" version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"value-bag", "value-bag",
@ -1092,6 +1196,16 @@ dependencies = [
"memoffset", "memoffset",
] ]
[[package]]
name = "nom"
version = "5.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
dependencies = [
"memchr",
"version_check",
]
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.45" version = "0.1.45"
@ -1139,9 +1253,9 @@ dependencies = [
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.0.0" version = "6.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" checksum = "029d8d0b2f198229de29dca79676f2738ff952edf3fde542eb8bf94d8c21b435"
[[package]] [[package]]
name = "pam" name = "pam"
@ -1219,6 +1333,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "pest" name = "pest"
version = "2.1.3" version = "2.1.3"
@ -1301,11 +1421,11 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.37" version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
@ -1439,6 +1559,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.3.3" version = "0.3.3"
@ -1524,6 +1650,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]]
name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.6" version = "0.4.6"
@ -1552,6 +1684,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
@ -1560,13 +1698,13 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.92" version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
@ -1601,6 +1739,15 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.15.0" version = "0.15.0"
@ -1663,10 +1810,16 @@ dependencies = [
] ]
[[package]] [[package]]
name = "unicode-xid" name = "unicode-ident"
version = "0.2.2" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
[[package]]
name = "unicode-width"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]] [[package]]
name = "users" name = "users"
@ -1679,14 +1832,20 @@ dependencies = [
[[package]] [[package]]
name = "value-bag" name = "value-bag"
version = "1.0.0-alpha.8" version = "1.0.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55"
dependencies = [ dependencies = [
"ctor", "ctor",
"version_check", "version_check",
] ]
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.1.0" version = "0.1.0"
@ -1796,6 +1955,15 @@ dependencies = [
"cc", "cc",
] ]
[[package]]
name = "which"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"
@ -1865,6 +2033,27 @@ dependencies = [
"dirs", "dirs",
] ]
[[package]]
name = "xkb"
version = "0.2.1"
source = "git+https://github.com/kelnos/rust-xkb?branch=xcb-1.x#c24c9ec0cdc362aed7bc17686953846a2ab1e41d"
dependencies = [
"bitflags",
"libc",
"xcb",
"xkbcommon-sys",
]
[[package]]
name = "xkbcommon-sys"
version = "0.7.5"
source = "git+https://github.com/kelnos/rust-xkbcommon-sys?branch=release-0.7.x#8579153d01ef87096abf0ef02608e5dde8e96a0c"
dependencies = [
"bindgen",
"libc",
"pkg-config",
]
[[package]] [[package]]
name = "zbus" name = "zbus"
version = "2.2.0" version = "2.2.0"
@ -1929,9 +2118,9 @@ dependencies = [
[[package]] [[package]]
name = "zvariant" name = "zvariant"
version = "3.2.0" version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e18ba99d71e03af262953f476071607da0c44e225236cf9b5b9f7f11f1d0b6b0" checksum = "cbd1abd8bc2c855412b9c8af9fc11c0d695c73c732ad5a1a1be10f3fd4bf19b2"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"enumflags2", "enumflags2",
@ -1943,9 +2132,9 @@ dependencies = [
[[package]] [[package]]
name = "zvariant_derive" name = "zvariant_derive"
version = "3.2.0" version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9042892ebdca35261951a83d17bcbfd4d3d528cb3bde828498a9b306b50d05c0" checksum = "abebd57382dfacf3e7bbdd7b7c3d162d6ed0687a78f046263ddef4ddabc275ae"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",

View File

@ -10,3 +10,11 @@ members = [
"systemd", "systemd",
"xcb-xembed", "xcb-xembed",
] ]
[patch.crates-io]
# git source needed until extension event error resolution fix is released
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e" }
# xkb package depends on xcb 0.9
xkb = { git = "https://github.com/kelnos/rust-xkb", branch = "xcb-1.x" }
# Build error in v0.7.5 when x11 feature enabled
ffi = { package = "xkbcommon-sys", git = "https://github.com/kelnos/rust-xkbcommon-sys", branch = "release-0.7.x" }

View File

@ -9,5 +9,4 @@ async-std = { version = "1.11", features = ["attributes"] }
futures = "0.3" futures = "0.3"
futures-lite = "1.12" futures-lite = "1.12"
nix = "0.23" nix = "0.23"
# git source needed until extension event error resolution fix is released xcb = "1"
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e" }

View File

@ -7,4 +7,4 @@ edition = "2021"
bscreensaver-util = { path = "../util" } bscreensaver-util = { path = "../util" }
clap = "3" clap = "3"
nix = "0.23" nix = "0.23"
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e" } xcb = "1"

View File

@ -11,6 +11,5 @@ bscreensaver-command = { path = "../command" }
bscreensaver-util = { path = "../util" } bscreensaver-util = { path = "../util" }
futures = "0.3" futures = "0.3"
log = "0.4" log = "0.4"
# git source needed until extension event error resolution fix is released xcb = "1"
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e" }
zbus = "2" zbus = "2"

1
debian/control vendored
View File

@ -9,6 +9,7 @@ Build-Depends:
libxcb-randr0-dev, libxcb-randr0-dev,
libxcb-xfixes0-dev, libxcb-xfixes0-dev,
libxcb1-dev, libxcb1-dev,
libxkbcommon-x11-dev,
libgtk-3-dev, libgtk-3-dev,
libpam0g-dev, libpam0g-dev,
cargo (>= 0.57), cargo (>= 0.57),

View File

@ -20,6 +20,7 @@ bscreensaver-util = { path = "../util" }
libc = "0.2" libc = "0.2"
log = "0.4" log = "0.4"
nix = "0.23" nix = "0.23"
# git source needed until extension event error resolution fix is released x11 = "2.19"
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e", features = ["randr", "xfixes", "xinput"] } xcb = { version = "1", features = ["randr", "xkb", "xfixes", "xinput"] }
xcb-xembed = { path = "../xcb-xembed" } xcb-xembed = { path = "../xcb-xembed" }
xkb = { version = "0.2", features = ["x11"] }

View File

@ -112,7 +112,7 @@ fn main() -> anyhow::Result<()> {
let (conn, screen_num) = xcb::Connection::connect_with_extensions( let (conn, screen_num) = xcb::Connection::connect_with_extensions(
None, None,
&[xcb::Extension::RandR, xcb::Extension::XFixes, xcb::Extension::Input], &[xcb::Extension::RandR, xcb::Extension::XFixes, xcb::Extension::Input, xcb::Extension::Xkb],
&[] &[]
)?; )?;
let setup = conn.get_setup(); let setup = conn.get_setup();
@ -121,6 +121,8 @@ fn main() -> anyhow::Result<()> {
init_xfixes(&conn)?; init_xfixes(&conn)?;
init_xinput(&conn)?; init_xinput(&conn)?;
init_randr(&conn)?; init_randr(&conn)?;
xkb::x11::setup(&conn, xkb::x11::MIN_MAJOR_XKB_VERSION, xkb::x11::MIN_MINOR_XKB_VERSION, xkb::x11::NO_FLAGS)
.map_err(|_| anyhow::anyhow!("Failed to initialize XKB extension"))?;
create_command_window(&conn, &screen)?; create_command_window(&conn, &screen)?;
let command_atoms = CommandAtoms { let command_atoms = CommandAtoms {
@ -740,6 +742,20 @@ fn start_unlock_dialog<'a>(conn: &'a xcb::Connection, state: &State<'a>, trigger
show_cursor(conn, state); show_cursor(conn, state);
let trigger_event = match trigger_event {
Some(xcb::Event::X(x::Event::KeyPress(ev))) => match keysym_for_keypress(conn, &ev) {
Err(err) => {
warn!("Failed to get keysym for key press event: {}", err);
Some(xcb::Event::X(x::Event::KeyPress(ev)))
},
Ok(Some(keysym)) if keysym == xkb::key::KP_Enter || keysym == xkb::key::ISO_Enter || keysym == xkb::key::Return || keysym == xkb::key::Escape =>
// don't forward an <enter> or <esc> to the dialog, as that will make it activate/close immediately
None,
_ => Some(xcb::Event::X(x::Event::KeyPress(ev))),
},
te => te,
};
let mut child = Command::new(format!("{}/{}", env!("HELPER_DIR"), state.config.dialog_backend.binary_name())) let mut child = Command::new(format!("{}/{}", env!("HELPER_DIR"), state.config.dialog_backend.binary_name()))
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn()?; .spawn()?;
@ -1012,3 +1028,14 @@ fn kill_child_processes(state: &mut State) -> anyhow::Result<()> {
Ok(()) Ok(())
} }
fn keysym_for_keypress(conn: &xcb::Connection, ev: &x::KeyPressEvent) -> anyhow::Result<Option<xkb::Keysym>> {
let ctx = xkb::Context::new(xkb::context::Flags::NO_FLAGS);
let device = xkb::x11::device(conn)
.map_err(|_| anyhow::anyhow!("Failed to get xkb device"))?;
let keymap = xkb::x11::keymap(conn, device, &ctx, xkb::keymap::compile::Flags::NO_FLAGS)
.map_err(|_| anyhow::anyhow!("Failed to get xkb keymap"))?;
let state = xkb::x11::state(conn, device, &keymap)
.map_err(|_| anyhow::anyhow!("Failed to get xkb state"))?;
Ok(state.key(ev.detail()).sym())
}

View File

@ -12,7 +12,6 @@ bscreensaver-util = { path = "../util" }
futures = "0.3" futures = "0.3"
log = "0.4" log = "0.4"
nix = "0.23" nix = "0.23"
# git source needed until extension event error resolution fix is released xcb = "1"
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e" }
zbus = "2.2" zbus = "2.2"
logind-zbus = "3" logind-zbus = "3"

View File

@ -14,6 +14,6 @@ lazy_static = "1"
libc = "0.2" libc = "0.2"
shell-words = "1" shell-words = "1"
toml = "0.5" toml = "0.5"
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e", features = ["randr", "screensaver", "xfixes"] } xcb = "1"
xdg = "2" xdg = "2"
zbus = "2" zbus = "2"

View File

@ -15,4 +15,4 @@ categories = ["gui"]
[dependencies] [dependencies]
bitflags = "1" bitflags = "1"
log = "0.4" log = "0.4"
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e", features = ["randr", "screensaver", "xfixes"] } xcb = { version = "1", features = ["xfixes"] }