From 4484143a0ffe1877d80890d74f541821719e85af Mon Sep 17 00:00:00 2001 From: gallant Date: Tue, 25 Jul 2023 13:42:49 -0500 Subject: [PATCH] update for the sake of clarity --- src/main.rs | 61 ++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0bfadac..0c9d6ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,6 @@ use x11rb::connection::Connection; use x11rb::protocol::xproto::ConnectionExt; use x11rb::protocol::xproto::CreateGCAux; -use std::time; - use std::collections::VecDeque; fn main() { @@ -16,11 +14,11 @@ fn main() { let root = screen.root; //grabs the root ID of screen let depth = screen.root_depth; //grabs depth of root window - let pixmap = conn.generate_id().unwrap(); //generates an ID to use for pixel data presumably - conn.create_pixmap(depth, pixmap, root, 1920, 1080).unwrap(); //makes a space for pixel data on - //root depth with pixmap ID at - //400x400 space, need to make - //larger + //let pixmap = conn.generate_id().unwrap(); //generates an ID to use for pixel data presumably + //conn.create_pixmap(depth, pixmap, root, 1920, 1080).unwrap(); //makes a space for pixel data on + //root depth with pixmap ID at + //400x400 space, need to make + //larger let gc = conn.generate_id().unwrap(); //generates another ID for Graphics Context let gc_aux = CreateGCAux::new().foreground(screen.white_pixel); // create aux for connecting the @@ -40,39 +38,36 @@ fn main() { } //Putting gif frames into a vector conn.flush().unwrap(); - let mut instant = time::Instant::now(); loop { - if instant.elapsed().as_millis() >= 0 { - let popd = &v_frames.pop_front().unwrap(); - let buffer = &popd.buffer; + let popd = &v_frames.pop_front().unwrap(); - let put = conn - .put_image( - x11rb::protocol::xproto::ImageFormat::Z_PIXMAP, - root, - gc, - 1920, - 1080, - 0, - 0, - 0, - depth, - &buffer, - ) - .unwrap(); - put.check().unwrap(); + let put = conn + .put_image( + x11rb::protocol::xproto::ImageFormat::Z_PIXMAP, + root, + gc, + 1920, + 1080, + 0, + 0, + 0, + depth, + &popd.buffer, + ) + .unwrap(); - let copy = conn.copy_area(pixmap, root, gc, 0, 0, 0, 0, 1920, 1080) - .unwrap(); - copy.check().unwrap(); + // let copy = conn + // .copy_area(pixmap, root, gc, 0, 0, 0, 0, 1920, 1080) + // .unwrap(); - v_frames.push_back(popd.clone()); - instant = time::Instant::now(); - } + v_frames.push_back(popd.clone()); + + put.check().unwrap(); + //copy.check().unwrap(); } conn.flush().unwrap(); // unreachable but whatever - conn.free_pixmap(pixmap).unwrap(); + //conn.free_pixmap(pixmap).unwrap(); conn.free_gc(gc).unwrap(); }