1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use glib::translate::*;
use std::fmt;
glib::wrapper! {
#[doc(alias = "GdkKeymapKey")]
pub struct KeymapKey(BoxedInline<ffi::GdkKeymapKey>);
}
impl KeymapKey {
pub fn new(keycode: u32, group: i32, level: i32) -> Self {
assert_initialized_main_thread!();
unsafe {
Self::unsafe_from(ffi::GdkKeymapKey {
group,
keycode,
level,
})
}
}
pub fn keycode(&self) -> u32 {
self.inner.keycode
}
pub fn group(&self) -> i32 {
self.inner.group
}
pub fn level(&self) -> i32 {
self.inner.level
}
}
impl fmt::Debug for KeymapKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("KeymapKey")
.field("keycode", &self.keycode())
.field("group", &self.group())
.field("level", &self.level())
.finish()
}
}