1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::X11Screen;
#[cfg(not(feature = "xlib"))]
use crate::XID;
use glib::translate::*;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::{self, XID};

impl X11Screen {
    /// Returns the screen of a [`X11Screen`][crate::X11Screen].
    ///
    /// # Returns
    ///
    /// an Xlib Screen*
    #[cfg(feature = "xlib")]
    #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
    #[doc(alias = "gdk_x11_screen_get_xscreen")]
    #[doc(alias = "get_xscreen")]
    pub unsafe fn xscreen(&self) -> *mut xlib::Screen {
        ffi::gdk_x11_screen_get_xscreen(self.to_glib_none().0) as *mut xlib::Screen
    }

    /// Gets the XID of the specified output/monitor.
    /// If the X server does not support version 1.2 of the RANDR
    /// extension, 0 is returned.
    /// ## `monitor_num`
    /// number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
    ///
    /// # Returns
    ///
    /// the XID of the monitor
    #[doc(alias = "gdk_x11_screen_get_monitor_output")]
    #[doc(alias = "get_monitor_output")]
    pub fn monitor_output(&self, monitor_num: i32) -> XID {
        unsafe { ffi::gdk_x11_screen_get_monitor_output(self.to_glib_none().0, monitor_num) }
    }
}