Skip to content

Commit

Permalink
more configure_request debugging
Browse files Browse the repository at this point in the history
We should process configure requests with a size but x,y of 0,0
  • Loading branch information
maxhbooth committed Apr 24, 2024
1 parent ea35254 commit 73ab4b9
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions src/xwayland_xdg_shell/xwayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,21 @@ impl XwmHandler for WprsState {
}
}

// x=0, y=0, w=1, h=1 means the window is asking us for a size.
// TODO: It seems like some toplevel windows are still slipping through this,
// maybe we need to actually figure out what size to set windows somehow?
if geo.loc.x > 0 && geo.loc.y > 0 && geo.size.w > 1 && geo.size.h > 1 {
if window.is_mapped() {
// Under Wayland, windows don't get to resize themselves. Many X apps
// need a synthetic configure reply though. Additionally, some broken
// toolkits (read: Java) will still render the window at the size they
// asked for, even if the request wasn't granted, and also ignore
// ConfigureNotify events where the size equals the current size, so
// trigger a redraw by resizing the window by a small amount and then
// resizing it back to the original size.
let mut hack_geo = geo;
hack_geo.size.w -= 1;

window.configure(hack_geo).unwrap();
window.configure(geo).unwrap();
} else {
window.configure(geo).unwrap();
}
if window.is_mapped() {
// Under Wayland, windows don't get to resize themselves. Many X apps
// need a synthetic configure reply though. Additionally, some broken
// toolkits (read: Java) will still render the window at the size they
// asked for, even if the request wasn't granted, and also ignore
// ConfigureNotify events where the size equals the current size, so
// trigger a redraw by resizing the window by a small amount and then
// resizing it back to the original size.
let mut hack_geo = geo;
hack_geo.size.w -= 1;

window.configure(hack_geo).unwrap();
window.configure(geo).unwrap();
} else {
window.configure(geo).unwrap();
}
}

Expand Down

0 comments on commit 73ab4b9

Please sign in to comment.