add `KeyboardState`

Junkui Zhang created

Change summary

crates/gpui/src/platform/linux/platform.rs | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Detailed changes

crates/gpui/src/platform/linux/platform.rs 🔗

@@ -29,6 +29,9 @@ use crate::{
     Point, Result, Task, WindowAppearance, WindowParams, px,
 };
 
+#[cfg(any(feature = "wayland", feature = "x11"))]
+use super::LinuxKeyboardMapper;
+
 #[cfg(any(feature = "wayland", feature = "x11"))]
 pub(crate) const SCROLL_LINES: f32 = 3.0;
 
@@ -706,6 +709,20 @@ pub(super) fn log_cursor_icon_warning(message: impl std::fmt::Display) {
     }
 }
 
+#[cfg(any(feature = "wayland", feature = "x11"))]
+struct KeyboardState {
+    state: xkb::State,
+    mapper: LinuxKeyboardMapper,
+}
+
+#[cfg(any(feature = "wayland", feature = "x11"))]
+impl KeyboardState {
+    fn new(state: xkb::State) -> Self {
+        let mapper = LinuxKeyboardMapper::new(&state);
+        Self { state, mapper }
+    }
+}
+
 #[cfg(any(feature = "wayland", feature = "x11"))]
 impl crate::Keystroke {
     pub(super) fn from_xkb(