xwayland: Fix display env variable race
This commit is contained in:
parent
7704f65d02
commit
4940d0823d
6 changed files with 16 additions and 10 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -3274,7 +3274,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/pop-os/smithay?rev=05f5db5beb#05f5db5beb4932ff48692c9ec4f466363e19e957"
|
||||
source = "git+https://github.com/pop-os/smithay?rev=b231c3dd2a#b231c3dd2a2602539e8042e5f8db212a0adcee24"
|
||||
dependencies = [
|
||||
"appendlist",
|
||||
"bitflags",
|
||||
|
|
|
|||
|
|
@ -70,4 +70,4 @@ debug = true
|
|||
lto = "fat"
|
||||
|
||||
[patch."https://github.com/Smithay/smithay.git"]
|
||||
smithay = { git = "https://github.com/pop-os/smithay", rev = "05f5db5beb" }
|
||||
smithay = { git = "https://github.com/pop-os/smithay", rev = "b231c3dd2a" }
|
||||
|
|
|
|||
|
|
@ -914,7 +914,8 @@ impl State {
|
|||
.common
|
||||
.xwayland_state
|
||||
.values()
|
||||
.find_map(|s| s.display.map(|v| format!(":{}", v)))
|
||||
.next()
|
||||
.map(|s| format!(":{}", s.display))
|
||||
.unwrap_or(String::new()),
|
||||
)
|
||||
.env_remove("COSMIC_SESSION_SOCK")
|
||||
|
|
|
|||
|
|
@ -77,7 +77,13 @@ pub fn setup_socket(handle: LoopHandle<Data>, state: &State) -> Result<()> {
|
|||
.into_string()
|
||||
.map_err(|_| anyhow!("wayland socket is no valid utf-8 string?"))?,
|
||||
);
|
||||
if let Some(display) = state.common.xwayland_state.values().find_map(|s| s.display) {
|
||||
if let Some(display) = state
|
||||
.common
|
||||
.xwayland_state
|
||||
.values()
|
||||
.next()
|
||||
.map(|s| s.display)
|
||||
{
|
||||
env.insert(String::from("DISPLAY"), format!(":{}", display));
|
||||
}
|
||||
let message = serde_json::to_string(&Message::SetEnv { variables: env })
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ pub fn ready(state: &State) {
|
|||
.common
|
||||
.xwayland_state
|
||||
.values()
|
||||
.find_map(|s| s.display.map(|v| format!(":{}", v)))
|
||||
.next()
|
||||
.map(|s| format!(":{}", s.display))
|
||||
.unwrap_or(String::new()),
|
||||
)
|
||||
.status()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use smithay::{
|
|||
|
||||
pub struct XWaylandState {
|
||||
pub xwm: Option<X11Wm>,
|
||||
pub display: Option<u32>,
|
||||
pub display: u32,
|
||||
#[allow(unused)]
|
||||
xwayland: XWayland,
|
||||
}
|
||||
|
|
@ -74,14 +74,12 @@ impl State {
|
|||
let mut xwayland_state =
|
||||
data.state.common.xwayland_state.get_mut(&drm_node).unwrap();
|
||||
xwayland_state.xwm = Some(wm);
|
||||
xwayland_state.display = Some(display);
|
||||
}
|
||||
XWaylandEvent::Exited => {
|
||||
if let Some(mut xwayland_state) =
|
||||
data.state.common.xwayland_state.remove(&drm_node)
|
||||
{
|
||||
xwayland_state.xwm = None;
|
||||
xwayland_state.display = None;
|
||||
}
|
||||
}
|
||||
}) {
|
||||
|
|
@ -102,13 +100,13 @@ impl State {
|
|||
}
|
||||
},
|
||||
) {
|
||||
Ok(_) => {
|
||||
Ok(display) => {
|
||||
self.common.xwayland_state.insert(
|
||||
drm_node,
|
||||
XWaylandState {
|
||||
xwayland,
|
||||
xwm: None,
|
||||
display: None,
|
||||
display,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue