anvil: Introduce ShellHandle type to simply return values
This commit is contained in:
parent
743a80c004
commit
64aedce01f
|
@ -282,16 +282,15 @@ impl PointerGrab for ResizeSurfaceGrab {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn init_shell(
|
||||
display: &mut Display,
|
||||
buffer_utils: BufferUtils,
|
||||
log: ::slog::Logger,
|
||||
) -> (
|
||||
CompositorToken<Roles>,
|
||||
Arc<Mutex<XdgShellState<Roles>>>,
|
||||
Arc<Mutex<WlShellState<Roles>>>,
|
||||
Rc<RefCell<MyWindowMap>>,
|
||||
) {
|
||||
#[derive(Clone)]
|
||||
pub struct ShellHandles {
|
||||
pub token: CompositorToken<Roles>,
|
||||
pub xdg_state: Arc<Mutex<XdgShellState<Roles>>>,
|
||||
pub wl_state: Arc<Mutex<WlShellState<Roles>>>,
|
||||
pub window_map: Rc<RefCell<MyWindowMap>>,
|
||||
}
|
||||
|
||||
pub fn init_shell(display: &mut Display, buffer_utils: BufferUtils, log: ::slog::Logger) -> ShellHandles {
|
||||
// TODO: this is awkward...
|
||||
let almost_window_map = Rc::new(RefCell::new(None::<Rc<RefCell<MyWindowMap>>>));
|
||||
let almost_window_map_compositor = almost_window_map.clone();
|
||||
|
@ -606,7 +605,12 @@ pub fn init_shell(
|
|||
log.clone(),
|
||||
);
|
||||
|
||||
(compositor_token, xdg_shell_state, wl_shell_state, window_map)
|
||||
ShellHandles {
|
||||
token: compositor_token,
|
||||
xdg_state: xdg_shell_state,
|
||||
wl_state: wl_shell_state,
|
||||
window_map,
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about the resize operation.
|
||||
|
|
|
@ -70,7 +70,7 @@ impl AnvilState {
|
|||
|
||||
init_shm_global(&mut display.borrow_mut(), vec![], log.clone());
|
||||
|
||||
let (ctoken, _, _, window_map) = init_shell(&mut display.borrow_mut(), buffer_utils, log.clone());
|
||||
let shell_handles = init_shell(&mut display.borrow_mut(), buffer_utils, log.clone());
|
||||
|
||||
let socket_name = display
|
||||
.borrow_mut()
|
||||
|
@ -98,7 +98,7 @@ impl AnvilState {
|
|||
_ => {}
|
||||
},
|
||||
default_action_chooser,
|
||||
ctoken,
|
||||
shell_handles.token,
|
||||
log.clone(),
|
||||
);
|
||||
|
||||
|
@ -106,8 +106,8 @@ impl AnvilState {
|
|||
running: Arc::new(AtomicBool::new(true)),
|
||||
display,
|
||||
handle,
|
||||
ctoken,
|
||||
window_map,
|
||||
ctoken: shell_handles.token,
|
||||
window_map: shell_handles.window_map,
|
||||
dnd_icon,
|
||||
log,
|
||||
socket_name,
|
||||
|
|
Loading…
Reference in New Issue