From edf46f564976972a1f565d5d89f4503949446db9 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 24 Apr 2024 09:34:46 -0700 Subject: [PATCH] Update `smithay` --- Cargo.lock | 53 ++++++++-- Cargo.toml | 2 +- src/backend/render/cursor.rs | 4 +- src/backend/x11.rs | 7 +- src/main.rs | 71 +++++++++----- src/session.rs | 13 ++- src/shell/element/mod.rs | 2 +- src/shell/element/stack.rs | 2 +- src/shell/element/surface.rs | 4 +- src/shell/element/window.rs | 2 +- src/shell/grabs/moving.rs | 4 +- src/shell/layout/floating/mod.rs | 2 +- src/shell/layout/tiling/mod.rs | 6 +- src/shell/workspace.rs | 2 +- src/state.rs | 14 ++- src/systemd.rs | 9 +- src/utils/screenshot.rs | 2 +- src/wayland/handlers/input_method.rs | 2 + src/xwayland.rs | 138 +++++++++++++-------------- 19 files changed, 202 insertions(+), 137 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 092a0249..52af46b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1260,7 +1260,20 @@ checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" dependencies = [ "bitflags 2.4.2", "bytemuck", - "drm-ffi", + "drm-ffi 0.7.1", + "drm-fourcc", + "rustix 0.38.32", +] + +[[package]] +name = "drm" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98888c4bbd601524c11a7ed63f814b8825f420514f78e96f752c437ae9cbb5d1" +dependencies = [ + "bitflags 2.4.2", + "bytemuck", + "drm-ffi 0.8.0", "drm-fourcc", "rustix 0.38.32", ] @@ -1271,7 +1284,17 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6" dependencies = [ - "drm-sys", + "drm-sys 0.6.1", + "rustix 0.38.32", +] + +[[package]] +name = "drm-ffi" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97c98727e48b7ccb4f4aea8cfe881e5b07f702d17b7875991881b41af7278d53" +dependencies = [ + "drm-sys 0.7.0", "rustix 0.38.32", ] @@ -1291,6 +1314,16 @@ dependencies = [ "linux-raw-sys 0.6.4", ] +[[package]] +name = "drm-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd39dde40b6e196c2e8763f23d119ddb1a8714534bf7d77fa97a65b0feda3986" +dependencies = [ + "libc", + "linux-raw-sys 0.6.4", +] + [[package]] name = "ecolor" version = "0.23.0" @@ -1926,12 +1959,12 @@ dependencies = [ [[package]] name = "gbm" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313702b30cdeb83ddc72bc14dcee67803cd0ae2d12282ea06e368c25a900c844" +checksum = "45bf55ba6dd53ad0ac115046ff999c5324c283444ee6e0be82454c4e8eb2f36a" dependencies = [ - "bitflags 1.3.2", - "drm", + "bitflags 2.4.2", + "drm 0.12.0", "drm-fourcc", "gbm-sys", "libc", @@ -4525,7 +4558,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/smithay//smithay?rev=eea0d9c#eea0d9c171f30eb50247632fcddbb84f1dd147f0" +source = "git+https://github.com/smithay//smithay?rev=64356be#64356be949f2ad5f70f601cd10255eafed2ce2ce" dependencies = [ "appendlist", "ash", @@ -4535,8 +4568,8 @@ dependencies = [ "cgmath", "cursor-icon", "downcast-rs", - "drm", - "drm-ffi", + "drm 0.12.0", + "drm-ffi 0.8.0", "drm-fourcc", "encoding_rs", "errno", @@ -4660,7 +4693,7 @@ dependencies = [ "cfg_aliases 0.2.0", "cocoa", "core-graphics", - "drm", + "drm 0.11.1", "fastrand 2.0.1", "foreign-types", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 10a83907..91f6c0ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,4 +119,4 @@ inherits = "release" lto = "fat" [patch."https://github.com/Smithay/smithay.git"] -smithay = {git = "https://github.com/smithay//smithay", rev = "eea0d9c"} +smithay = {git = "https://github.com/smithay//smithay", rev = "64356be"} diff --git a/src/backend/render/cursor.rs b/src/backend/render/cursor.rs index 84dcc17c..75413039 100644 --- a/src/backend/render/cursor.rs +++ b/src/backend/render/cursor.rs @@ -161,7 +161,7 @@ pub fn draw_surface_cursor( ) -> Vec<(CursorRenderElement, Point)> where R: Renderer + ImportAll, - ::TextureId: 'static, + ::TextureId: Clone + 'static, { let position = location.into(); let scale = scale.into(); @@ -202,7 +202,7 @@ pub fn draw_dnd_icon( ) -> Vec> where R: Renderer + ImportAll, - ::TextureId: 'static, + ::TextureId: Clone + 'static, { if get_role(&surface) != Some("dnd_icon") { warn!( diff --git a/src/backend/x11.rs b/src/backend/x11.rs index d3e90b0c..7a4e27bf 100644 --- a/src/backend/x11.rs +++ b/src/backend/x11.rs @@ -458,8 +458,11 @@ pub fn init_backend( } } } - X11Event::Input(event) => state.process_x11_event(event), - X11Event::Focus(_) => {} // TODO: release all keys when losing focus and make sure to go through our keyboard filter code + X11Event::Input { + event, + window_id: _, + } => state.process_x11_event(event), + X11Event::Focus { .. } => {} // TODO: release all keys when losing focus and make sure to go through our keyboard filter code }) .map_err(|_| anyhow::anyhow!("Failed to insert X11 Backend into event loop"))?; diff --git a/src/main.rs b/src/main.rs index 9ec805b6..afa97eba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ use smithay::{ }; use anyhow::{Context, Result}; +use state::State; use std::{env, ffi::OsString, os::unix::process::CommandExt, process, sync::Arc}; use tracing::{error, info, warn}; @@ -40,6 +41,51 @@ pub mod xwayland; static GLOBAL: profiling::tracy_client::ProfiledAllocator = profiling::tracy_client::ProfiledAllocator::new(std::alloc::System, 10); +// called by the Xwayland source, either after starting or failing +impl State { + fn notify_ready(&mut self) { + // TODO: Don't notify again, but potentially import updated env-variables + // into systemd and the session? + self.ready.call_once(|| { + // potentially tell systemd we are setup now + #[cfg(feature = "systemd")] + if let state::BackendData::Kms(_) = &self.backend { + systemd::ready(&self.common); + } + + // potentially tell the session we are setup now + if let Err(err) = + session::setup_socket(self.common.event_loop_handle.clone(), &self.common) + { + warn!(?err, "Failed to setup cosmic-session communication"); + } + + let mut args = env::args().skip(1); + self.common.kiosk_child = if let Some(exec) = args.next() { + // Run command in kiosk mode + let mut command = process::Command::new(&exec); + command.args(args); + command.envs( + session::get_env(&self.common).expect("WAYLAND_DISPLAY should be valid UTF-8"), + ); + unsafe { command.pre_exec(|| Ok(utils::rlimit::restore_nofile_limit())) }; + + info!("Running {:?}", exec); + command + .spawn() + .map_err(|err| { + // TODO: replace with `inspect_err` once stable + error!(?err, "Error running kiosk child."); + err + }) + .ok() + } else { + None + }; + }); + } +} + fn main() -> Result<()> { // setup logger logger::init_logger()?; @@ -60,27 +106,6 @@ fn main() -> Result<()> { ); // init backend backend::init_backend_auto(&display, &mut event_loop, &mut state)?; - // potentially tell systemd we are setup now - #[cfg(feature = "systemd")] - if let state::BackendData::Kms(_) = &state.backend { - systemd::ready(&state); - } - // potentially tell the session we are setup now - session::setup_socket(event_loop.handle(), &state)?; - - let mut args = env::args().skip(1); - let mut child_opt = if let Some(exec) = args.next() { - // Run command in kiosk mode - let mut command = process::Command::new(&exec); - command.args(args); - command.envs(session::get_env(&state)?); - unsafe { command.pre_exec(|| Ok(utils::rlimit::restore_nofile_limit())) }; - - info!("Running {:?}", exec); - Some(command.spawn()?) - } else { - None - }; if let Err(err) = theme::watch_theme(event_loop.handle()) { warn!(?err, "Failed to watch theme"); @@ -137,7 +162,7 @@ fn main() -> Result<()> { let _ = state.common.display_handle.flush_clients(); // check if kiosk child is running - if let Some(ref mut child) = child_opt { + if let Some(child) = state.common.kiosk_child.as_mut() { match child.try_wait() { // Kiosk child exited with status Ok(Some(exit_status)) => { @@ -161,7 +186,7 @@ fn main() -> Result<()> { })?; // kill kiosk child if loop exited - if let Some(mut child) = child_opt { + if let Some(mut child) = state.common.kiosk_child.take() { let _ = child.kill(); } diff --git a/src/session.rs b/src/session.rs index 536d6086..240e649b 100644 --- a/src/session.rs +++ b/src/session.rs @@ -19,7 +19,7 @@ use std::{ }; use tracing::{error, warn}; -use crate::state::{ClientState, State}; +use crate::state::{ClientState, Common, State}; #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case", tag = "message")] @@ -59,24 +59,23 @@ unsafe fn set_cloexec(fd: RawFd) -> rustix::io::Result<()> { rustix::io::fcntl_setfd(fd, flags | rustix::io::FdFlags::CLOEXEC) } -pub fn get_env(state: &State) -> Result> { +pub fn get_env(common: &Common) -> Result> { let mut env = HashMap::new(); env.insert( String::from("WAYLAND_DISPLAY"), - state - .common + common .socket .clone() .into_string() .map_err(|_| anyhow!("wayland socket is no valid utf-8 string?"))?, ); - if let Some(display) = state.common.xwayland_state.as_ref().map(|s| s.display) { + if let Some(display) = common.xwayland_state.as_ref().map(|s| s.display) { env.insert(String::from("DISPLAY"), format!(":{}", display)); } Ok(env) } -pub fn setup_socket(handle: LoopHandle, state: &State) -> Result<()> { +pub fn setup_socket(handle: LoopHandle, common: &Common) -> Result<()> { if let Ok(fd_num) = std::env::var("COSMIC_SESSION_SOCK") { if let Ok(fd) = fd_num.parse::() { let mut session_socket = match unsafe { set_cloexec(fd) } { @@ -89,7 +88,7 @@ pub fn setup_socket(handle: LoopHandle, state: &State) -> Result<()> { } }; - let env = get_env(state)?; + let env = get_env(common)?; let message = serde_json::to_string(&Message::SetEnv { variables: env }) .with_context(|| "Failed to encode environment variables into json")?; let bytes = message.into_bytes(); diff --git a/src/shell/element/mod.rs b/src/shell/element/mod.rs index 9e88be4d..c5465c60 100644 --- a/src/shell/element/mod.rs +++ b/src/shell/element/mod.rs @@ -620,7 +620,7 @@ impl CosmicMapped { ) -> (Vec, Vec) where R: Renderer + ImportAll + ImportMem + AsGlowRenderer, - ::TextureId: 'static, + ::TextureId: Clone + 'static, CosmicMappedRenderElement: RenderElement, C: From>, { diff --git a/src/shell/element/stack.rs b/src/shell/element/stack.rs index 92a56bbf..9210c9e7 100644 --- a/src/shell/element/stack.rs +++ b/src/shell/element/stack.rs @@ -549,7 +549,7 @@ impl CosmicStack { ) -> (Vec, Vec) where R: Renderer + ImportAll + ImportMem, - ::TextureId: 'static, + ::TextureId: Clone + 'static, C: From>, { let offset = self diff --git a/src/shell/element/surface.rs b/src/shell/element/surface.rs index 2dad2e46..a00dc311 100644 --- a/src/shell/element/surface.rs +++ b/src/shell/element/surface.rs @@ -559,7 +559,7 @@ impl CosmicSurface { ) -> (Vec, Vec) where R: Renderer + ImportAll, - ::TextureId: 'static, + ::TextureId: Clone + 'static, C: From>, { match self.0.underlying_surface() { @@ -734,7 +734,7 @@ impl X11Relatable for CosmicSurface { impl AsRenderElements for CosmicSurface where R: Renderer + ImportAll, - ::TextureId: 'static, + ::TextureId: Clone + 'static, { type RenderElement = WaylandSurfaceRenderElement; diff --git a/src/shell/element/window.rs b/src/shell/element/window.rs index 6e572d26..99732754 100644 --- a/src/shell/element/window.rs +++ b/src/shell/element/window.rs @@ -320,7 +320,7 @@ impl CosmicWindow { ) -> (Vec, Vec) where R: Renderer + ImportAll + ImportMem, - ::TextureId: 'static, + ::TextureId: Clone + 'static, C: From>, { let has_ssd = self.0.with_program(|p| p.has_ssd(false)); diff --git a/src/shell/grabs/moving.rs b/src/shell/grabs/moving.rs index 72f92a90..8c7a84a0 100644 --- a/src/shell/grabs/moving.rs +++ b/src/shell/grabs/moving.rs @@ -42,7 +42,7 @@ use smithay::{ Seat, }, output::Output, - utils::{IsAlive, Logical, Point, Rectangle, Scale, Serial, Size, SERIAL_COUNTER}, + utils::{IsAlive, Logical, Point, Rectangle, Scale, Serial, SERIAL_COUNTER}, }; use std::{cell::RefCell, collections::HashSet, sync::atomic::Ordering, time::Instant}; @@ -69,7 +69,7 @@ impl MoveGrabState { pub fn render(&self, renderer: &mut R, output: &Output, theme: &CosmicTheme) -> Vec where R: Renderer + ImportAll + ImportMem + AsGlowRenderer, - ::TextureId: 'static, + ::TextureId: Clone + 'static, CosmicMappedRenderElement: RenderElement, I: From>, { diff --git a/src/shell/layout/floating/mod.rs b/src/shell/layout/floating/mod.rs index a97d413a..8082f786 100644 --- a/src/shell/layout/floating/mod.rs +++ b/src/shell/layout/floating/mod.rs @@ -1219,7 +1219,7 @@ impl FloatingLayout { ) where R: Renderer + ImportAll + ImportMem + AsGlowRenderer, - ::TextureId: 'static, + ::TextureId: Clone + 'static, CosmicMappedRenderElement: RenderElement, CosmicWindowRenderElement: RenderElement, CosmicStackRenderElement: RenderElement, diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 5cc5970f..91595500 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -3833,7 +3833,7 @@ impl TilingLayout { > where R: Renderer + ImportAll + ImportMem + AsGlowRenderer, - ::TextureId: 'static, + ::TextureId: Clone + 'static, CosmicMappedRenderElement: RenderElement, CosmicWindowRenderElement: RenderElement, CosmicStackRenderElement: RenderElement, @@ -4678,7 +4678,7 @@ fn render_old_tree( ) where R: Renderer + ImportAll + ImportMem + AsGlowRenderer, - ::TextureId: 'static, + ::TextureId: Clone + 'static, CosmicMappedRenderElement: RenderElement, CosmicWindowRenderElement: RenderElement, CosmicStackRenderElement: RenderElement, @@ -4838,7 +4838,7 @@ fn render_new_tree( ) where R: Renderer + ImportAll + ImportMem + AsGlowRenderer, - ::TextureId: 'static, + ::TextureId: Clone + 'static, CosmicMappedRenderElement: RenderElement, CosmicWindowRenderElement: RenderElement, CosmicStackRenderElement: RenderElement, diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index 3d575cc3..d5b18d3c 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -1036,7 +1036,7 @@ impl Workspace { > where R: Renderer + ImportAll + ImportMem + AsGlowRenderer, - ::TextureId: 'static, + ::TextureId: Clone + 'static, CosmicMappedRenderElement: RenderElement, CosmicWindowRenderElement: RenderElement, CosmicStackRenderElement: RenderElement, diff --git a/src/state.rs b/src/state.rs index 97c90720..5a0a30c9 100644 --- a/src/state.rs +++ b/src/state.rs @@ -99,12 +99,14 @@ use smithay::{ use time::UtcOffset; use tracing::error; -use std::{cell::RefCell, ffi::OsString, time::Duration}; use std::{ - collections::HashSet, - sync::{Arc, RwLock}, + cell::RefCell, + collections::{HashSet, VecDeque}, + ffi::OsString, + process::Child, + sync::{Arc, Once, RwLock}, + time::{Duration, Instant}, }; -use std::{collections::VecDeque, time::Instant}; #[derive(RustEmbed)] #[folder = "resources/i18n"] @@ -155,6 +157,7 @@ pub fn advertised_node_for_surface(w: &WlSurface, dh: &DisplayHandle) -> Option< pub struct State { pub backend: BackendData, pub common: Common, + pub ready: Once, } #[derive(Debug)] @@ -174,6 +177,7 @@ pub struct Common { pub local_offset: time::UtcOffset, pub gesture_state: Option, + pub kiosk_child: Option, pub theme: cosmic::Theme, #[cfg(feature = "debug")] @@ -484,6 +488,7 @@ impl State { should_stop: false, gesture_state: None, + kiosk_child: None, theme: cosmic::theme::system_preference(), #[cfg(feature = "debug")] @@ -526,6 +531,7 @@ impl State { xwayland_state: None, }, backend: BackendData::Unset, + ready: Once::new(), } } diff --git a/src/systemd.rs b/src/systemd.rs index d75f3f82..1ec18f48 100644 --- a/src/systemd.rs +++ b/src/systemd.rs @@ -1,19 +1,18 @@ // SPDX-License-Identifier: GPL-3.0-only -use crate::state::State; +use crate::state::Common; use libsystemd::daemon::{booted, notify, NotifyState}; use std::process::Command; use tracing::{error, warn}; -pub fn ready(state: &State) { +pub fn ready(common: &Common) { if booted() { match Command::new("systemctl") .args(["--user", "import-environment", "WAYLAND_DISPLAY", "DISPLAY"]) - .env("WAYLAND_DISPLAY", &state.common.socket) + .env("WAYLAND_DISPLAY", &common.socket) .env( "DISPLAY", - &state - .common + &common .xwayland_state .as_ref() .map(|s| format!(":{}", s.display)) diff --git a/src/utils/screenshot.rs b/src/utils/screenshot.rs index f0df8d43..7c34f6ab 100644 --- a/src/utils/screenshot.rs +++ b/src/utils/screenshot.rs @@ -28,7 +28,7 @@ pub fn screenshot_window(state: &mut State, surface: &CosmicSurface) { ) -> anyhow::Result<()> where R: Renderer + ImportAll + Offscreen + ExportMem, - ::TextureId: 'static, + ::TextureId: Clone + 'static, ::Error: Send + Sync + 'static, { let bbox = bbox_from_surface_tree(&window.wl_surface().unwrap(), (0, 0)); diff --git a/src/wayland/handlers/input_method.rs b/src/wayland/handlers/input_method.rs index 4e8dc582..4587dd67 100644 --- a/src/wayland/handlers/input_method.rs +++ b/src/wayland/handlers/input_method.rs @@ -32,6 +32,8 @@ impl InputMethodHandler for State { .map(|e| e.geometry()) .unwrap_or_default() } + + fn popup_repositioned(&mut self, _: PopupSurface) {} } delegate_input_method_manager!(State); diff --git a/src/xwayland.rs b/src/xwayland.rs index c2d945b0..fe0f3838 100644 --- a/src/xwayland.rs +++ b/src/xwayland.rs @@ -1,4 +1,4 @@ -use std::{ffi::OsString, os::unix::io::OwnedFd}; +use std::{ffi::OsString, os::unix::io::OwnedFd, process::Stdio}; use crate::{ backend::render::cursor::{load_cursor_theme, Cursor, CursorShape}, @@ -39,8 +39,6 @@ use tracing::{error, trace, warn}; pub struct XWaylandState { pub xwm: Option, pub display: u32, - #[allow(unused)] - xwayland: XWayland, } impl State { @@ -49,84 +47,84 @@ impl State { return; } - let (xwayland, source) = XWayland::new(&self.common.display_handle); - let token = - match self - .common - .event_loop_handle - .insert_source(source, move |event, _, data| match event { - XWaylandEvent::Ready { - connection, - client, - client_fd: _, - display: _, - } => { - let mut wm = match X11Wm::start_wm( - data.common.event_loop_handle.clone(), - data.common.display_handle.clone(), - connection, - client, - ) { - Ok(wm) => wm, - Err(err) => { - error!(?err, "Failed to start Xwayland WM"); - return; - } - }; - - let (theme, size) = load_cursor_theme(); - let cursor = Cursor::load(&theme, CursorShape::Default, size); - let image = cursor.get_image(1, 0); - if let Err(err) = wm.set_cursor( - &image.pixels_rgba, - Size::from((image.width as u16, image.height as u16)), - Point::from((image.xhot as u16, image.yhot as u16)), - ) { - warn!( - id = ?wm.id(), - ?err, - "Failed to set default cursor for Xwayland WM", - ); - } - - let xwayland_state = data.common.xwayland_state.as_mut().unwrap(); - xwayland_state.xwm = Some(wm); - } - XWaylandEvent::Exited => { - if let Some(mut xwayland_state) = data.common.xwayland_state.take() { - xwayland_state.xwm = None; - } - } - }) { - Ok(token) => token, - Err(err) => { - error!(?err, "Failed to listen for Xwayland"); - return; - } - }; - - match xwayland.start( - self.common.event_loop_handle.clone(), + let (xwayland, client) = match XWayland::spawn( + &self.common.display_handle, None, - //vec![("WAYLAND_DEBUG", "client")].into_iter(), std::iter::empty::<(OsString, OsString)>(), true, + Stdio::null(), + Stdio::null(), |user_data| { if let Some(node) = render_node { user_data.insert_if_missing(|| node); } }, ) { - Ok(display) => { - self.common.xwayland_state = Some(XWaylandState { - xwayland, - xwm: None, - display, - }); - } + Ok((xwayland, client)) => (xwayland, client), Err(err) => { error!(?err, "Failed to start Xwayland."); - self.common.event_loop_handle.remove(token); + self.notify_ready(); + return; + } + }; + + match self + .common + .event_loop_handle + .insert_source(xwayland, move |event, _, data| match event { + XWaylandEvent::Ready { + x11_socket, + display_number, + } => { + data.common.xwayland_state = Some(XWaylandState { + xwm: None, + display: display_number, + }); + + let mut wm = match X11Wm::start_wm( + data.common.event_loop_handle.clone(), + data.common.display_handle.clone(), + x11_socket, + client.clone(), + ) { + Ok(wm) => wm, + Err(err) => { + error!(?err, "Failed to start Xwayland WM"); + return; + } + }; + + let (theme, size) = load_cursor_theme(); + let cursor = Cursor::load(&theme, CursorShape::Default, size); + let image = cursor.get_image(1, 0); + if let Err(err) = wm.set_cursor( + &image.pixels_rgba, + Size::from((image.width as u16, image.height as u16)), + Point::from((image.xhot as u16, image.yhot as u16)), + ) { + warn!( + id = ?wm.id(), + ?err, + "Failed to set default cursor for Xwayland WM", + ); + } + + let xwayland_state = data.common.xwayland_state.as_mut().unwrap(); + xwayland_state.xwm = Some(wm); + data.notify_ready(); + } + XWaylandEvent::Error => { + if let Some(mut xwayland_state) = data.common.xwayland_state.take() { + xwayland_state.xwm = None; + } + data.notify_ready(); + } + }) { + Ok(_token) => {} + Err(err) => { + error!(?err, "Failed to listen for Xwayland"); + self.notify_ready(); + return; } } }