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
45
46

use xkb::ffi::{xkb_context, xkb_keymap, xkb_state, xkb_keymap_compile_flags};

use xcb::ffi::xcb_connection_t;
use std::os::raw::{c_int};

pub const XKB_X11_MIN_MAJOR_XKB_VERSION: u16 = 1;
pub const XKB_X11_MIN_MINOR_XKB_VERSION: u16 = 0;


#[repr(C)]
#[allow(non_camel_case_types)]
pub enum xkb_x11_setup_xkb_extension_flags {
    /** Do not apply any flags. */
    NO_FLAGS = 0
}

#[link(name = "xkbcommon-x11")]
extern {

    pub fn xkb_x11_setup_xkb_extension(connection: *mut xcb_connection_t,
                                       major_xkb_version: u16,
                                       minor_xkb_version: u16,
                                       flags: xkb_x11_setup_xkb_extension_flags,
                                       major_xkb_version_out: *mut u16,
                                       minor_xkb_version_out: *mut u16,
                                       base_event_out: *mut u8,
                                       base_error_out: *mut u8) -> c_int;

    pub fn xkb_x11_get_core_keyboard_device_id(connection: *mut xcb_connection_t)
            -> i32;


    pub fn xkb_x11_keymap_new_from_device(context: *mut xkb_context,
                                          connection: *mut xcb_connection_t,
                                          device_id: i32,
                                          flags: xkb_keymap_compile_flags)
            -> *mut xkb_keymap;


    pub fn xkb_x11_state_new_from_device(keymap: *mut xkb_keymap,
                                         connection: *mut xcb_connection_t,
                                         device_id: i32)
            -> *mut xkb_state;

}