Support WM_CLASS missing instance and null
Done by AvaloniaILSpy, for some reason
This commit is contained in:
parent
2444c2f07b
commit
02bee5aea7
2 changed files with 15 additions and 7 deletions
|
|
@ -449,11 +449,19 @@ impl XState {
|
|||
let cookie = self.get_property_cookie(window, x::ATOM_WM_CLASS, x::ATOM_STRING, 256);
|
||||
let resolver = move |reply: x::GetPropertyReply| {
|
||||
let data: &[u8] = reply.value();
|
||||
// wm class is instance + class - ignore instance
|
||||
let class_start = data.iter().copied().position(|b| b == 0u8).unwrap() + 1;
|
||||
let data = data[class_start..].to_vec();
|
||||
trace!("wm class data: {data:?}");
|
||||
// wm class (normally) is instance + class - ignore instance
|
||||
let class_start = if let Some(p) = data.iter().copied().position(|b| b == 0u8) {
|
||||
p + 1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let mut data = data[class_start..].to_vec();
|
||||
if data.last().copied().unwrap() != 0 {
|
||||
data.push(0);
|
||||
}
|
||||
let class = CString::from_vec_with_nul(data).unwrap();
|
||||
debug!("{:?} class: {class:?}", window);
|
||||
trace!("{:?} class: {class:?}", window);
|
||||
class.to_string_lossy().to_string()
|
||||
};
|
||||
PropertyCookieWrapper {
|
||||
|
|
@ -506,7 +514,7 @@ impl XState {
|
|||
let resolver = |reply: x::GetPropertyReply| {
|
||||
let data: &[u32] = reply.value();
|
||||
let hints = WmHints::from(data);
|
||||
debug!("wm hints: {hints:?}");
|
||||
trace!("wm hints: {hints:?}");
|
||||
hints
|
||||
};
|
||||
PropertyCookieWrapper {
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ fn toplevel_flow() {
|
|||
window,
|
||||
x::ATOM_STRING,
|
||||
x::ATOM_WM_CLASS,
|
||||
&[c"f".to_bytes_with_nul(), c"ssalc".to_bytes_with_nul()].concat(),
|
||||
&[c"boink".to_bytes()].concat(),
|
||||
);
|
||||
connection.set_property(
|
||||
window,
|
||||
|
|
@ -415,7 +415,7 @@ fn toplevel_flow() {
|
|||
let data = f.testwl.get_surface_data(surface).unwrap();
|
||||
let toplevel = data.toplevel().toplevel.clone();
|
||||
assert_eq!(data.toplevel().title, Some("bindow".into()));
|
||||
assert_eq!(data.toplevel().app_id, Some("ssalc".into()));
|
||||
assert_eq!(data.toplevel().app_id, Some("boink".into()));
|
||||
assert_eq!(
|
||||
data.toplevel().min_size,
|
||||
Some(testwl::Vec2 { x: 25, y: 50 })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue