From 28eea9b40e2fe9a222d386a0372eb0a8eaaafdfe Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Sun, 22 Dec 2019 14:15:31 +0100 Subject: [PATCH] Box reference to shared memory --- fractional/src/xcb.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fractional/src/xcb.rs b/fractional/src/xcb.rs index 69d960d..6c6f63f 100644 --- a/fractional/src/xcb.rs +++ b/fractional/src/xcb.rs @@ -36,7 +36,7 @@ pub struct XcbCanvas<'a> { conn :Arc , window :u32 , pixmap :u32 , gc :u32 - , shm :&'a mut [u32] } + , shm :Box<&'a mut [u32]> } impl XcbEasel { pub fn new() -> Result { @@ -55,7 +55,7 @@ impl XcbEasel { self.setup().roots().nth(*num as usize) } - pub fn canvas(&self, width :u16, height :u16) -> Option { + pub fn canvas<'a>(&self, width :u16, height :u16) -> Option> { let Self(conn, _) = self; let conn = conn.clone(); let screen = match self.screen() { @@ -63,6 +63,8 @@ impl XcbEasel { Some(screen) => screen, }; + println!("root depth: {}", screen.root_depth()); + let shmseg = conn.generate_id(); let gc = conn.generate_id(); let pixmap = conn.generate_id(); @@ -94,7 +96,7 @@ impl XcbEasel { , window: window , pixmap: pixmap , gc: gc - , shm: shm } ) + , shm: Box::new(shm) } ) } }