Skip to content

Commit

Permalink
libx11.rs cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
eloraiby authored and not-fl3 committed Jun 21, 2024
1 parent dc5b3a3 commit fbadb64
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/native/linux_x11/libx11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,24 +934,6 @@ pub type XConvertSelection = unsafe extern "C" fn(
pub type XSetSelectionOwner =
unsafe extern "C" fn(_: *mut Display, _: Atom, _: Window, _: Time) -> libc::c_int;

pub type XKbKeySymToUtf32 = unsafe extern "C" fn (_: u32) -> u32;

#[derive(Clone)]
pub struct LibXkbCommon {
pub module: std::rc::Rc<module::Module>,
pub xkb_keysym_to_utf32: XKbKeySymToUtf32,
}

impl LibXkbCommon {
pub fn try_load() -> Option<Self> {
crate::native::module::Module::load("libxkbcommon.so")
.or_else(|_| crate::native::module::Module::load("libxkbcommon.so.6"))
.map(|module| LibXkbCommon {
xkb_keysym_to_utf32: module.get_symbol("xkb_keysym_to_utf32").unwrap(),
module: std::rc::Rc::new(module)
}).ok()
}
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct XColor {
Expand Down Expand Up @@ -1151,3 +1133,23 @@ impl LibX11 {
};
}
}

pub type XKbKeySymToUtf32 = unsafe extern "C" fn(_: u32) -> u32;

#[derive(Clone)]
pub struct LibXkbCommon {
pub module: std::rc::Rc<module::Module>,
pub xkb_keysym_to_utf32: XKbKeySymToUtf32,
}

impl LibXkbCommon {
pub fn try_load() -> Option<Self> {
crate::native::module::Module::load("libxkbcommon.so")
.or_else(|_| crate::native::module::Module::load("libxkbcommon.so.6"))
.map(|module| LibXkbCommon {
xkb_keysym_to_utf32: module.get_symbol("xkb_keysym_to_utf32").unwrap(),
module: std::rc::Rc::new(module),
})
.ok()
}
}

0 comments on commit fbadb64

Please sign in to comment.