1
0
Fork 0
forked from wry/wry

autocommit 2022-03-11 19:24:53 CET

This commit is contained in:
Julian Orth 2022-03-11 19:24:53 +01:00
parent b1890894b2
commit 0ae73ab9c4
9 changed files with 277 additions and 66 deletions

View file

@ -11,6 +11,7 @@ use bstr::ByteSlice;
use std::cell::Cell;
use std::rc::Rc;
use uapi::{c, OwnedFd};
use crate::utils::nonblock::set_nonblock;
const DRM: &[u8] = b"drm";
const INPUT: &[u8] = b"input";
@ -191,12 +192,13 @@ impl MetalBackend {
return;
}
};
if res.inactive == TRUE {
if let Err(e) = set_nonblock(res.fd.raw()) {
log::error!("Could set drm fd to non-blocking: {}", ErrorFmt(e));
return;
}
let master = Rc::new(DrmMaster::new(res.fd.clone()));
let dev = match slf.creat_drm_device(dev, &master) {
Ok(d) => Rc::new(d),
Ok(d) => d,
Err(e) => {
log::error!("Could not initialize drm device: {}", ErrorFmt(e));
return;
@ -300,6 +302,10 @@ impl MetalBackend {
if res.inactive == TRUE {
return;
}
if let Err(e) = set_nonblock(res.fd.raw()) {
log::error!("Could set input fd to non-blocking: {}", ErrorFmt(e));
return;
}
dev.fd.set(Some(res.fd.clone()));
let inputdev = match slf.libinput.open(dev.devnode.as_c_str()) {
Ok(d) => d,