Properly init xfixes extension

This commit is contained in:
Brian Tarricone 2022-05-13 19:51:20 -07:00
parent e588988254
commit 64dc809295

View File

@ -26,7 +26,7 @@ use std::{
process::{exit, Child, Command, Stdio},
time::{Duration, Instant},
};
use xcb::{randr, x, xinput, Xid};
use xcb::{randr, x, xfixes, xinput, Xid};
use xcb_xembed::embedder::Embedder;
use bscreensaver_command::{BCommand, create_command_window};
@ -126,6 +126,7 @@ fn main() -> anyhow::Result<()> {
let setup = conn.get_setup();
let screen = setup.roots().nth(screen_num as usize).unwrap();
init_xfixes(&conn)?;
init_xinput(&conn)?;
init_randr(&conn)?;
create_command_window(&conn, &screen)?;
@ -257,6 +258,18 @@ fn init_signals() -> anyhow::Result<SignalFd> {
Ok(fd)
}
fn init_xfixes(conn: &xcb::Connection) -> xcb::Result<()> {
let cookie = conn.send_request(&xfixes::QueryVersion {
client_major_version: 4,
client_minor_version: 0,
});
let reply = conn.wait_for_reply(cookie)?;
if reply.major_version() < 4 {
warn!("XFIXES version 4 or better is not supported by the X server (max supported: {}.{})", reply.major_version(), reply.minor_version());
}
Ok(())
}
fn init_xinput(conn: &xcb::Connection) -> xcb::Result<()> {
let cookie = conn.send_request(&xcb::xinput::XiQueryVersion {
major_version: 2,