You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was very excited to find this project but alas it's too early for me to use! That's OK though: I'm willing to help but I'm just getting started with Tokio so I need a gentle shove in the right direction. How would I go about implementing the various 'query_version' functions present in the various X11 extensions?
For reference, here's how I'm currently doing it with the xcb crate:
if let Ok((conn, screen_num)) = xcb::Connection::connect(None) {
let conn = Arc::new(conn);
let cloned_conn = conn.clone();
let setup = conn.get_setup();
let screen = setup.roots().nth(screen_num as usize).unwrap();
let root = screen.root();
let fd: i32;
unsafe {
fd = xcb::ffi::base::xcb_get_file_descriptor(conn.get_raw_conn());
}
println!(
"Connected to X on screen \"{}\" (XCB Socket FD: {:?})",
screen_num,
fd
);
println!("");
println!("Informations of screen {}:", screen.root());
println!(" width..........: {}", screen.width_in_pixels());
println!(" height.........: {}", screen.height_in_pixels());
let _first_ev = match conn.get_extension_data(shm::id()) {
Some(r) => r.first_event(),
None => {
panic!("XKB extension not supported by X server!");
}
};
{
let cookie = shm::query_version(&conn);
if let Ok(reply) = cookie.get_reply() {
println!(
"SHM Version: {}.{}",
reply.major_version(),
reply.minor_version()
);
} else {
panic!("SHM extension not installed");
}
}
// The DAMAGE extension doesn't seem to work right unless you query the version before start watching for damage:
let damage_event = match conn.get_extension_data(damage::id()) {
Some(r) => r.first_event(),
None => {
panic!("DAMAGE extension not supported by X server!");
}
};
println!("Damage Event ID: {:?}", damage_event); // Was 91 when I tested it
{
let cookie = damage::query_version(&conn, damage::MAJOR_VERSION, damage::MINOR_VERSION);
if let Ok(reply) = cookie.get_reply() {
println!(
"DAMAGE Version: {}.{}",
reply.major_version(),
reply.minor_version()
);
} else {
panic!("DAMAGE extension not installed");
}
}
damage_id = conn.generate_id();
let report_level = damage::REPORT_LEVEL_RAW_RECTANGLES as u8; // Only report level that actually works!
let _ = damage::create(&conn, damage_id, root, report_level); // Watch for damage on the root window
let width = screen.width_in_pixels();
let height = screen.height_in_pixels();
// Setup our shared memory segment
let image_size = width as u32 * height as u32 * 4;
let seg = XCBSHMSegment::new(&conn, image_size as usize).unwrap();
}
Note: That's just a snippet of code (obviously).
I need to be able to query the versions of those extensions in order for the X11 server to start letting me do things with them (well, the DAMAGE extension works that way).
I'll also need to be able to automatically call functions/do things when DAMAGE events are detected (so I can take screenshots) but I'll settle for just querying the versions for now... Because I can probably implement those things for you (though maybe not we'll see).
Writing an XCB lib is usually more tedious than mental (I've done it before, haha) so even though I'm new to Rust I can still help out. Here's to hoping...
Can you give an example or point me in the right direction? Thanks!
The text was updated successfully, but these errors were encountered:
I was very excited to find this project but alas it's too early for me to use! That's OK though: I'm willing to help but I'm just getting started with Tokio so I need a gentle shove in the right direction. How would I go about implementing the various 'query_version' functions present in the various X11 extensions?
For reference, here's how I'm currently doing it with the
xcb
crate:Note: That's just a snippet of code (obviously).
I need to be able to query the versions of those extensions in order for the X11 server to start letting me do things with them (well, the DAMAGE extension works that way).
I'll also need to be able to automatically call functions/do things when DAMAGE events are detected (so I can take screenshots) but I'll settle for just querying the versions for now... Because I can probably implement those things for you (though maybe not we'll see).
Writing an XCB lib is usually more tedious than mental (I've done it before, haha) so even though I'm new to Rust I can still help out. Here's to hoping...
Can you give an example or point me in the right direction? Thanks!
The text was updated successfully, but these errors were encountered: