From fec0ec1716af3c1d1cc604b213d2176d6074d28e Mon Sep 17 00:00:00 2001 From: "Ben Scholzen (DASPRiD)" Date: Sat, 15 Jun 2024 03:27:21 +0200 Subject: [PATCH] fix(hid): setup xkb extension before querying keyboard device ID --- src/hid/x11.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/hid/x11.rs b/src/hid/x11.rs index a5bb4dc..415b149 100644 --- a/src/hid/x11.rs +++ b/src/hid/x11.rs @@ -1,6 +1,9 @@ use xkbcommon::xkb::{ self, - x11::{get_core_keyboard_device_id, keymap_new_from_device}, + x11::{ + get_core_keyboard_device_id, keymap_new_from_device, setup_xkb_extension, + SetupXkbExtensionFlags, MIN_MAJOR_XKB_VERSION, MIN_MINOR_XKB_VERSION, + }, }; use super::XkbKeymap; @@ -9,6 +12,17 @@ pub fn get_keymap_x11() -> anyhow::Result { let context = xkb::Context::new(xkb::CONTEXT_NO_FLAGS); let (conn, _) = xcb::Connection::connect(None)?; + setup_xkb_extension( + &conn, + MIN_MAJOR_XKB_VERSION, + MIN_MINOR_XKB_VERSION, + SetupXkbExtensionFlags::NoFlags, + &mut 0, + &mut 0, + &mut 0, + &mut 0, + ); + let device_id = get_core_keyboard_device_id(&conn); if device_id == -1 { return Err(anyhow::anyhow!(