Function smithay::wayland::data_device::init_data_device[][src]

pub fn init_data_device<F, C, L>(
    display: &mut Display,
    callback: C,
    action_choice: F,
    logger: L
) -> Global<WlDataDeviceManager> where
    F: FnMut(DndAction, DndAction) -> DndAction + 'static,
    C: FnMut(DataDeviceEvent) + 'static,
    L: Into<Option<Logger>>, 
Expand description

Initialize the data device global

You can provide a callback to peek into the actions of your clients over the data devices (allowing you to retrieve the current selection buffer, or intercept DnD data). See the DataDeviceEvent type for details about what notifications you can receive. Note that this closure will not receive notifications about dnd actions the compositor initiated, see start_dnd for details about that.

You also need to provide a (DndAction, DndAction) -> DndAction closure that will arbitrate the choice of action resulting from a drag’n’drop session. Its first argument is the set of available actions (which is the intersection of the actions supported by the source and targets) and the second argument is the preferred action reported by the target. If no action should be chosen (and thus the drag’n’drop should abort on drop), return DndAction::empty().