diff --git a/src/xlib/display.rs b/src/xlib/display.rs index c3ce11f..b0f10cc 100644 --- a/src/xlib/display.rs +++ b/src/xlib/display.rs @@ -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 { - let inner = unsafe { xlib::XRootWindow(self.inner, screen) }; + pub fn get_root_window(&self, screen: &Screen) -> Result { + let inner = unsafe { xlib::XRootWindow(self.inner, screen.0) }; if inner == 0 { return Err(Error::GetWindowError); } diff --git a/src/xlib/window.rs b/src/xlib/window.rs index 047d78b..2ae33fb 100644 --- a/src/xlib/window.rs +++ b/src/xlib/window.rs @@ -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(),