update for the sake of clarity

This commit is contained in:
gallant 2023-07-25 13:42:49 -05:00
parent 525e4e2abc
commit 4484143a0f

View file

@ -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();
}