From f73c8f968d04bbe2c51ed84c275470baae5175fb Mon Sep 17 00:00:00 2001 From: Nova Date: Thu, 13 Jun 2024 10:18:42 -0400 Subject: [PATCH] fix(wayland): properly kill off xwayland --- Cargo.lock | 39 --------------------------------------- Cargo.toml | 2 -- src/nodes/root.rs | 7 ------- src/wayland/compositor.rs | 12 +----------- src/wayland/mod.rs | 2 -- src/wayland/surface.rs | 30 +++++++++++++----------------- 6 files changed, 14 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8616dde..6e2c5d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -623,15 +623,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - [[package]] name = "env_logger" version = "0.10.2" @@ -766,16 +757,6 @@ dependencies = [ "windows", ] -[[package]] -name = "gethostname" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" -dependencies = [ - "libc", - "windows-targets 0.48.5", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -1984,7 +1965,6 @@ dependencies = [ "drm", "drm-ffi", "drm-fourcc", - "encoding_rs", "errno", "gl_generator", "indexmap 2.2.6", @@ -1996,7 +1976,6 @@ dependencies = [ "rand", "rustix", "scan_fmt", - "scopeguard", "smallvec", "tempfile", "thiserror", @@ -2005,7 +1984,6 @@ dependencies = [ "wayland-protocols-misc", "wayland-protocols-wlr", "wayland-server", - "x11rb", "xkbcommon", ] @@ -2906,23 +2884,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "x11rb" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" -dependencies = [ - "gethostname", - "rustix", - "x11rb-protocol", -] - -[[package]] -name = "x11rb-protocol" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" - [[package]] name = "xkbcommon" version = "0.7.0" diff --git a/Cargo.toml b/Cargo.toml index 14de4de..0b34269 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,6 @@ path = "src/main.rs" [features] default = ["wayland"] wayland = ["dep:smithay", "dep:xkbcommon"] -xwayland_rootful = [] -xwayland_rootless = ["smithay/xwayland"] profile_tokio = ["dep:console-subscriber", "tokio/tracing"] profile_app = ["dep:tracing-tracy"] diff --git a/src/nodes/root.rs b/src/nodes/root.rs index ac060cd..9e313db 100644 --- a/src/nodes/root.rs +++ b/src/nodes/root.rs @@ -6,8 +6,6 @@ use crate::core::registry::Registry; use crate::nodes::spatial::SPATIAL_REF_ASPECT_ALIAS_INFO; #[cfg(feature = "wayland")] use crate::wayland::WAYLAND_DISPLAY; -#[cfg(feature = "xwayland")] -use crate::wayland::X_DISPLAY; use crate::STARDUST_INSTANCE; use color_eyre::eyre::{bail, Result}; use glam::Mat4; @@ -74,11 +72,6 @@ impl RootAspect for Root { #[cfg(feature = "wayland")] { var_env_insert!(env, WAYLAND_DISPLAY); - #[cfg(feature = "xwayland")] - env.insert( - "DISPLAY".to_string(), - format!(":{}", X_DISPLAY.get().unwrap()), - ); env.insert("GDK_BACKEND".to_string(), "wayland".to_string()); env.insert("QT_QPA_PLATFORM".to_string(), "wayland".to_string()); env.insert("MOZ_ENABLE_WAYLAND".to_string(), "1".to_string()); diff --git a/src/wayland/compositor.rs b/src/wayland/compositor.rs index b047d5c..7288537 100644 --- a/src/wayland/compositor.rs +++ b/src/wayland/compositor.rs @@ -2,8 +2,6 @@ use crate::wayland::surface::CoreSurface; use super::state::{ClientState, WaylandState}; use portable_atomic::{AtomicU32, Ordering}; -#[cfg(feature = "xwayland_rootless")] -use smithay::xwayland::XWaylandClientData; use smithay::{ delegate_compositor, reexports::wayland_server::{protocol::wl_surface::WlSurface, Client}, @@ -38,15 +36,7 @@ impl CompositorHandler for WaylandState { } fn client_compositor_state<'a>(&self, client: &'a Client) -> &'a CompositorClientState { - if let Some(client_state) = client.get_data::() { - &client_state.compositor_state - } else { - #[cfg(feature = "xwayland_rootless")] - if let Some(xwayland_client_data) = client.get_data::() { - return &xwayland_client_data.compositor_state; - } - unimplemented!() - } + &client.get_data::().unwrap().compositor_state } } diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index b21bca2..1599dd9 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -202,7 +202,5 @@ impl Wayland { impl Drop for Wayland { fn drop(&mut self) { self.join_handle.abort(); - #[cfg(feature = "xwayland_rootless")] - self.xwayland_join_handle.abort(); } } diff --git a/src/wayland/surface.rs b/src/wayland/surface.rs index e7b18ce..2a0e687 100644 --- a/src/wayland/surface.rs +++ b/src/wayland/surface.rs @@ -1,4 +1,4 @@ -use super::{state::WaylandState, utils::get_data}; +use super::{state::WaylandState, utils}; use crate::{ core::{delta::Delta, destroy_queue, registry::Registry}, nodes::{ @@ -12,7 +12,6 @@ use crate::{ use mint::Vector2; use once_cell::sync::OnceCell; use parking_lot::Mutex; - use send_wrapper::SendWrapper; use smithay::{ backend::renderer::{ @@ -64,21 +63,18 @@ impl CoreSurface { on_mapped: impl Fn() + Send + Sync + 'static, on_commit: impl Fn(u32) + Send + Sync + 'static, ) { - compositor::with_states(surface, |data| { - data.data_map.insert_if_missing_threadsafe(|| { - CORE_SURFACES.add(CoreSurface { - dh, - weak_surface: surface.downgrade(), - mapped_data: Mutex::new(None), - sk_tex: OnceCell::new(), - sk_mat: OnceCell::new(), - material_offset: Mutex::new(Delta::new(0)), - on_mapped: Mutex::new(Box::new(on_mapped) as Box), - on_commit: Mutex::new(Box::new(on_commit) as Box), - pending_material_applications: Registry::new(), - }) - }); + let core_surface = CORE_SURFACES.add(CoreSurface { + dh, + weak_surface: surface.downgrade(), + mapped_data: Mutex::new(None), + sk_tex: OnceCell::new(), + sk_mat: OnceCell::new(), + material_offset: Mutex::new(Delta::new(0)), + on_mapped: Mutex::new(Box::new(on_mapped) as Box), + on_commit: Mutex::new(Box::new(on_commit) as Box), + pending_material_applications: Registry::new(), }); + utils::insert_data_raw(surface, core_surface); } pub fn commit(&self, count: u32) { @@ -86,7 +82,7 @@ impl CoreSurface { } pub fn from_wl_surface(surf: &WlSurface) -> Option> { - get_data(surf) + utils::get_data(surf) } pub fn decycle(&self) {