gdk4_macos/
macos_surface.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3#[cfg(feature = "v4_8")]
4use crate::ffi;
5#[cfg(not(feature = "v4_8"))]
6use crate::prelude::*;
7use crate::{id, MacosSurface};
8#[cfg(feature = "v4_8")]
9use glib::translate::*;
10#[cfg(not(feature = "v4_8"))]
11use std::ffi::c_void;
12
13impl MacosSurface {
14    #[doc(alias = "gdk_macos_surface_get_native_window")]
15    #[doc(alias = "get_native_window")]
16    pub fn native(&self) -> id {
17        #[cfg(feature = "v4_8")]
18        unsafe {
19            let native_window_ptr = ffi::gdk_macos_surface_get_native_window(self.to_glib_none().0);
20            native_window_ptr as id
21        }
22
23        #[cfg(not(feature = "v4_8"))]
24        {
25            let native_window_ptr: *mut c_void = ObjectExt::property(self, "native");
26            native_window_ptr as id
27        }
28    }
29}