gdkx11/auto/x11_keymap.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use glib::translate::*;
6use std::fmt;
7
8glib::wrapper! {
9 ///
10 ///
11 /// # Implements
12 ///
13 /// [`trait@gdk::prelude::KeymapExt`]
14 #[doc(alias = "GdkX11Keymap")]
15 pub struct X11Keymap(Object<ffi::GdkX11Keymap, ffi::GdkX11KeymapClass>) @extends gdk::Keymap;
16
17 match fn {
18 type_ => || ffi::gdk_x11_keymap_get_type(),
19 }
20}
21
22impl X11Keymap {
23 /// Extracts the group from the state field sent in an X Key event.
24 /// This is only needed for code processing raw X events, since `GdkEventKey`
25 /// directly includes an is_modifier field.
26 /// ## `state`
27 /// raw state returned from X
28 ///
29 /// # Returns
30 ///
31 /// the index of the active keyboard group for the event
32 #[doc(alias = "gdk_x11_keymap_get_group_for_state")]
33 #[doc(alias = "get_group_for_state")]
34 pub fn group_for_state(&self, state: u32) -> i32 {
35 unsafe { ffi::gdk_x11_keymap_get_group_for_state(self.to_glib_none().0, state) }
36 }
37
38 /// Determines whether a particular key code represents a key that
39 /// is a modifier. That is, it’s a key that normally just affects
40 /// the keyboard state and the behavior of other keys rather than
41 /// producing a direct effect itself. This is only needed for code
42 /// processing raw X events, since `GdkEventKey` directly includes
43 /// an is_modifier field.
44 /// ## `keycode`
45 /// the hardware keycode from a key event
46 ///
47 /// # Returns
48 ///
49 /// [`true`] if the hardware keycode is a modifier key
50 #[doc(alias = "gdk_x11_keymap_key_is_modifier")]
51 pub fn key_is_modifier(&self, keycode: u32) -> bool {
52 unsafe {
53 from_glib(ffi::gdk_x11_keymap_key_is_modifier(
54 self.to_glib_none().0,
55 keycode,
56 ))
57 }
58 }
59}
60
61impl fmt::Display for X11Keymap {
62 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
63 f.write_str("X11Keymap")
64 }
65}