xwayland: Add initial support

This commit is contained in:
Victoria Brekenfeld 2023-01-18 20:23:41 +01:00
parent 78ffe3a93d
commit 1d28574088
23 changed files with 781 additions and 185 deletions

View file

@ -301,6 +301,9 @@ pub fn init_backend(
devices: HashMap::new(),
});
// TODO: Do multiple Xwaylands for better multigpu
state.launch_xwayland(Some(primary));
for (dev, path) in udev_dispatcher.as_source_ref().device_list() {
state
.device_added(dev, path.into(), dh)

View file

@ -11,6 +11,7 @@ use smithay::{
wayland_server::{backend::GlobalId, Client, DisplayHandle},
},
wayland::{dmabuf::DmabufGlobal, socket::ListeningSocketSource},
xwayland::XWaylandClientData,
};
use std::sync::Arc;
@ -46,8 +47,15 @@ impl State {
// initialize globals
let filter = move |client: &Client| {
let dev_id = client.get_data::<ClientState>().unwrap().drm_node.unwrap();
dev_id == render_node
if let Some(normal_client) = client.get_data::<ClientState>() {
let dev_id = normal_client.drm_node.unwrap();
return dev_id == render_node;
}
if let Some(xwayland_client) = client.get_data::<XWaylandClientData>() {
let dev_id = xwayland_client.user_data().get::<DrmNode>().unwrap();
return *dev_id == render_node;
}
false
};
let dmabuf_global = self

View file

@ -241,6 +241,7 @@ pub fn init_backend(
#[cfg(feature = "debug")]
fps,
});
state
.common
.output_configuration_state
@ -255,6 +256,8 @@ pub fn init_backend(
&state.common.event_loop_handle,
);
state.launch_xwayland(None);
Ok(())
}

View file

@ -305,6 +305,8 @@ pub fn init_backend(
&state.common.event_loop_handle,
);
state.launch_xwayland(None);
event_loop
.handle()
.insert_source(backend, move |event, _, data| match event {