Merge pull request #73 from mahkoh/jorth/unmapped-subsurface
render: don't warn when rendering an unmapped sub-surface
This commit is contained in:
commit
bc5de5188f
8 changed files with 22 additions and 12 deletions
|
|
@ -63,7 +63,7 @@ async fn run(screenshot: Rc<Screenshot>) {
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.unwrap_or("%Y-%m-%d-%H%M%S_jay.qoi");
|
.unwrap_or("%Y-%m-%d-%H%M%S_jay.qoi");
|
||||||
let filename = Local::now().format(filename).to_string();
|
let filename = Local::now().format(filename).to_string();
|
||||||
if let Err(e) = std::fs::write(&filename, &data) {
|
if let Err(e) = std::fs::write(&filename, data) {
|
||||||
fatal!("Could not write `{}`: {}", filename, ErrorFmt(e));
|
fatal!("Could not write `{}`: {}", filename, ErrorFmt(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -858,7 +858,7 @@ impl MethodHandlerApi for PropertyGetAllHandlerProxy {
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use {
|
pub use {
|
||||||
super::{
|
super::{
|
||||||
types::{Bool, DictEntry, ObjectPath, Signature, Variant},
|
types::{Bool, DictEntry, ObjectPath, Variant},
|
||||||
DbusError, DbusType, Formatter, Message, MethodCall, Parser, Property, Signal,
|
DbusError, DbusType, Formatter, Message, MethodCall, Parser, Property, Signal,
|
||||||
},
|
},
|
||||||
std::{borrow::Cow, rc::Rc},
|
std::{borrow::Cow, rc::Rc},
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ impl Forker {
|
||||||
level: log::Level::Error as _,
|
level: log::Level::Error as _,
|
||||||
msg: format!("The ol' forker panicked: {}", pi),
|
msg: format!("The ol' forker panicked: {}", pi),
|
||||||
};
|
};
|
||||||
let msg = bincode::encode_to_vec(&msg, bincode_ops()).unwrap();
|
let msg = bincode::encode_to_vec(msg, bincode_ops()).unwrap();
|
||||||
let _ = Fd::new(socket).write_all(&msg);
|
let _ = Fd::new(socket).write_all(&msg);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,15 @@ impl Cursor for CursorSurface {
|
||||||
let (hot_x, hot_y) = (Fixed::from_int(hot_x), Fixed::from_int(hot_y));
|
let (hot_x, hot_y) = (Fixed::from_int(hot_x), Fixed::from_int(hot_y));
|
||||||
let x = ((x - hot_x).to_f64() * scale).round() as _;
|
let x = ((x - hot_x).to_f64() * scale).round() as _;
|
||||||
let y = ((y - hot_y).to_f64() * scale).round() as _;
|
let y = ((y - hot_y).to_f64() * scale).round() as _;
|
||||||
renderer.render_surface_scaled(&self.surface, x, y, None, i32::MAX, i32::MAX);
|
renderer.render_surface_scaled(
|
||||||
|
&self.surface,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
None,
|
||||||
|
i32::MAX,
|
||||||
|
i32::MAX,
|
||||||
|
false,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
renderer.render_surface(
|
renderer.render_surface(
|
||||||
&self.surface,
|
&self.surface,
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ impl Renderer<'_> {
|
||||||
max_height: i32,
|
max_height: i32,
|
||||||
) {
|
) {
|
||||||
let (x, y) = self.base.scale_point(x, y);
|
let (x, y) = self.base.scale_point(x, y);
|
||||||
self.render_surface_scaled(surface, x, y, None, max_width, max_height);
|
self.render_surface_scaled(surface, x, y, None, max_width, max_height, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render_surface_scaled(
|
pub fn render_surface_scaled(
|
||||||
|
|
@ -318,12 +318,13 @@ impl Renderer<'_> {
|
||||||
pos_rel: Option<(i32, i32)>,
|
pos_rel: Option<(i32, i32)>,
|
||||||
max_width: i32,
|
max_width: i32,
|
||||||
max_height: i32,
|
max_height: i32,
|
||||||
|
is_subsurface: bool,
|
||||||
) {
|
) {
|
||||||
let children = surface.children.borrow();
|
let children = surface.children.borrow();
|
||||||
let buffer = match surface.buffer.get() {
|
let buffer = match surface.buffer.get() {
|
||||||
Some(b) => b,
|
Some(b) => b,
|
||||||
_ => {
|
_ => {
|
||||||
if !surface.is_cursor() {
|
if !surface.is_cursor() && !is_subsurface {
|
||||||
log::warn!("surface has no buffer attached");
|
log::warn!("surface has no buffer attached");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -354,6 +355,7 @@ impl Renderer<'_> {
|
||||||
Some((pos.x1(), pos.y1())),
|
Some((pos.x1(), pos.y1())),
|
||||||
max_width,
|
max_width,
|
||||||
max_height,
|
max_height,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ fn reopen(fd: c::c_int, need_primary: bool) -> Result<Rc<OwnedFd>, DrmError> {
|
||||||
}
|
}
|
||||||
device_node_name(fd)?
|
device_node_name(fd)?
|
||||||
};
|
};
|
||||||
match uapi::open(&path, c::O_RDWR | c::O_CLOEXEC, 0) {
|
match uapi::open(path, c::O_RDWR | c::O_CLOEXEC, 0) {
|
||||||
Ok(f) => Ok(Rc::new(f)),
|
Ok(f) => Ok(Rc::new(f)),
|
||||||
Err(e) => Err(DrmError::ReopenNode(e.into())),
|
Err(e) => Err(DrmError::ReopenNode(e.into())),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ pub fn get_node_type_from_fd(fd: c::c_int) -> Result<NodeType, OsError> {
|
||||||
|
|
||||||
pub fn node_is_drm(maj: u64, min: u64) -> bool {
|
pub fn node_is_drm(maj: u64, min: u64) -> bool {
|
||||||
let path = device_dir(maj, min);
|
let path = device_dir(maj, min);
|
||||||
uapi::stat(&path).is_ok()
|
uapi::stat(path).is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_minor_type(min: u64) -> Result<NodeType, OsError> {
|
pub fn get_minor_type(min: u64) -> Result<NodeType, OsError> {
|
||||||
|
|
@ -102,7 +102,7 @@ pub fn get_minor_name_from_fd(fd: c::c_int, ty: NodeType) -> Result<Ustring, OsE
|
||||||
let (_, maj, min) = drm_stat(fd)?;
|
let (_, maj, min) = drm_stat(fd)?;
|
||||||
|
|
||||||
let dir = device_dir(maj, min);
|
let dir = device_dir(maj, min);
|
||||||
let mut dir = uapi::opendir(&dir)?;
|
let mut dir = uapi::opendir(dir)?;
|
||||||
|
|
||||||
while let Some(entry) = uapi::readdir(&mut dir) {
|
while let Some(entry) = uapi::readdir(&mut dir) {
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
|
|
@ -138,7 +138,7 @@ pub fn get_device_name_from_fd2(fd: c::c_int) -> Result<Ustring, OsError> {
|
||||||
let (_, maj, min) = drm_stat(fd)?;
|
let (_, maj, min) = drm_stat(fd)?;
|
||||||
let path = uapi::format_ustr!("/sys/dev/char/{maj}:{min}/uevent");
|
let path = uapi::format_ustr!("/sys/dev/char/{maj}:{min}/uevent");
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
let mut br = BufReader::new(uapi::open(&path, c::O_RDONLY, 0)?);
|
let mut br = BufReader::new(uapi::open(path, c::O_RDONLY, 0)?);
|
||||||
loop {
|
loop {
|
||||||
buf.clear();
|
buf.clear();
|
||||||
if br.read_until(b'\n', &mut buf)? == 0 {
|
if br.read_until(b'\n', &mut buf)? == 0 {
|
||||||
|
|
@ -155,7 +155,7 @@ pub fn get_nodes(fd: c::c_int) -> Result<AHashMap<NodeType, CString>, OsError> {
|
||||||
let (_, maj, min) = drm_stat(fd)?;
|
let (_, maj, min) = drm_stat(fd)?;
|
||||||
|
|
||||||
let dir = device_dir(maj, min);
|
let dir = device_dir(maj, min);
|
||||||
let mut dir = uapi::opendir(&dir)?;
|
let mut dir = uapi::opendir(dir)?;
|
||||||
|
|
||||||
let mut res = AHashMap::new();
|
let mut res = AHashMap::new();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ impl XAuthority {
|
||||||
return Err(XconError::HomeNotSet);
|
return Err(XconError::HomeNotSet);
|
||||||
};
|
};
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
if let Err(e) = File::open(&path).and_then(|mut f| f.read_to_end(&mut buf)) {
|
if let Err(e) = File::open(path).and_then(|mut f| f.read_to_end(&mut buf)) {
|
||||||
return Err(XconError::ReadXAuthority(e));
|
return Err(XconError::ReadXAuthority(e));
|
||||||
}
|
}
|
||||||
Parser::parse(&buf)
|
Parser::parse(&buf)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue