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