fix(wayland): properly kill off xwayland

This commit is contained in:
Nova
2024-06-13 10:18:42 -04:00
parent 83e3a913c5
commit f73c8f968d
6 changed files with 14 additions and 78 deletions

View File

@@ -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());

View File

@@ -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::<ClientState>() {
&client_state.compositor_state
} else {
#[cfg(feature = "xwayland_rootless")]
if let Some(xwayland_client_data) = client.get_data::<XWaylandClientData>() {
return &xwayland_client_data.compositor_state;
}
unimplemented!()
}
&client.get_data::<ClientState>().unwrap().compositor_state
}
}

View File

@@ -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();
}
}

View File

@@ -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<dyn Fn() + Send + Sync>),
on_commit: Mutex::new(Box::new(on_commit) as Box<dyn Fn(u32) + Send + Sync>),
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<dyn Fn() + Send + Sync>),
on_commit: Mutex::new(Box::new(on_commit) as Box<dyn Fn(u32) + Send + Sync>),
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<Arc<CoreSurface>> {
get_data(surf)
utils::get_data(surf)
}
pub fn decycle(&self) {