kazari 0.0.1

A no_std GUI software stack (Work-in-Progress)
//! The wl_data_source object is the source side of a wl_data_offer. it is created
//! by the source client in a data transfer and provides a way to describe the
//! offered data and a way to respond to requests to transfer the data.

//
//
//              GENERATED BY OUR WAYLAND-SCANNER. DO NOT EDIT!
//
//

#![allow(unused)]
#![allow(clippy::from_over_into)]
#![allow(clippy::match_single_binding)]

use crate::wl::{
    Array, Connection, Handle, Interface, Message, NewId, ObjectId, Opcode, Payload, PayloadType,
    RawMessage, SendError,
};
use alloc::rc::Rc;
use alloc::string::String;
use core::cell::RefCell;
use smallvec::smallvec;

use crate::wl::protocols::common::wl_buffer::WlBuffer;
use crate::wl::protocols::common::wl_callback::WlCallback;
use crate::wl::protocols::common::wl_compositor::WlCompositor;
use crate::wl::protocols::common::wl_data_device::WlDataDevice;
use crate::wl::protocols::common::wl_data_device_manager::WlDataDeviceManager;
use crate::wl::protocols::common::wl_data_offer::WlDataOffer;

use crate::wl::protocols::common::wl_data_source::*;
use crate::wl::protocols::common::wl_display::WlDisplay;
use crate::wl::protocols::common::wl_keyboard::WlKeyboard;
use crate::wl::protocols::common::wl_output::WlOutput;
use crate::wl::protocols::common::wl_pointer::WlPointer;
use crate::wl::protocols::common::wl_region::WlRegion;
use crate::wl::protocols::common::wl_registry::WlRegistry;
use crate::wl::protocols::common::wl_seat::WlSeat;
use crate::wl::protocols::common::wl_shell::WlShell;
use crate::wl::protocols::common::wl_shell_surface::WlShellSurface;
use crate::wl::protocols::common::wl_shm::WlShm;
use crate::wl::protocols::common::wl_shm_pool::WlShmPool;
use crate::wl::protocols::common::wl_subcompositor::WlSubcompositor;
use crate::wl::protocols::common::wl_subsurface::WlSubsurface;
use crate::wl::protocols::common::wl_surface::WlSurface;
use crate::wl::protocols::common::wl_touch::WlTouch;
use crate::wl::protocols::common::xdg_popup::XdgPopup;
use crate::wl::protocols::common::xdg_positioner::XdgPositioner;
use crate::wl::protocols::common::xdg_surface::XdgSurface;
use crate::wl::protocols::common::xdg_toplevel::XdgToplevel;
use crate::wl::protocols::common::xdg_wm_base::XdgWmBase;

pub trait WlDataSourceExt {
    /// This request adds a mime type to the set of mime types advertised to targets.
    /// can be called several times to offer multiple types.
    fn offer(&self, mime_type: String) -> Result<(), SendError>;
    /// Destroy the data source.
    fn destroy(&self) -> Result<(), SendError>;
    /// Sets the actions that the source side client supports for this operation. this
    /// request may trigger wl_data_source.action and wl_data_offer.action events if the
    /// compositor needs to change the selected action. the dnd_actions argument must
    /// contain only values expressed in the wl_data_device_manager.dnd_actions enum,
    /// otherwise it will result in a protocol error. this request must be made once
    /// only, and can only be made on sources used in drag-and-drop, so it must be
    /// performed before wl_data_device.start_drag. attempting to use the source other
    /// than for drag-and-drop will raise a protocol error.
    fn set_actions(
        &self,
        dnd_actions: super::super::common::wl_data_device_manager::DndAction,
    ) -> Result<(), SendError>;
}

impl WlDataSourceExt for WlDataSource {
    /// This request adds a mime type to the set of mime types advertised to targets.
    /// can be called several times to offer multiple types.
    fn offer(&self, mime_type: String) -> Result<(), SendError> {
        self.connection()
            .borrow_mut()
            .send(Request::Offer { mime_type }.into_raw(self.id()))
    }
    /// Destroy the data source.
    fn destroy(&self) -> Result<(), SendError> {
        self.connection()
            .borrow_mut()
            .send(Request::Destroy {}.into_raw(self.id()))
    }
    /// Sets the actions that the source side client supports for this operation. this
    /// request may trigger wl_data_source.action and wl_data_offer.action events if the
    /// compositor needs to change the selected action. the dnd_actions argument must
    /// contain only values expressed in the wl_data_device_manager.dnd_actions enum,
    /// otherwise it will result in a protocol error. this request must be made once
    /// only, and can only be made on sources used in drag-and-drop, so it must be
    /// performed before wl_data_device.start_drag. attempting to use the source other
    /// than for drag-and-drop will raise a protocol error.
    fn set_actions(
        &self,
        dnd_actions: super::super::common::wl_data_device_manager::DndAction,
    ) -> Result<(), SendError> {
        self.connection()
            .borrow_mut()
            .send(Request::SetActions { dnd_actions }.into_raw(self.id()))
    }
}