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(
|
#[derive(Clone)]
|
||||||
display: &mut Display,
|
pub struct ShellHandles {
|
||||||
buffer_utils: BufferUtils,
|
pub token: CompositorToken<Roles>,
|
||||||
log: ::slog::Logger,
|
pub xdg_state: Arc<Mutex<XdgShellState<Roles>>>,
|
||||||
) -> (
|
pub wl_state: Arc<Mutex<WlShellState<Roles>>>,
|
||||||
CompositorToken<Roles>,
|
pub window_map: Rc<RefCell<MyWindowMap>>,
|
||||||
Arc<Mutex<XdgShellState<Roles>>>,
|
}
|
||||||
Arc<Mutex<WlShellState<Roles>>>,
|
|
||||||
Rc<RefCell<MyWindowMap>>,
|
pub fn init_shell(display: &mut Display, buffer_utils: BufferUtils, log: ::slog::Logger) -> ShellHandles {
|
||||||
) {
|
|
||||||
// TODO: this is awkward...
|
// TODO: this is awkward...
|
||||||
let almost_window_map = Rc::new(RefCell::new(None::<Rc<RefCell<MyWindowMap>>>));
|
let almost_window_map = Rc::new(RefCell::new(None::<Rc<RefCell<MyWindowMap>>>));
|
||||||
let almost_window_map_compositor = almost_window_map.clone();
|
let almost_window_map_compositor = almost_window_map.clone();
|
||||||
|
@ -606,7 +605,12 @@ pub fn init_shell(
|
||||||
log.clone(),
|
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.
|
/// Information about the resize operation.
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl AnvilState {
|
||||||
|
|
||||||
init_shm_global(&mut display.borrow_mut(), vec![], log.clone());
|
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
|
let socket_name = display
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
@ -98,7 +98,7 @@ impl AnvilState {
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
default_action_chooser,
|
default_action_chooser,
|
||||||
ctoken,
|
shell_handles.token,
|
||||||
log.clone(),
|
log.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ impl AnvilState {
|
||||||
running: Arc::new(AtomicBool::new(true)),
|
running: Arc::new(AtomicBool::new(true)),
|
||||||
display,
|
display,
|
||||||
handle,
|
handle,
|
||||||
ctoken,
|
ctoken: shell_handles.token,
|
||||||
window_map,
|
window_map: shell_handles.window_map,
|
||||||
dnd_icon,
|
dnd_icon,
|
||||||
log,
|
log,
|
||||||
socket_name,
|
socket_name,
|
||||||
|
|
Loading…
Reference in New Issue