1
0
Fork 0
forked from wry/wry

autocommit 2022-01-07 15:08:31 CET

This commit is contained in:
Julian Orth 2022-01-07 15:08:31 +01:00
parent 4a939477a2
commit f8e7557d1d
18 changed files with 1258 additions and 35 deletions

View file

@ -53,8 +53,10 @@ extern "C" {
keymap: *mut xkb_keymap,
format: xkb_keymap_format,
) -> *mut c::c_char;
fn xkb_keymap_ref(keymap: *mut xkb_keymap) -> *mut xkb_keymap;
fn xkb_keymap_unref(keymap: *mut xkb_keymap);
fn xkb_state_unref(state: *mut xkb_state);
fn xkb_state_get_keymap(state: *mut xkb_state) -> *mut xkb_keymap;
}
pub struct XkbContext {
@ -129,6 +131,18 @@ pub struct XkbState {
state: *mut xkb_state,
}
impl XkbState {
pub fn keymap(&self) -> XkbKeymap {
unsafe {
let res = xkb_state_get_keymap(self.state);
xkb_keymap_ref(res);
XkbKeymap {
keymap: res,
}
}
}
}
impl Drop for XkbState {
fn drop(&mut self) {
unsafe {