gdk4_x11/
functions.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4#[cfg(feature = "xlib")]
5#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
6use x11::xlib::Atom as XAtom;
7
8pub use crate::auto::functions::*;
9#[cfg(not(feature = "xlib"))]
10use crate::XAtom;
11use crate::{ffi, X11Display};
12
13#[doc(alias = "gdk_x11_get_xatom_by_name_for_display")]
14pub fn x11_get_xatom_by_name_for_display(display: &X11Display, atom_name: impl IntoGStr) -> XAtom {
15    skip_assert_initialized!();
16    unsafe {
17        atom_name.run_with_gstr(|atom_name| {
18            ffi::gdk_x11_get_xatom_by_name_for_display(display.to_glib_none().0, atom_name.as_ptr())
19        })
20    }
21}
22
23#[doc(alias = "gdk_x11_get_xatom_name_for_display")]
24pub fn x11_get_xatom_name_for_display(display: &X11Display, xatom: XAtom) -> Option<glib::GString> {
25    skip_assert_initialized!();
26    unsafe {
27        from_glib_none(ffi::gdk_x11_get_xatom_name_for_display(
28            display.to_glib_none().0,
29            xatom,
30        ))
31    }
32}