Skip to content

Commit

Permalink
fix(wayland): strip out all the xwayland stuff finally
Browse files Browse the repository at this point in the history
  • Loading branch information
technobaboo committed Jun 13, 2024
1 parent f73c8f9 commit 36fd321
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 50 deletions.
86 changes: 53 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ impl Wayland {
pid: stream.peer_cred().ok().and_then(|c| c.pid()),
id: OnceCell::new(),
compositor_state: Default::default(),
display: Arc::downgrade(&display),
seat: state.lock().seat.clone(),
});
let _client = dh2.insert_client(stream.into_std()?, client_state.clone())?;
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/seat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl SeatHandler for WaylandState {
self.seat.cursor_info_tx.send_modify(|c| match image {
CursorImageStatus::Hidden => c.surface = None,
CursorImageStatus::Surface(surface) => {
CoreSurface::add_to(self.display_handle.clone(), &surface, || (), |_| ());
CoreSurface::add_to(&surface, || (), |_| ());
compositor::with_states(&surface, |data| {
if let Some(core_surface) = data.data_map.get::<Arc<CoreSurface>>() {
core_surface.set_material_offset(1);
Expand Down
11 changes: 2 additions & 9 deletions src/wayland/state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{seat::SeatWrapper, DisplayWrapper};
use super::seat::SeatWrapper;
use crate::wayland::drm::wl_drm::WlDrm;
use once_cell::sync::OnceCell;
use parking_lot::Mutex;
Expand Down Expand Up @@ -41,15 +41,14 @@ use smithay::{
shm::{ShmHandler, ShmState},
},
};
use std::sync::{Arc, Weak};
use std::sync::Arc;
use tokio::sync::mpsc::UnboundedSender;
use tracing::{info, warn};

pub struct ClientState {
pub pid: Option<i32>,
pub id: OnceCell<ClientId>,
pub compositor_state: CompositorClientState,
pub display: Weak<DisplayWrapper>,
pub seat: Arc<SeatWrapper>,
}
impl ClientData for ClientState {
Expand All @@ -67,9 +66,6 @@ impl ClientData for ClientState {
}

pub struct WaylandState {
pub weak_ref: Weak<Mutex<WaylandState>>,
pub display_handle: DisplayHandle,

pub compositor_state: CompositorState,
// pub xdg_activation_state: XdgActivationState,
pub kde_decoration_state: KdeDecorationState,
Expand Down Expand Up @@ -176,9 +172,6 @@ impl WaylandState {

Arc::new_cyclic(|weak| {
Mutex::new(WaylandState {
weak_ref: weak.clone(),
display_handle,

compositor_state,
// xdg_activation_state,
kde_decoration_state,
Expand Down
5 changes: 1 addition & 4 deletions src/wayland/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use smithay::{
},
desktop::utils::send_frames_surface_tree,
output::Output,
reexports::wayland_server::{self, protocol::wl_surface::WlSurface, DisplayHandle, Resource},
reexports::wayland_server::{self, protocol::wl_surface::WlSurface, Resource},
wayland::compositor::{self, SurfaceData},
};
use std::{cell::RefCell, ffi::c_void, sync::Arc, time::Duration};
Expand All @@ -45,7 +45,6 @@ impl Drop for CoreSurfaceData {
}

pub struct CoreSurface {
pub dh: DisplayHandle,
pub weak_surface: wayland_server::Weak<WlSurface>,
mapped_data: Mutex<Option<CoreSurfaceData>>,
sk_tex: OnceCell<Mutex<TexWrapper>>,
Expand All @@ -58,13 +57,11 @@ pub struct CoreSurface {

impl CoreSurface {
pub fn add_to(
dh: DisplayHandle,
surface: &WlSurface,
on_mapped: impl Fn() + Send + Sync + 'static,
on_commit: impl Fn(u32) + Send + Sync + 'static,
) {
let core_surface = CORE_SURFACES.add(CoreSurface {
dh,
weak_surface: surface.downgrade(),
mapped_data: Mutex::new(None),
sk_tex: OnceCell::new(),
Expand Down
2 changes: 0 additions & 2 deletions src/wayland/xdg_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ impl XdgShellHandler for WaylandState {
toplevel.send_configure();
utils::insert_data(toplevel.wl_surface(), SurfaceId::Toplevel);
CoreSurface::add_to(
self.display_handle.clone(),
toplevel.wl_surface(),
{
let toplevel = toplevel.clone();
Expand Down Expand Up @@ -199,7 +198,6 @@ impl XdgShellHandler for WaylandState {
utils::insert_data(popup.wl_surface(), uid);
utils::insert_data(popup.wl_surface(), Arc::downgrade(&panel_item));
CoreSurface::add_to(
self.display_handle.clone(),
popup.wl_surface(),
{
let popup = popup.clone();
Expand Down

0 comments on commit 36fd321

Please sign in to comment.