gdk4_x11/x11_screen.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::{self, XID};
7
8#[cfg(not(feature = "xlib"))]
9use crate::XID;
10use crate::{ffi, X11Screen};
11
12impl X11Screen {
13 /// Returns the screen of a [`X11Screen`][crate::X11Screen].
14 ///
15 /// # Deprecated since 4.18
16 ///
17 ///
18 /// # Returns
19 ///
20 /// an Xlib Screen*
21 #[cfg(feature = "xlib")]
22 #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
23 #[doc(alias = "gdk_x11_screen_get_xscreen")]
24 #[doc(alias = "get_xscreen")]
25 #[allow(clippy::missing_safety_doc)]
26 pub unsafe fn xscreen(&self) -> *mut xlib::Screen {
27 ffi::gdk_x11_screen_get_xscreen(self.to_glib_none().0) as *mut xlib::Screen
28 }
29
30 /// Gets the XID of the specified output/monitor.
31 /// If the X server does not support version 1.2 of the RANDR
32 /// extension, 0 is returned.
33 ///
34 /// # Deprecated since 4.18
35 ///
36 /// ## `monitor_num`
37 /// number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
38 ///
39 /// # Returns
40 ///
41 /// the XID of the monitor
42 #[doc(alias = "gdk_x11_screen_get_monitor_output")]
43 #[doc(alias = "get_monitor_output")]
44 pub fn monitor_output(&self, monitor_num: i32) -> XID {
45 unsafe { ffi::gdk_x11_screen_get_monitor_output(self.to_glib_none().0, monitor_num) }
46 }
47}