Properly init xfixes extension
This commit is contained in:
parent
e588988254
commit
64dc809295
@ -26,7 +26,7 @@ use std::{
|
|||||||
process::{exit, Child, Command, Stdio},
|
process::{exit, Child, Command, Stdio},
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
use xcb::{randr, x, xinput, Xid};
|
use xcb::{randr, x, xfixes, xinput, Xid};
|
||||||
use xcb_xembed::embedder::Embedder;
|
use xcb_xembed::embedder::Embedder;
|
||||||
|
|
||||||
use bscreensaver_command::{BCommand, create_command_window};
|
use bscreensaver_command::{BCommand, create_command_window};
|
||||||
@ -126,6 +126,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
let setup = conn.get_setup();
|
let setup = conn.get_setup();
|
||||||
let screen = setup.roots().nth(screen_num as usize).unwrap();
|
let screen = setup.roots().nth(screen_num as usize).unwrap();
|
||||||
|
|
||||||
|
init_xfixes(&conn)?;
|
||||||
init_xinput(&conn)?;
|
init_xinput(&conn)?;
|
||||||
init_randr(&conn)?;
|
init_randr(&conn)?;
|
||||||
create_command_window(&conn, &screen)?;
|
create_command_window(&conn, &screen)?;
|
||||||
@ -257,6 +258,18 @@ fn init_signals() -> anyhow::Result<SignalFd> {
|
|||||||
Ok(fd)
|
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<()> {
|
fn init_xinput(conn: &xcb::Connection) -> xcb::Result<()> {
|
||||||
let cookie = conn.send_request(&xcb::xinput::XiQueryVersion {
|
let cookie = conn.send_request(&xcb::xinput::XiQueryVersion {
|
||||||
major_version: 2,
|
major_version: 2,
|
||||||
|
Loading…
Reference in New Issue
Block a user