anvil: Pass window and output maps using dispatch data AnvilState

This commit is contained in:
i509VCB 2021-09-02 17:34:55 -05:00 committed by Victor Berger
parent 60fdbaebc5
commit fdaf1859b0
2 changed files with 366 additions and 340 deletions

View File

@ -289,8 +289,6 @@ impl PointerGrab for ResizeSurfaceGrab {
pub struct ShellHandles {
pub xdg_state: Arc<Mutex<XdgShellState>>,
pub wl_state: Arc<Mutex<WlShellState>>,
pub window_map: Rc<RefCell<WindowMap>>,
pub output_map: Rc<RefCell<OutputMap>>,
}
fn fullscreen_output_geometry(
@ -336,364 +334,380 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
log.clone(),
);
// Init a window map, to track the location of our windows
let window_map = Rc::new(RefCell::new(WindowMap::default()));
let output_map = Rc::new(RefCell::new(OutputMap::new(
display.clone(),
window_map.clone(),
log.clone(),
)));
// init the xdg_shell
let xdg_window_map = window_map.clone();
let xdg_output_map = output_map.clone();
let (xdg_shell_state, _, _) = xdg_shell_init(
&mut *display.borrow_mut(),
move |shell_event, _dispatch_data| match shell_event {
XdgRequest::NewToplevel { surface } => {
// place the window at a random location on the primary output
// or if there is not output in a [0;800]x[0;800] square
use rand::distributions::{Distribution, Uniform};
move |shell_event, mut ddata| {
let state = ddata.get::<AnvilState<BackendData>>().unwrap();
let output_geometry = xdg_output_map
.borrow()
.with_primary()
.map(|o| o.geometry())
.unwrap_or_else(|| Rectangle::from_loc_and_size((0, 0), (800, 800)));
let max_x = output_geometry.loc.x + (((output_geometry.size.w as f32) / 3.0) * 2.0) as i32;
let max_y = output_geometry.loc.y + (((output_geometry.size.h as f32) / 3.0) * 2.0) as i32;
let x_range = Uniform::new(output_geometry.loc.x, max_x);
let y_range = Uniform::new(output_geometry.loc.y, max_y);
let mut rng = rand::thread_rng();
let x = x_range.sample(&mut rng);
let y = y_range.sample(&mut rng);
// Do not send a configure here, the initial configure
// of a xdg_surface has to be sent during the commit if
// the surface is not already configured
xdg_window_map
.borrow_mut()
.insert(SurfaceKind::Xdg(surface), (x, y).into());
}
XdgRequest::NewPopup { surface, positioner } => {
// Do not send a configure here, the initial configure
// of a xdg_surface has to be sent during the commit if
// the surface is not already configured
match shell_event {
XdgRequest::NewToplevel { surface } => {
// place the window at a random location on the primary output
// or if there is not output in a [0;800]x[0;800] square
use rand::distributions::{Distribution, Uniform};
// TODO: properly recompute the geometry with the whole of positioner state
surface
.with_pending_state(|state| {
// NOTE: This is not really necessary as the default geometry
// is already set the same way, but for demonstrating how
// to set the initial popup geometry this code is left as
// an example
state.geometry = positioner.get_geometry();
})
.unwrap();
xdg_window_map.borrow_mut().insert_popup(PopupKind::Xdg(surface));
}
XdgRequest::RePosition {
surface,
positioner,
token,
} => {
let result = surface.with_pending_state(|state| {
// NOTE: This is again a simplification, a proper compositor would
// calculate the geometry of the popup here. For simplicity we just
// use the default implementation here that does not take the
// window position and output constraints into account.
let geometry = positioner.get_geometry();
state.geometry = geometry;
state.positioner = positioner;
});
let output_geometry = state
.output_map
.borrow()
.with_primary()
.map(|o| o.geometry())
.unwrap_or_else(|| Rectangle::from_loc_and_size((0, 0), (800, 800)));
if result.is_ok() {
surface.send_repositioned(token);
}
}
XdgRequest::Move {
surface,
seat,
serial,
} => {
let seat = Seat::from_resource(&seat).unwrap();
// TODO: touch move.
let pointer = seat.get_pointer().unwrap();
// Check that this surface has a click grab.
if !pointer.has_grab(serial) {
return;
}
let start_data = pointer.grab_start_data().unwrap();
// If the focus was for a different surface, ignore the request.
if start_data.focus.is_none()
|| !start_data
.focus
.as_ref()
.unwrap()
.0
.as_ref()
.same_client_as(surface.get_surface().unwrap().as_ref())
{
return;
}
let toplevel = SurfaceKind::Xdg(surface.clone());
let mut initial_window_location = xdg_window_map.borrow().location(&toplevel).unwrap();
// If surface is maximized then unmaximize it
if let Some(current_state) = surface.current_state() {
if current_state.states.contains(xdg_toplevel::State::Maximized) {
let fs_changed = surface.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.size = None;
});
if fs_changed.is_ok() {
surface.send_configure();
// NOTE: In real compositor mouse location should be mapped to a new window size
// For example, you could:
// 1) transform mouse pointer position from compositor space to window space (location relative)
// 2) divide the x coordinate by width of the window to get the percentage
// - 0.0 would be on the far left of the window
// - 0.5 would be in middle of the window
// - 1.0 would be on the far right of the window
// 3) multiply the percentage by new window width
// 4) by doing that, drag will look a lot more natural
//
// but for anvil needs setting location to pointer location is fine
let pos = pointer.current_location();
initial_window_location = (pos.x as i32, pos.y as i32).into();
}
}
}
let grab = MoveSurfaceGrab {
start_data,
window_map: xdg_window_map.clone(),
toplevel,
initial_window_location,
};
pointer.set_grab(grab, serial);
}
XdgRequest::Resize {
surface,
seat,
serial,
edges,
} => {
let seat = Seat::from_resource(&seat).unwrap();
// TODO: touch resize.
let pointer = seat.get_pointer().unwrap();
// Check that this surface has a click grab.
if !pointer.has_grab(serial) {
return;
}
let start_data = pointer.grab_start_data().unwrap();
// If the focus was for a different surface, ignore the request.
if start_data.focus.is_none()
|| !start_data
.focus
.as_ref()
.unwrap()
.0
.as_ref()
.same_client_as(surface.get_surface().unwrap().as_ref())
{
return;
}
let toplevel = SurfaceKind::Xdg(surface.clone());
let initial_window_location = xdg_window_map.borrow().location(&toplevel).unwrap();
let geometry = xdg_window_map.borrow().geometry(&toplevel).unwrap();
let initial_window_size = geometry.size;
with_states(surface.get_surface().unwrap(), move |states| {
states
.data_map
.get::<RefCell<SurfaceData>>()
.unwrap()
let max_x =
output_geometry.loc.x + (((output_geometry.size.w as f32) / 3.0) * 2.0) as i32;
let max_y =
output_geometry.loc.y + (((output_geometry.size.h as f32) / 3.0) * 2.0) as i32;
let x_range = Uniform::new(output_geometry.loc.x, max_x);
let y_range = Uniform::new(output_geometry.loc.y, max_y);
let mut rng = rand::thread_rng();
let x = x_range.sample(&mut rng);
let y = y_range.sample(&mut rng);
// Do not send a configure here, the initial configure
// of a xdg_surface has to be sent during the commit if
// the surface is not already configured
state
.window_map
.borrow_mut()
.resize_state = ResizeState::Resizing(ResizeData {
edges: edges.into(),
initial_window_location,
initial_window_size,
});
})
.unwrap();
.insert(SurfaceKind::Xdg(surface), (x, y).into());
}
let grab = ResizeSurfaceGrab {
start_data,
toplevel,
edges: edges.into(),
initial_window_size,
last_window_size: initial_window_size,
};
XdgRequest::NewPopup { surface, positioner } => {
// Do not send a configure here, the initial configure
// of a xdg_surface has to be sent during the commit if
// the surface is not already configured
pointer.set_grab(grab, serial);
}
XdgRequest::AckConfigure {
surface,
configure: Configure::Toplevel(configure),
..
} => {
let waiting_for_serial = with_states(&surface, |states| {
if let Some(data) = states.data_map.get::<RefCell<SurfaceData>>() {
if let ResizeState::WaitingForFinalAck(_, serial) = data.borrow().resize_state {
return Some(serial);
}
}
None
})
.unwrap();
if let Some(serial) = waiting_for_serial {
// When the resize grab is released the surface
// resize state will be set to WaitingForFinalAck
// and the client will receive a configure request
// without the resize state to inform the client
// resizing has finished. Here we will wait for
// the client to acknowledge the end of the
// resizing. To check if the surface was resizing
// before sending the configure we need to use
// the current state as the received acknowledge
// will no longer have the resize state set
let is_resizing = with_states(&surface, |states| {
states
.data_map
.get::<Mutex<XdgToplevelSurfaceRoleAttributes>>()
.unwrap()
.lock()
.unwrap()
.current
.states
.contains(xdg_toplevel::State::Resizing)
})
.unwrap();
if configure.serial >= serial && is_resizing {
with_states(&surface, |states| {
let mut data = states
.data_map
.get::<RefCell<SurfaceData>>()
.unwrap()
.borrow_mut();
if let ResizeState::WaitingForFinalAck(resize_data, _) = data.resize_state {
data.resize_state = ResizeState::WaitingForCommit(resize_data);
} else {
unreachable!()
}
// TODO: properly recompute the geometry with the whole of positioner state
surface
.with_pending_state(|state| {
// NOTE: This is not really necessary as the default geometry
// is already set the same way, but for demonstrating how
// to set the initial popup geometry this code is left as
// an example
state.geometry = positioner.get_geometry();
})
.unwrap();
state
.window_map
.borrow_mut()
.insert_popup(PopupKind::Xdg(surface));
}
XdgRequest::RePosition {
surface,
positioner,
token,
} => {
let result = surface.with_pending_state(|state| {
// NOTE: This is again a simplification, a proper compositor would
// calculate the geometry of the popup here. For simplicity we just
// use the default implementation here that does not take the
// window position and output constraints into account.
let geometry = positioner.get_geometry();
state.geometry = geometry;
state.positioner = positioner;
});
if result.is_ok() {
surface.send_repositioned(token);
}
}
}
XdgRequest::Fullscreen { surface, output, .. } => {
// NOTE: This is only one part of the solution. We can set the
// location and configure size here, but the surface should be rendered fullscreen
// independently from its buffer size
let wl_surface = if let Some(surface) = surface.get_surface() {
surface
} else {
// If there is no underlying surface just ignore the request
return;
};
let output_geometry = fullscreen_output_geometry(
wl_surface,
output.as_ref(),
&xdg_window_map.borrow(),
&xdg_output_map.borrow(),
);
XdgRequest::Move {
surface,
seat,
serial,
} => {
let seat = Seat::from_resource(&seat).unwrap();
// TODO: touch move.
let pointer = seat.get_pointer().unwrap();
if let Some(geometry) = output_geometry {
if let Some(surface) = surface.get_surface() {
let mut xdg_window_map = xdg_window_map.borrow_mut();
if let Some(kind) = xdg_window_map.find(surface) {
xdg_window_map.set_location(&kind, geometry.loc);
// Check that this surface has a click grab.
if !pointer.has_grab(serial) {
return;
}
let start_data = pointer.grab_start_data().unwrap();
// If the focus was for a different surface, ignore the request.
if start_data.focus.is_none()
|| !start_data
.focus
.as_ref()
.unwrap()
.0
.as_ref()
.same_client_as(surface.get_surface().unwrap().as_ref())
{
return;
}
let toplevel = SurfaceKind::Xdg(surface.clone());
let mut initial_window_location = state.window_map.borrow().location(&toplevel).unwrap();
// If surface is maximized then unmaximize it
if let Some(current_state) = surface.current_state() {
if current_state.states.contains(xdg_toplevel::State::Maximized) {
let fs_changed = surface.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.size = None;
});
if fs_changed.is_ok() {
surface.send_configure();
// NOTE: In real compositor mouse location should be mapped to a new window size
// For example, you could:
// 1) transform mouse pointer position from compositor space to window space (location relative)
// 2) divide the x coordinate by width of the window to get the percentage
// - 0.0 would be on the far left of the window
// - 0.5 would be in middle of the window
// - 1.0 would be on the far right of the window
// 3) multiply the percentage by new window width
// 4) by doing that, drag will look a lot more natural
//
// but for anvil needs setting location to pointer location is fine
let pos = pointer.current_location();
initial_window_location = (pos.x as i32, pos.y as i32).into();
}
}
}
let ret = surface.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Fullscreen);
state.size = Some(geometry.size);
state.fullscreen_output = output;
});
if ret.is_ok() {
surface.send_configure();
let grab = MoveSurfaceGrab {
start_data,
window_map: state.window_map.clone(),
toplevel,
initial_window_location,
};
pointer.set_grab(grab, serial);
}
XdgRequest::Resize {
surface,
seat,
serial,
edges,
} => {
let seat = Seat::from_resource(&seat).unwrap();
// TODO: touch resize.
let pointer = seat.get_pointer().unwrap();
// Check that this surface has a click grab.
if !pointer.has_grab(serial) {
return;
}
let start_data = pointer.grab_start_data().unwrap();
// If the focus was for a different surface, ignore the request.
if start_data.focus.is_none()
|| !start_data
.focus
.as_ref()
.unwrap()
.0
.as_ref()
.same_client_as(surface.get_surface().unwrap().as_ref())
{
return;
}
let toplevel = SurfaceKind::Xdg(surface.clone());
let initial_window_location = state.window_map.borrow().location(&toplevel).unwrap();
let geometry = state.window_map.borrow().geometry(&toplevel).unwrap();
let initial_window_size = geometry.size;
with_states(surface.get_surface().unwrap(), move |states| {
states
.data_map
.get::<RefCell<SurfaceData>>()
.unwrap()
.borrow_mut()
.resize_state = ResizeState::Resizing(ResizeData {
edges: edges.into(),
initial_window_location,
initial_window_size,
});
})
.unwrap();
let grab = ResizeSurfaceGrab {
start_data,
toplevel,
edges: edges.into(),
initial_window_size,
last_window_size: initial_window_size,
};
pointer.set_grab(grab, serial);
}
}
XdgRequest::UnFullscreen { surface } => {
let ret = surface.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Fullscreen);
state.size = None;
state.fullscreen_output = None;
});
if ret.is_ok() {
surface.send_configure();
}
}
XdgRequest::Maximize { surface } => {
// NOTE: This should use layer-shell when it is implemented to
// get the correct maximum size
let output_geometry = {
let xdg_window_map = xdg_window_map.borrow();
surface
.get_surface()
.and_then(|s| xdg_window_map.find(s))
.and_then(|k| xdg_window_map.location(&k))
.and_then(|position| {
xdg_output_map
.borrow()
.find_by_position(position)
.map(|o| o.geometry())
XdgRequest::AckConfigure {
surface,
configure: Configure::Toplevel(configure),
..
} => {
let waiting_for_serial = with_states(&surface, |states| {
if let Some(data) = states.data_map.get::<RefCell<SurfaceData>>() {
if let ResizeState::WaitingForFinalAck(_, serial) = data.borrow().resize_state {
return Some(serial);
}
}
None
})
.unwrap();
if let Some(serial) = waiting_for_serial {
// When the resize grab is released the surface
// resize state will be set to WaitingForFinalAck
// and the client will receive a configure request
// without the resize state to inform the client
// resizing has finished. Here we will wait for
// the client to acknowledge the end of the
// resizing. To check if the surface was resizing
// before sending the configure we need to use
// the current state as the received acknowledge
// will no longer have the resize state set
let is_resizing = with_states(&surface, |states| {
states
.data_map
.get::<Mutex<XdgToplevelSurfaceRoleAttributes>>()
.unwrap()
.lock()
.unwrap()
.current
.states
.contains(xdg_toplevel::State::Resizing)
})
};
.unwrap();
if let Some(geometry) = output_geometry {
if let Some(surface) = surface.get_surface() {
let mut xdg_window_map = xdg_window_map.borrow_mut();
if let Some(kind) = xdg_window_map.find(surface) {
xdg_window_map.set_location(&kind, geometry.loc);
if configure.serial >= serial && is_resizing {
with_states(&surface, |states| {
let mut data = states
.data_map
.get::<RefCell<SurfaceData>>()
.unwrap()
.borrow_mut();
if let ResizeState::WaitingForFinalAck(resize_data, _) = data.resize_state {
data.resize_state = ResizeState::WaitingForCommit(resize_data);
} else {
unreachable!()
}
})
.unwrap();
}
}
}
XdgRequest::Fullscreen { surface, output, .. } => {
// NOTE: This is only one part of the solution. We can set the
// location and configure size here, but the surface should be rendered fullscreen
// independently from its buffer size
let wl_surface = if let Some(surface) = surface.get_surface() {
surface
} else {
// If there is no underlying surface just ignore the request
return;
};
let output_geometry = fullscreen_output_geometry(
wl_surface,
output.as_ref(),
&state.window_map.borrow(),
&state.output_map.borrow(),
);
if let Some(geometry) = output_geometry {
if let Some(surface) = surface.get_surface() {
let mut xdg_window_map = state.window_map.borrow_mut();
if let Some(kind) = xdg_window_map.find(surface) {
xdg_window_map.set_location(&kind, geometry.loc);
}
}
let ret = surface.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Fullscreen);
state.size = Some(geometry.size);
state.fullscreen_output = output;
});
if ret.is_ok() {
surface.send_configure();
}
}
}
XdgRequest::UnFullscreen { surface } => {
let ret = surface.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Maximized);
state.size = Some(geometry.size);
state.states.unset(xdg_toplevel::State::Fullscreen);
state.size = None;
state.fullscreen_output = None;
});
if ret.is_ok() {
surface.send_configure();
}
}
}
XdgRequest::UnMaximize { surface } => {
let ret = surface.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.size = None;
});
if ret.is_ok() {
surface.send_configure();
XdgRequest::Maximize { surface } => {
// NOTE: This should use layer-shell when it is implemented to
// get the correct maximum size
let output_geometry = {
let xdg_window_map = state.window_map.borrow();
surface
.get_surface()
.and_then(|s| xdg_window_map.find(s))
.and_then(|k| xdg_window_map.location(&k))
.and_then(|position| {
state
.output_map
.borrow()
.find_by_position(position)
.map(|o| o.geometry())
})
};
if let Some(geometry) = output_geometry {
if let Some(surface) = surface.get_surface() {
let mut xdg_window_map = state.window_map.borrow_mut();
if let Some(kind) = xdg_window_map.find(surface) {
xdg_window_map.set_location(&kind, geometry.loc);
}
}
let ret = surface.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Maximized);
state.size = Some(geometry.size);
});
if ret.is_ok() {
surface.send_configure();
}
}
}
XdgRequest::UnMaximize { surface } => {
let ret = surface.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.size = None;
});
if ret.is_ok() {
surface.send_configure();
}
}
_ => (),
}
_ => (),
},
log.clone(),
);
// init the wl_shell
let shell_window_map = window_map.clone();
let shell_output_map = output_map.clone();
let (wl_shell_state, _) = wl_shell_init(
&mut *display.borrow_mut(),
move |req: ShellRequest, _dispatch_data| {
move |req: ShellRequest, mut ddata| {
let state = ddata.get::<AnvilState<BackendData>>().unwrap();
match req {
ShellRequest::SetKind {
surface,
@ -703,7 +717,8 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
// or if there is not output in a [0;800]x[0;800] square
use rand::distributions::{Distribution, Uniform};
let output_geometry = shell_output_map
let output_geometry = state
.output_map
.borrow()
.with_primary()
.map(|o| o.geometry())
@ -717,10 +732,12 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
let mut rng = rand::thread_rng();
let x = x_range.sample(&mut rng);
let y = y_range.sample(&mut rng);
shell_window_map
state
.window_map
.borrow_mut()
.insert(SurfaceKind::Wl(surface), (x, y).into());
}
ShellRequest::SetKind {
surface,
kind: ShellSurfaceKind::Fullscreen { output, .. },
@ -738,16 +755,18 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
let output_geometry = fullscreen_output_geometry(
wl_surface,
output.as_ref(),
&shell_window_map.borrow(),
&shell_output_map.borrow(),
&state.window_map.borrow(),
&state.output_map.borrow(),
);
if let Some(geometry) = output_geometry {
shell_window_map
state
.window_map
.borrow_mut()
.insert(SurfaceKind::Wl(surface), geometry.loc);
}
}
ShellRequest::Move {
surface,
seat,
@ -778,17 +797,18 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
}
let toplevel = SurfaceKind::Wl(surface);
let initial_window_location = shell_window_map.borrow().location(&toplevel).unwrap();
let initial_window_location = state.window_map.borrow().location(&toplevel).unwrap();
let grab = MoveSurfaceGrab {
start_data,
window_map: shell_window_map.clone(),
window_map: state.window_map.clone(),
toplevel,
initial_window_location,
};
pointer.set_grab(grab, serial);
}
ShellRequest::Resize {
surface,
seat,
@ -820,8 +840,8 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
}
let toplevel = SurfaceKind::Wl(surface.clone());
let initial_window_location = shell_window_map.borrow().location(&toplevel).unwrap();
let geometry = shell_window_map.borrow().geometry(&toplevel).unwrap();
let initial_window_location = state.window_map.borrow().location(&toplevel).unwrap();
let geometry = state.window_map.borrow().geometry(&toplevel).unwrap();
let initial_window_size = geometry.size;
with_states(surface.get_surface().unwrap(), move |states| {
@ -854,8 +874,6 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
log.clone(),
);
let layer_window_map = window_map.clone();
let layer_output_map = output_map.clone();
smithay::wayland::shell::wlr_layer::wlr_layer_shell_init(
&mut *display.borrow_mut(),
move |event, mut ddata| match event {
@ -865,8 +883,8 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
layer,
..
} => {
let output_map = layer_output_map.borrow();
let anvil_state = ddata.get::<AnvilState<BackendData>>().unwrap();
let output_map = anvil_state.output_map.borrow();
let output = output.and_then(|output| output_map.find_by_output(&output));
let output = output.unwrap_or_else(|| {
@ -878,9 +896,10 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
if let Some(wl_surface) = surface.get_surface() {
output.add_layer_surface(wl_surface.clone());
layer_window_map.borrow_mut().layers.insert(surface, layer);
anvil_state.window_map.borrow_mut().layers.insert(surface, layer);
}
}
LayerShellRequest::AckConfigure { .. } => {}
},
log.clone(),
@ -889,8 +908,6 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
ShellHandles {
xdg_state: xdg_shell_state,
wl_state: wl_shell_state,
window_map,
output_map,
}
}

View File

@ -26,7 +26,7 @@ use smithay::{
#[cfg(feature = "xwayland")]
use smithay::xwayland::{XWayland, XWaylandEvent};
use crate::shell::init_shell;
use crate::{output_map::OutputMap, shell::init_shell, window_map::WindowMap};
pub struct AnvilState<BackendData> {
pub backend_data: BackendData,
@ -79,11 +79,20 @@ impl<BackendData: Backend + 'static> AnvilState<BackendData> {
)
.expect("Failed to init the wayland event source.");
// Init a window map, to track the location of our windows
let window_map = Rc::new(RefCell::new(WindowMap::default()));
let output_map = Rc::new(RefCell::new(OutputMap::new(
display.clone(),
window_map.clone(),
log.clone(),
)));
// Init the basic compositor globals
init_shm_global(&mut (*display).borrow_mut(), vec![], log.clone());
let shell_handles = init_shell::<BackendData>(display.clone(), log.clone());
// Init the shell states
init_shell::<BackendData>(display.clone(), log.clone());
init_xdg_output_manager(&mut display.borrow_mut(), log.clone());
init_xdg_activation_global(
@ -192,8 +201,8 @@ impl<BackendData: Backend + 'static> AnvilState<BackendData> {
running: Arc::new(AtomicBool::new(true)),
display,
handle,
window_map: shell_handles.window_map,
output_map: shell_handles.output_map,
window_map,
output_map,
dnd_icon,
log,
socket_name,