1
0
Fork 0
forked from wry/wry

xwayland: persist additional properties

This commit is contained in:
Julian Orth 2026-03-07 12:12:04 +01:00
parent da01d7e0d3
commit 4278160113
3 changed files with 12 additions and 2 deletions

View file

@ -290,6 +290,8 @@ fn start_compositor2(
use_wire_scale: Default::default(), use_wire_scale: Default::default(),
wire_scale: Default::default(), wire_scale: Default::default(),
windows: Default::default(), windows: Default::default(),
client: Default::default(),
display: Default::default(),
}, },
acceptor: Default::default(), acceptor: Default::default(),
serial: Default::default(), serial: Default::default(),

View file

@ -320,6 +320,8 @@ pub struct XWaylandState {
pub use_wire_scale: Cell<bool>, pub use_wire_scale: Cell<bool>,
pub wire_scale: Cell<Option<i32>>, pub wire_scale: Cell<Option<i32>>,
pub windows: CopyHashMap<XwindowId, Rc<Xwindow>>, pub windows: CopyHashMap<XwindowId, Rc<Xwindow>>,
pub client: CloneCell<Option<Rc<Client>>>,
pub display: CloneCell<Option<Rc<String>>>,
} }
pub struct IdleState { pub struct IdleState {

View file

@ -114,9 +114,13 @@ pub async fn manage(state: Rc<State>) {
log::error!("Could not listen on the Xwayland socket: {}", ErrorFmt(e)); log::error!("Could not listen on the Xwayland socket: {}", ErrorFmt(e));
return; return;
} }
let display = format!(":{}", xsocket.id); let display = Rc::new(format!(":{}", xsocket.id));
forker.setenv(DISPLAY.as_bytes(), display.as_bytes()); forker.setenv(DISPLAY.as_bytes(), display.as_bytes());
let _unsetenv = on_drop(|| forker.unsetenv(DISPLAY.as_bytes())); state.xwayland.display.set(Some(display.clone()));
let _unsetenv = on_drop(|| {
forker.unsetenv(DISPLAY.as_bytes());
state.xwayland.display.take();
});
log::info!("Allocated display :{} for Xwayland", xsocket.id); log::info!("Allocated display :{} for Xwayland", xsocket.id);
log::info!("Waiting for connection attempt"); log::info!("Waiting for connection attempt");
if state.backend.get().import_environment() { if state.backend.get().import_environment() {
@ -207,8 +211,10 @@ async fn run(
state.ring.readable(&Rc::new(dfdread)).await?; state.ring.readable(&Rc::new(dfdread)).await?;
state.xwayland.queue.clear(); state.xwayland.queue.clear();
state.xwayland.pidfd.set(Some(pidfd.clone())); state.xwayland.pidfd.set(Some(pidfd.clone()));
state.xwayland.client.set(Some(client.clone()));
let _remove_pidfd = on_drop(|| { let _remove_pidfd = on_drop(|| {
state.xwayland.pidfd.take(); state.xwayland.pidfd.take();
state.xwayland.client.take();
}); });
{ {
let shared = Rc::new(XwmShared::default()); let shared = Rc::new(XwmShared::default());