Do xrandr version check on init
This commit is contained in:
parent
64dc809295
commit
cab7d4bfe5
@ -309,7 +309,16 @@ fn init_xinput(conn: &xcb::Connection) -> xcb::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_randr(conn: &xcb::Connection) -> xcb::Result<()> {
|
fn init_randr(conn: &xcb::Connection) -> anyhow::Result<()> {
|
||||||
|
let cookie = conn.send_request(&randr::QueryVersion {
|
||||||
|
major_version: 1,
|
||||||
|
minor_version: 2,
|
||||||
|
});
|
||||||
|
let reply = conn.wait_for_reply(cookie)?;
|
||||||
|
if reply.major_version() < 1 || (reply.major_version() == 1 && reply.minor_version() < 2) {
|
||||||
|
Err(anyhow::anyhow!("XRandR extension version 1.2 or greater is required, but the X server only supports {}.{}", reply.major_version(), reply.minor_version()))?;
|
||||||
|
}
|
||||||
|
|
||||||
for screen in conn.get_setup().roots() {
|
for screen in conn.get_setup().roots() {
|
||||||
conn.send_and_check_request(&randr::SelectInput {
|
conn.send_and_check_request(&randr::SelectInput {
|
||||||
window: screen.root(),
|
window: screen.root(),
|
||||||
|
Loading…
Reference in New Issue
Block a user