This commit is contained in:
Michael Zhang 2023-08-20 05:07:29 -05:00
parent 97ceb1062d
commit 5387a0f543
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
2 changed files with 6 additions and 5 deletions

View file

@ -92,8 +92,8 @@ impl Display {
}
/// Gets the default visual
pub fn default_visual(&self, screen: i32) -> Visual {
let visual = unsafe { xlib::XDefaultVisual(self.inner, screen) };
pub fn default_visual(&self, screen: &Screen) -> Visual {
let visual = unsafe { xlib::XDefaultVisual(self.inner, screen.0) };
Visual { inner: visual }
}
@ -104,8 +104,8 @@ impl Display {
}
/// Returns the root window for the given screen.
pub fn get_root_window(&self, screen: i32) -> Result<Window> {
let inner = unsafe { xlib::XRootWindow(self.inner, screen) };
pub fn get_root_window(&self, screen: &Screen) -> Result<Window> {
let inner = unsafe { xlib::XRootWindow(self.inner, screen.0) };
if inner == 0 {
return Err(Error::GetWindowError);
}

View file

@ -29,7 +29,8 @@ impl<'a> Window<'a> {
Some(parent) => parent,
None => display.get_default_root_window()?,
};
let visual = display.default_visual(0);
let screen = display.get_default_screen()?;
let visual = display.default_visual(&screen);
let window = unsafe {
xlib::XCreateWindow(
display.as_raw(),