Skip to main content

gdk/
keymap_key.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use std::fmt;
4
5glib::wrapper! {
6    /// A [`KeymapKey`][crate::KeymapKey] is a hardware key that can be mapped to a keyval.
7    #[doc(alias = "GdkKeymapKey")]
8    pub struct KeymapKey(BoxedInline<ffi::GdkKeymapKey>);
9}
10
11impl KeymapKey {
12    pub fn keycode(&self) -> u32 {
13        self.inner.keycode
14    }
15    pub fn group(&self) -> i32 {
16        self.inner.group
17    }
18    pub fn level(&self) -> i32 {
19        self.inner.level
20    }
21}
22
23impl fmt::Debug for KeymapKey {
24    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25        f.debug_struct("Geometry")
26            .field("keycode", &self.keycode())
27            .field("group", &self.group())
28            .field("level", &self.level())
29            .finish()
30    }
31}