diff --git a/locker/src/main.rs b/locker/src/main.rs index 237ae1a..626d09a 100644 --- a/locker/src/main.rs +++ b/locker/src/main.rs @@ -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 { 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,