XDefaultScreen
This commit is contained in:
parent
42afef8041
commit
97ceb1062d
3 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,7 @@ use crate::ffi;
|
||||||
|
|
||||||
use super::cursor::Cursor;
|
use super::cursor::Cursor;
|
||||||
use super::event::Event;
|
use super::event::Event;
|
||||||
|
use super::screen::Screen;
|
||||||
use super::visual::Visual;
|
use super::visual::Visual;
|
||||||
use super::window::Window;
|
use super::window::Window;
|
||||||
|
|
||||||
|
@ -96,6 +97,12 @@ impl Display {
|
||||||
Visual { inner: visual }
|
Visual { inner: visual }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the default screen using `XDefaultScreen`
|
||||||
|
pub fn get_default_screen(&self) -> Result<Screen> {
|
||||||
|
let screen = unsafe { xlib::XDefaultScreen(self.inner) };
|
||||||
|
Ok(Screen(screen))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the root window for the given screen.
|
/// Returns the root window for the given screen.
|
||||||
pub fn get_root_window(&self, screen: i32) -> Result<Window> {
|
pub fn get_root_window(&self, screen: i32) -> Result<Window> {
|
||||||
let inner = unsafe { xlib::XRootWindow(self.inner, screen) };
|
let inner = unsafe { xlib::XRootWindow(self.inner, screen) };
|
||||||
|
|
|
@ -8,6 +8,7 @@ mod drawable;
|
||||||
mod event;
|
mod event;
|
||||||
mod image;
|
mod image;
|
||||||
mod pixmap;
|
mod pixmap;
|
||||||
|
mod screen;
|
||||||
mod visual;
|
mod visual;
|
||||||
mod window;
|
mod window;
|
||||||
|
|
||||||
|
|
1
src/xlib/screen.rs
Normal file
1
src/xlib/screen.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pub struct Screen(pub(super) i32);
|
Loading…
Reference in a new issue