Skip to main content

gdk/
screen.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::Screen;
4use glib::translate::*;
5
6impl Screen {
7    /// Gets any options previously set with [`set_font_options()`][Self::set_font_options()].
8    ///
9    /// # Returns
10    ///
11    /// the current font options, or [`None`] if no
12    ///  default font options have been set.
13    #[doc(alias = "gdk_screen_get_font_options")]
14    #[doc(alias = "get_font_options")]
15    pub fn font_options(&self) -> Option<cairo::FontOptions> {
16        unsafe {
17            from_glib_none(mut_override(ffi::gdk_screen_get_font_options(
18                self.to_glib_none().0,
19            )))
20        }
21    }
22
23    #[doc(alias = "gdk_screen_get_setting")]
24    #[doc(alias = "get_setting")]
25    pub fn setting(&self, name: &str) -> Option<glib::Value> {
26        unsafe {
27            let mut value = glib::Value::uninitialized();
28            let done: bool = from_glib(ffi::gdk_screen_get_setting(
29                self.to_glib_none().0,
30                name.to_glib_none().0,
31                value.to_glib_none_mut().0,
32            ));
33
34            if done {
35                Some(value)
36            } else {
37                None
38            }
39        }
40    }
41}