gdk4_x11/x11_surface.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::Window as XWindow;
7
8#[cfg(not(feature = "xlib"))]
9use crate::XWindow;
10use crate::{ffi, X11Surface};
11
12impl X11Surface {
13 #[doc(alias = "gdk_x11_surface_get_xid")]
14 #[doc(alias = "get_xid")]
15 pub fn xid(&self) -> XWindow {
16 unsafe { ffi::gdk_x11_surface_get_xid(self.to_glib_none().0) }
17 }
18
19 #[doc(alias = "gdk_x11_surface_lookup_for_display")]
20 pub fn lookup_for_display(display: &crate::X11Display, window: XWindow) -> Option<X11Surface> {
21 skip_assert_initialized!();
22 unsafe {
23 from_glib_none(ffi::gdk_x11_surface_lookup_for_display(
24 display.to_glib_none().0,
25 window,
26 ))
27 }
28 }
29}